diff --git a/board/BearPi_STM32L431RC/BSP/.mxproject b/board/BearPi_STM32L431RC/BSP/.mxproject
index b297bdd2..9788dfa9 100644
--- a/board/BearPi_STM32L431RC/BSP/.mxproject
+++ b/board/BearPi_STM32L431RC/BSP/.mxproject
@@ -1,14 +1,14 @@
[PreviousGenFiles]
HeaderPath=F:/RTOS/TencentOS/TencentOS-tiny/board/BearPi_STM32L31RC/BSP/Inc
-HeaderFiles=gpio.h;adc.h;dac.h;i2c.h;usart.h;spi.h;stm32l4xx_it.h;stm32l4xx_hal_conf.h;main.h;
+HeaderFiles=gpio.h;adc.h;i2c.h;usart.h;quadspi.h;sdmmc.h;spi.h;stm32l4xx_it.h;stm32l4xx_hal_conf.h;main.h;
SourcePath=F:/RTOS/TencentOS/TencentOS-tiny/board/BearPi_STM32L31RC/BSP/Src
-SourceFiles=gpio.c;adc.c;dac.c;i2c.c;usart.c;spi.c;stm32l4xx_it.c;stm32l4xx_hal_msp.c;main.c;
+SourceFiles=gpio.c;adc.c;i2c.c;usart.c;quadspi.c;sdmmc.c;spi.c;stm32l4xx_it.c;stm32l4xx_hal_msp.c;main.c;
[PreviousLibFiles]
-LibFiles=Drivers/STM32L4xx_HAL_Driver/Inc/stm32l4xx_hal_adc.h;Drivers/STM32L4xx_HAL_Driver/Inc/stm32l4xx_ll_adc.h;Drivers/STM32L4xx_HAL_Driver/Inc/stm32l4xx_hal_adc_ex.h;Drivers/STM32L4xx_HAL_Driver/Inc/stm32l4xx_hal_i2c.h;Drivers/STM32L4xx_HAL_Driver/Inc/stm32l4xx_hal_i2c_ex.h;Drivers/STM32L4xx_HAL_Driver/Inc/stm32l4xx_hal_uart.h;Drivers/STM32L4xx_HAL_Driver/Inc/stm32l4xx_hal_uart_ex.h;Drivers/STM32L4xx_HAL_Driver/Inc/stm32l4xx_hal_spi.h;Drivers/STM32L4xx_HAL_Driver/Inc/stm32l4xx_hal_spi_ex.h;Drivers/STM32L4xx_HAL_Driver/Inc/stm32l4xx_hal_tim.h;Drivers/STM32L4xx_HAL_Driver/Inc/stm32l4xx_hal.h;Drivers/STM32L4xx_HAL_Driver/Inc/stm32l4xx_hal_tim_ex.h;Drivers/STM32L4xx_HAL_Driver/Inc/stm32l4xx_hal_def.h;Drivers/STM32L4xx_HAL_Driver/Inc/Legacy/stm32_hal_legacy.h;Drivers/STM32L4xx_HAL_Driver/Inc/stm32l4xx_hal_rcc.h;Drivers/STM32L4xx_HAL_Driver/Inc/stm32l4xx_hal_rcc_ex.h;Drivers/STM32L4xx_HAL_Driver/Inc/stm32l4xx_hal_flash.h;Drivers/STM32L4xx_HAL_Driver/Inc/stm32l4xx_hal_flash_ex.h;Drivers/STM32L4xx_HAL_Driver/Inc/stm32l4xx_hal_flash_ramfunc.h;Drivers/STM32L4xx_HAL_Driver/Inc/stm32l4xx_hal_gpio.h;Drivers/STM32L4xx_HAL_Driver/Inc/stm32l4xx_hal_gpio_ex.h;Drivers/STM32L4xx_HAL_Driver/Inc/stm32l4xx_hal_dma.h;Drivers/STM32L4xx_HAL_Driver/Inc/stm32l4xx_hal_dma_ex.h;Drivers/STM32L4xx_HAL_Driver/Inc/stm32l4xx_hal_pwr.h;Drivers/STM32L4xx_HAL_Driver/Inc/stm32l4xx_hal_pwr_ex.h;Drivers/STM32L4xx_HAL_Driver/Inc/stm32l4xx_hal_cortex.h;Drivers/STM32L4xx_HAL_Driver/Inc/stm32l4xx_hal_exti.h;Drivers/STM32L4xx_HAL_Driver/Src/stm32l4xx_hal_adc.c;Drivers/STM32L4xx_HAL_Driver/Src/stm32l4xx_hal_adc_ex.c;Drivers/STM32L4xx_HAL_Driver/Src/stm32l4xx_hal_i2c.c;Drivers/STM32L4xx_HAL_Driver/Src/stm32l4xx_hal_i2c_ex.c;Drivers/STM32L4xx_HAL_Driver/Src/stm32l4xx_hal_uart.c;Drivers/STM32L4xx_HAL_Driver/Src/stm32l4xx_hal_uart_ex.c;Drivers/STM32L4xx_HAL_Driver/Src/stm32l4xx_hal_spi.c;Drivers/STM32L4xx_HAL_Driver/Src/stm32l4xx_hal_spi_ex.c;Drivers/STM32L4xx_HAL_Driver/Src/stm32l4xx_hal_tim.c;Drivers/STM32L4xx_HAL_Driver/Src/stm32l4xx_hal_tim_ex.c;Drivers/STM32L4xx_HAL_Driver/Src/stm32l4xx_hal.c;Drivers/STM32L4xx_HAL_Driver/Src/stm32l4xx_hal_rcc.c;Drivers/STM32L4xx_HAL_Driver/Src/stm32l4xx_hal_rcc_ex.c;Drivers/STM32L4xx_HAL_Driver/Src/stm32l4xx_hal_flash.c;Drivers/STM32L4xx_HAL_Driver/Src/stm32l4xx_hal_flash_ex.c;Drivers/STM32L4xx_HAL_Driver/Src/stm32l4xx_hal_flash_ramfunc.c;Drivers/STM32L4xx_HAL_Driver/Src/stm32l4xx_hal_gpio.c;Drivers/STM32L4xx_HAL_Driver/Src/stm32l4xx_hal_dma.c;Drivers/STM32L4xx_HAL_Driver/Src/stm32l4xx_hal_dma_ex.c;Drivers/STM32L4xx_HAL_Driver/Src/stm32l4xx_hal_pwr.c;Drivers/STM32L4xx_HAL_Driver/Src/stm32l4xx_hal_pwr_ex.c;Drivers/STM32L4xx_HAL_Driver/Src/stm32l4xx_hal_cortex.c;Drivers/STM32L4xx_HAL_Driver/Src/stm32l4xx_hal_exti.c;Drivers/STM32L4xx_HAL_Driver/Inc/stm32l4xx_hal_adc.h;Drivers/STM32L4xx_HAL_Driver/Inc/stm32l4xx_ll_adc.h;Drivers/STM32L4xx_HAL_Driver/Inc/stm32l4xx_hal_adc_ex.h;Drivers/STM32L4xx_HAL_Driver/Inc/stm32l4xx_hal_i2c.h;Drivers/STM32L4xx_HAL_Driver/Inc/stm32l4xx_hal_i2c_ex.h;Drivers/STM32L4xx_HAL_Driver/Inc/stm32l4xx_hal_uart.h;Drivers/STM32L4xx_HAL_Driver/Inc/stm32l4xx_hal_uart_ex.h;Drivers/STM32L4xx_HAL_Driver/Inc/stm32l4xx_hal_spi.h;Drivers/STM32L4xx_HAL_Driver/Inc/stm32l4xx_hal_spi_ex.h;Drivers/STM32L4xx_HAL_Driver/Inc/stm32l4xx_hal_tim.h;Drivers/STM32L4xx_HAL_Driver/Inc/stm32l4xx_hal.h;Drivers/STM32L4xx_HAL_Driver/Inc/stm32l4xx_hal_tim_ex.h;Drivers/STM32L4xx_HAL_Driver/Inc/stm32l4xx_hal_def.h;Drivers/STM32L4xx_HAL_Driver/Inc/Legacy/stm32_hal_legacy.h;Drivers/STM32L4xx_HAL_Driver/Inc/stm32l4xx_hal_rcc.h;Drivers/STM32L4xx_HAL_Driver/Inc/stm32l4xx_hal_rcc_ex.h;Drivers/STM32L4xx_HAL_Driver/Inc/stm32l4xx_hal_flash.h;Drivers/STM32L4xx_HAL_Driver/Inc/stm32l4xx_hal_flash_ex.h;Drivers/STM32L4xx_HAL_Driver/Inc/stm32l4xx_hal_flash_ramfunc.h;Drivers/STM32L4xx_HAL_Driver/Inc/stm32l4xx_hal_gpio.h;Drivers/STM32L4xx_HAL_Driver/Inc/stm32l4xx_hal_gpio_ex.h;Drivers/STM32L4xx_HAL_Driver/Inc/stm32l4xx_hal_dma.h;Drivers/STM32L4xx_HAL_Driver/Inc/stm32l4xx_hal_dma_ex.h;Drivers/STM32L4xx_HAL_Driver/Inc/stm32l4xx_hal_pwr.h;Drivers/STM32L4xx_HAL_Driver/Inc/stm32l4xx_hal_pwr_ex.h;Drivers/STM32L4xx_HAL_Driver/Inc/stm32l4xx_hal_cortex.h;Drivers/STM32L4xx_HAL_Driver/Inc/stm32l4xx_hal_exti.h;Drivers/CMSIS/Device/ST/STM32L4xx/Include/stm32l431xx.h;Drivers/CMSIS/Device/ST/STM32L4xx/Include/stm32l4xx.h;Drivers/CMSIS/Device/ST/STM32L4xx/Include/system_stm32l4xx.h;Drivers/CMSIS/Device/ST/STM32L4xx/Source/Templates/system_stm32l4xx.c;Drivers/CMSIS/Include/cmsis_armcc.h;Drivers/CMSIS/Include/cmsis_armclang.h;Drivers/CMSIS/Include/cmsis_compiler.h;Drivers/CMSIS/Include/cmsis_gcc.h;Drivers/CMSIS/Include/cmsis_iccarm.h;Drivers/CMSIS/Include/cmsis_version.h;Drivers/CMSIS/Include/core_armv8mbl.h;Drivers/CMSIS/Include/core_armv8mml.h;Drivers/CMSIS/Include/core_cm0.h;Drivers/CMSIS/Include/core_cm0plus.h;Drivers/CMSIS/Include/core_cm1.h;Drivers/CMSIS/Include/core_cm23.h;Drivers/CMSIS/Include/core_cm3.h;Drivers/CMSIS/Include/core_cm33.h;Drivers/CMSIS/Include/core_cm4.h;Drivers/CMSIS/Include/core_cm7.h;Drivers/CMSIS/Include/core_sc000.h;Drivers/CMSIS/Include/core_sc300.h;Drivers/CMSIS/Include/mpu_armv7.h;Drivers/CMSIS/Include/mpu_armv8.h;Drivers/CMSIS/Include/tz_context.h;
+LibFiles=Drivers/STM32L4xx_HAL_Driver/Inc/stm32l4xx_hal_adc.h;Drivers/STM32L4xx_HAL_Driver/Inc/stm32l4xx_ll_adc.h;Drivers/STM32L4xx_HAL_Driver/Inc/stm32l4xx_hal_adc_ex.h;Drivers/STM32L4xx_HAL_Driver/Inc/stm32l4xx_hal.h;Drivers/STM32L4xx_HAL_Driver/Inc/stm32l4xx_hal_def.h;Drivers/STM32L4xx_HAL_Driver/Inc/Legacy/stm32_hal_legacy.h;Drivers/STM32L4xx_HAL_Driver/Inc/stm32l4xx_hal_i2c.h;Drivers/STM32L4xx_HAL_Driver/Inc/stm32l4xx_hal_i2c_ex.h;Drivers/STM32L4xx_HAL_Driver/Inc/stm32l4xx_hal_rcc.h;Drivers/STM32L4xx_HAL_Driver/Inc/stm32l4xx_hal_rcc_ex.h;Drivers/STM32L4xx_HAL_Driver/Inc/stm32l4xx_hal_flash.h;Drivers/STM32L4xx_HAL_Driver/Inc/stm32l4xx_hal_flash_ex.h;Drivers/STM32L4xx_HAL_Driver/Inc/stm32l4xx_hal_flash_ramfunc.h;Drivers/STM32L4xx_HAL_Driver/Inc/stm32l4xx_hal_gpio.h;Drivers/STM32L4xx_HAL_Driver/Inc/stm32l4xx_hal_gpio_ex.h;Drivers/STM32L4xx_HAL_Driver/Inc/stm32l4xx_hal_dma.h;Drivers/STM32L4xx_HAL_Driver/Inc/stm32l4xx_hal_dma_ex.h;Drivers/STM32L4xx_HAL_Driver/Inc/stm32l4xx_hal_pwr.h;Drivers/STM32L4xx_HAL_Driver/Inc/stm32l4xx_hal_pwr_ex.h;Drivers/STM32L4xx_HAL_Driver/Inc/stm32l4xx_hal_cortex.h;Drivers/STM32L4xx_HAL_Driver/Inc/stm32l4xx_hal_exti.h;Drivers/STM32L4xx_HAL_Driver/Inc/stm32l4xx_hal_uart.h;Drivers/STM32L4xx_HAL_Driver/Inc/stm32l4xx_hal_uart_ex.h;Drivers/STM32L4xx_HAL_Driver/Inc/stm32l4xx_hal_qspi.h;Drivers/STM32L4xx_HAL_Driver/Inc/stm32l4xx_ll_sdmmc.h;Drivers/STM32L4xx_HAL_Driver/Inc/stm32l4xx_hal_sd.h;Drivers/STM32L4xx_HAL_Driver/Inc/stm32l4xx_hal_sd_ex.h;Drivers/STM32L4xx_HAL_Driver/Inc/stm32l4xx_hal_spi.h;Drivers/STM32L4xx_HAL_Driver/Inc/stm32l4xx_hal_spi_ex.h;Drivers/STM32L4xx_HAL_Driver/Inc/stm32l4xx_hal_tim.h;Drivers/STM32L4xx_HAL_Driver/Inc/stm32l4xx_hal_tim_ex.h;Drivers/STM32L4xx_HAL_Driver/Src/stm32l4xx_hal_adc.c;Drivers/STM32L4xx_HAL_Driver/Src/stm32l4xx_hal_adc_ex.c;Drivers/STM32L4xx_HAL_Driver/Src/stm32l4xx_hal.c;Drivers/STM32L4xx_HAL_Driver/Src/stm32l4xx_hal_i2c.c;Drivers/STM32L4xx_HAL_Driver/Src/stm32l4xx_hal_i2c_ex.c;Drivers/STM32L4xx_HAL_Driver/Src/stm32l4xx_hal_rcc.c;Drivers/STM32L4xx_HAL_Driver/Src/stm32l4xx_hal_rcc_ex.c;Drivers/STM32L4xx_HAL_Driver/Src/stm32l4xx_hal_flash.c;Drivers/STM32L4xx_HAL_Driver/Src/stm32l4xx_hal_flash_ex.c;Drivers/STM32L4xx_HAL_Driver/Src/stm32l4xx_hal_flash_ramfunc.c;Drivers/STM32L4xx_HAL_Driver/Src/stm32l4xx_hal_gpio.c;Drivers/STM32L4xx_HAL_Driver/Src/stm32l4xx_hal_dma.c;Drivers/STM32L4xx_HAL_Driver/Src/stm32l4xx_hal_dma_ex.c;Drivers/STM32L4xx_HAL_Driver/Src/stm32l4xx_hal_pwr.c;Drivers/STM32L4xx_HAL_Driver/Src/stm32l4xx_hal_pwr_ex.c;Drivers/STM32L4xx_HAL_Driver/Src/stm32l4xx_hal_cortex.c;Drivers/STM32L4xx_HAL_Driver/Src/stm32l4xx_hal_exti.c;Drivers/STM32L4xx_HAL_Driver/Src/stm32l4xx_hal_uart.c;Drivers/STM32L4xx_HAL_Driver/Src/stm32l4xx_hal_uart_ex.c;Drivers/STM32L4xx_HAL_Driver/Src/stm32l4xx_hal_qspi.c;Drivers/STM32L4xx_HAL_Driver/Src/stm32l4xx_ll_sdmmc.c;Drivers/STM32L4xx_HAL_Driver/Src/stm32l4xx_hal_sd.c;Drivers/STM32L4xx_HAL_Driver/Src/stm32l4xx_hal_sd_ex.c;Drivers/STM32L4xx_HAL_Driver/Src/stm32l4xx_hal_spi.c;Drivers/STM32L4xx_HAL_Driver/Src/stm32l4xx_hal_spi_ex.c;Drivers/STM32L4xx_HAL_Driver/Src/stm32l4xx_hal_tim.c;Drivers/STM32L4xx_HAL_Driver/Src/stm32l4xx_hal_tim_ex.c;Drivers/STM32L4xx_HAL_Driver/Inc/stm32l4xx_hal_adc.h;Drivers/STM32L4xx_HAL_Driver/Inc/stm32l4xx_ll_adc.h;Drivers/STM32L4xx_HAL_Driver/Inc/stm32l4xx_hal_adc_ex.h;Drivers/STM32L4xx_HAL_Driver/Inc/stm32l4xx_hal.h;Drivers/STM32L4xx_HAL_Driver/Inc/stm32l4xx_hal_def.h;Drivers/STM32L4xx_HAL_Driver/Inc/Legacy/stm32_hal_legacy.h;Drivers/STM32L4xx_HAL_Driver/Inc/stm32l4xx_hal_i2c.h;Drivers/STM32L4xx_HAL_Driver/Inc/stm32l4xx_hal_i2c_ex.h;Drivers/STM32L4xx_HAL_Driver/Inc/stm32l4xx_hal_rcc.h;Drivers/STM32L4xx_HAL_Driver/Inc/stm32l4xx_hal_rcc_ex.h;Drivers/STM32L4xx_HAL_Driver/Inc/stm32l4xx_hal_flash.h;Drivers/STM32L4xx_HAL_Driver/Inc/stm32l4xx_hal_flash_ex.h;Drivers/STM32L4xx_HAL_Driver/Inc/stm32l4xx_hal_flash_ramfunc.h;Drivers/STM32L4xx_HAL_Driver/Inc/stm32l4xx_hal_gpio.h;Drivers/STM32L4xx_HAL_Driver/Inc/stm32l4xx_hal_gpio_ex.h;Drivers/STM32L4xx_HAL_Driver/Inc/stm32l4xx_hal_dma.h;Drivers/STM32L4xx_HAL_Driver/Inc/stm32l4xx_hal_dma_ex.h;Drivers/STM32L4xx_HAL_Driver/Inc/stm32l4xx_hal_pwr.h;Drivers/STM32L4xx_HAL_Driver/Inc/stm32l4xx_hal_pwr_ex.h;Drivers/STM32L4xx_HAL_Driver/Inc/stm32l4xx_hal_cortex.h;Drivers/STM32L4xx_HAL_Driver/Inc/stm32l4xx_hal_exti.h;Drivers/STM32L4xx_HAL_Driver/Inc/stm32l4xx_hal_uart.h;Drivers/STM32L4xx_HAL_Driver/Inc/stm32l4xx_hal_uart_ex.h;Drivers/STM32L4xx_HAL_Driver/Inc/stm32l4xx_hal_qspi.h;Drivers/STM32L4xx_HAL_Driver/Inc/stm32l4xx_ll_sdmmc.h;Drivers/STM32L4xx_HAL_Driver/Inc/stm32l4xx_hal_sd.h;Drivers/STM32L4xx_HAL_Driver/Inc/stm32l4xx_hal_sd_ex.h;Drivers/STM32L4xx_HAL_Driver/Inc/stm32l4xx_hal_spi.h;Drivers/STM32L4xx_HAL_Driver/Inc/stm32l4xx_hal_spi_ex.h;Drivers/STM32L4xx_HAL_Driver/Inc/stm32l4xx_hal_tim.h;Drivers/STM32L4xx_HAL_Driver/Inc/stm32l4xx_hal_tim_ex.h;Drivers/CMSIS/Device/ST/STM32L4xx/Include/stm32l431xx.h;Drivers/CMSIS/Device/ST/STM32L4xx/Include/stm32l4xx.h;Drivers/CMSIS/Device/ST/STM32L4xx/Include/system_stm32l4xx.h;Drivers/CMSIS/Device/ST/STM32L4xx/Source/Templates/system_stm32l4xx.c;Drivers/CMSIS/Include/cmsis_armcc.h;Drivers/CMSIS/Include/cmsis_armclang.h;Drivers/CMSIS/Include/cmsis_compiler.h;Drivers/CMSIS/Include/cmsis_gcc.h;Drivers/CMSIS/Include/cmsis_iccarm.h;Drivers/CMSIS/Include/cmsis_version.h;Drivers/CMSIS/Include/core_armv8mbl.h;Drivers/CMSIS/Include/core_armv8mml.h;Drivers/CMSIS/Include/core_cm0.h;Drivers/CMSIS/Include/core_cm0plus.h;Drivers/CMSIS/Include/core_cm1.h;Drivers/CMSIS/Include/core_cm23.h;Drivers/CMSIS/Include/core_cm3.h;Drivers/CMSIS/Include/core_cm33.h;Drivers/CMSIS/Include/core_cm4.h;Drivers/CMSIS/Include/core_cm7.h;Drivers/CMSIS/Include/core_sc000.h;Drivers/CMSIS/Include/core_sc300.h;Drivers/CMSIS/Include/mpu_armv7.h;Drivers/CMSIS/Include/mpu_armv8.h;Drivers/CMSIS/Include/tz_context.h;
[PreviousUsedKeilFiles]
-SourceFiles=..\Src\main.c;..\Src\gpio.c;..\Src\adc.c;..\Src\i2c.c;..\Src\usart.c;..\Src\spi.c;..\Src\stm32l4xx_it.c;..\Src\stm32l4xx_hal_msp.c;../Drivers/STM32L4xx_HAL_Driver/Src/stm32l4xx_hal_adc.c;../Drivers/STM32L4xx_HAL_Driver/Src/stm32l4xx_hal_adc_ex.c;../Drivers/STM32L4xx_HAL_Driver/Src/stm32l4xx_hal_i2c.c;../Drivers/STM32L4xx_HAL_Driver/Src/stm32l4xx_hal_i2c_ex.c;../Drivers/STM32L4xx_HAL_Driver/Src/stm32l4xx_hal_uart.c;../Drivers/STM32L4xx_HAL_Driver/Src/stm32l4xx_hal_uart_ex.c;../Drivers/STM32L4xx_HAL_Driver/Src/stm32l4xx_hal_spi.c;../Drivers/STM32L4xx_HAL_Driver/Src/stm32l4xx_hal_spi_ex.c;../Drivers/STM32L4xx_HAL_Driver/Src/stm32l4xx_hal_tim.c;../Drivers/STM32L4xx_HAL_Driver/Src/stm32l4xx_hal_tim_ex.c;../Drivers/STM32L4xx_HAL_Driver/Src/stm32l4xx_hal.c;../Drivers/STM32L4xx_HAL_Driver/Src/stm32l4xx_hal_rcc.c;../Drivers/STM32L4xx_HAL_Driver/Src/stm32l4xx_hal_rcc_ex.c;../Drivers/STM32L4xx_HAL_Driver/Src/stm32l4xx_hal_flash.c;../Drivers/STM32L4xx_HAL_Driver/Src/stm32l4xx_hal_flash_ex.c;../Drivers/STM32L4xx_HAL_Driver/Src/stm32l4xx_hal_flash_ramfunc.c;../Drivers/STM32L4xx_HAL_Driver/Src/stm32l4xx_hal_gpio.c;../Drivers/STM32L4xx_HAL_Driver/Src/stm32l4xx_hal_dma.c;../Drivers/STM32L4xx_HAL_Driver/Src/stm32l4xx_hal_dma_ex.c;../Drivers/STM32L4xx_HAL_Driver/Src/stm32l4xx_hal_pwr.c;../Drivers/STM32L4xx_HAL_Driver/Src/stm32l4xx_hal_pwr_ex.c;../Drivers/STM32L4xx_HAL_Driver/Src/stm32l4xx_hal_cortex.c;../Drivers/STM32L4xx_HAL_Driver/Src/stm32l4xx_hal_exti.c;../\Src/system_stm32l4xx.c;../Drivers/STM32L4xx_HAL_Driver/Src/stm32l4xx_hal_adc.c;../Drivers/STM32L4xx_HAL_Driver/Src/stm32l4xx_hal_adc_ex.c;../Drivers/STM32L4xx_HAL_Driver/Src/stm32l4xx_hal_i2c.c;../Drivers/STM32L4xx_HAL_Driver/Src/stm32l4xx_hal_i2c_ex.c;../Drivers/STM32L4xx_HAL_Driver/Src/stm32l4xx_hal_uart.c;../Drivers/STM32L4xx_HAL_Driver/Src/stm32l4xx_hal_uart_ex.c;../Drivers/STM32L4xx_HAL_Driver/Src/stm32l4xx_hal_spi.c;../Drivers/STM32L4xx_HAL_Driver/Src/stm32l4xx_hal_spi_ex.c;../Drivers/STM32L4xx_HAL_Driver/Src/stm32l4xx_hal_tim.c;../Drivers/STM32L4xx_HAL_Driver/Src/stm32l4xx_hal_tim_ex.c;../Drivers/STM32L4xx_HAL_Driver/Src/stm32l4xx_hal.c;../Drivers/STM32L4xx_HAL_Driver/Src/stm32l4xx_hal_rcc.c;../Drivers/STM32L4xx_HAL_Driver/Src/stm32l4xx_hal_rcc_ex.c;../Drivers/STM32L4xx_HAL_Driver/Src/stm32l4xx_hal_flash.c;../Drivers/STM32L4xx_HAL_Driver/Src/stm32l4xx_hal_flash_ex.c;../Drivers/STM32L4xx_HAL_Driver/Src/stm32l4xx_hal_flash_ramfunc.c;../Drivers/STM32L4xx_HAL_Driver/Src/stm32l4xx_hal_gpio.c;../Drivers/STM32L4xx_HAL_Driver/Src/stm32l4xx_hal_dma.c;../Drivers/STM32L4xx_HAL_Driver/Src/stm32l4xx_hal_dma_ex.c;../Drivers/STM32L4xx_HAL_Driver/Src/stm32l4xx_hal_pwr.c;../Drivers/STM32L4xx_HAL_Driver/Src/stm32l4xx_hal_pwr_ex.c;../Drivers/STM32L4xx_HAL_Driver/Src/stm32l4xx_hal_cortex.c;../Drivers/STM32L4xx_HAL_Driver/Src/stm32l4xx_hal_exti.c;../\Src/system_stm32l4xx.c;../Drivers/CMSIS/Device/ST/STM32L4xx/Source/Templates/system_stm32l4xx.c;null;
+SourceFiles=..\Src\main.c;..\Src\gpio.c;..\Src\adc.c;..\Src\i2c.c;..\Src\usart.c;..\Src\quadspi.c;..\Src\sdmmc.c;..\Src\spi.c;..\Src\stm32l4xx_it.c;..\Src\stm32l4xx_hal_msp.c;../Drivers/STM32L4xx_HAL_Driver/Src/stm32l4xx_hal_adc.c;../Drivers/STM32L4xx_HAL_Driver/Src/stm32l4xx_hal_adc_ex.c;../Drivers/STM32L4xx_HAL_Driver/Src/stm32l4xx_hal.c;../Drivers/STM32L4xx_HAL_Driver/Src/stm32l4xx_hal_i2c.c;../Drivers/STM32L4xx_HAL_Driver/Src/stm32l4xx_hal_i2c_ex.c;../Drivers/STM32L4xx_HAL_Driver/Src/stm32l4xx_hal_rcc.c;../Drivers/STM32L4xx_HAL_Driver/Src/stm32l4xx_hal_rcc_ex.c;../Drivers/STM32L4xx_HAL_Driver/Src/stm32l4xx_hal_flash.c;../Drivers/STM32L4xx_HAL_Driver/Src/stm32l4xx_hal_flash_ex.c;../Drivers/STM32L4xx_HAL_Driver/Src/stm32l4xx_hal_flash_ramfunc.c;../Drivers/STM32L4xx_HAL_Driver/Src/stm32l4xx_hal_gpio.c;../Drivers/STM32L4xx_HAL_Driver/Src/stm32l4xx_hal_dma.c;../Drivers/STM32L4xx_HAL_Driver/Src/stm32l4xx_hal_dma_ex.c;../Drivers/STM32L4xx_HAL_Driver/Src/stm32l4xx_hal_pwr.c;../Drivers/STM32L4xx_HAL_Driver/Src/stm32l4xx_hal_pwr_ex.c;../Drivers/STM32L4xx_HAL_Driver/Src/stm32l4xx_hal_cortex.c;../Drivers/STM32L4xx_HAL_Driver/Src/stm32l4xx_hal_exti.c;../Drivers/STM32L4xx_HAL_Driver/Src/stm32l4xx_hal_uart.c;../Drivers/STM32L4xx_HAL_Driver/Src/stm32l4xx_hal_uart_ex.c;../Drivers/STM32L4xx_HAL_Driver/Src/stm32l4xx_hal_qspi.c;../Drivers/STM32L4xx_HAL_Driver/Src/stm32l4xx_ll_sdmmc.c;../Drivers/STM32L4xx_HAL_Driver/Src/stm32l4xx_hal_sd.c;../Drivers/STM32L4xx_HAL_Driver/Src/stm32l4xx_hal_sd_ex.c;../Drivers/STM32L4xx_HAL_Driver/Src/stm32l4xx_hal_spi.c;../Drivers/STM32L4xx_HAL_Driver/Src/stm32l4xx_hal_spi_ex.c;../Drivers/STM32L4xx_HAL_Driver/Src/stm32l4xx_hal_tim.c;../Drivers/STM32L4xx_HAL_Driver/Src/stm32l4xx_hal_tim_ex.c;..\\Src/system_stm32l4xx.c;../Drivers/STM32L4xx_HAL_Driver/Src/stm32l4xx_hal_adc.c;../Drivers/STM32L4xx_HAL_Driver/Src/stm32l4xx_hal_adc_ex.c;../Drivers/STM32L4xx_HAL_Driver/Src/stm32l4xx_hal.c;../Drivers/STM32L4xx_HAL_Driver/Src/stm32l4xx_hal_i2c.c;../Drivers/STM32L4xx_HAL_Driver/Src/stm32l4xx_hal_i2c_ex.c;../Drivers/STM32L4xx_HAL_Driver/Src/stm32l4xx_hal_rcc.c;../Drivers/STM32L4xx_HAL_Driver/Src/stm32l4xx_hal_rcc_ex.c;../Drivers/STM32L4xx_HAL_Driver/Src/stm32l4xx_hal_flash.c;../Drivers/STM32L4xx_HAL_Driver/Src/stm32l4xx_hal_flash_ex.c;../Drivers/STM32L4xx_HAL_Driver/Src/stm32l4xx_hal_flash_ramfunc.c;../Drivers/STM32L4xx_HAL_Driver/Src/stm32l4xx_hal_gpio.c;../Drivers/STM32L4xx_HAL_Driver/Src/stm32l4xx_hal_dma.c;../Drivers/STM32L4xx_HAL_Driver/Src/stm32l4xx_hal_dma_ex.c;../Drivers/STM32L4xx_HAL_Driver/Src/stm32l4xx_hal_pwr.c;../Drivers/STM32L4xx_HAL_Driver/Src/stm32l4xx_hal_pwr_ex.c;../Drivers/STM32L4xx_HAL_Driver/Src/stm32l4xx_hal_cortex.c;../Drivers/STM32L4xx_HAL_Driver/Src/stm32l4xx_hal_exti.c;../Drivers/STM32L4xx_HAL_Driver/Src/stm32l4xx_hal_uart.c;../Drivers/STM32L4xx_HAL_Driver/Src/stm32l4xx_hal_uart_ex.c;../Drivers/STM32L4xx_HAL_Driver/Src/stm32l4xx_hal_qspi.c;../Drivers/STM32L4xx_HAL_Driver/Src/stm32l4xx_ll_sdmmc.c;../Drivers/STM32L4xx_HAL_Driver/Src/stm32l4xx_hal_sd.c;../Drivers/STM32L4xx_HAL_Driver/Src/stm32l4xx_hal_sd_ex.c;../Drivers/STM32L4xx_HAL_Driver/Src/stm32l4xx_hal_spi.c;../Drivers/STM32L4xx_HAL_Driver/Src/stm32l4xx_hal_spi_ex.c;../Drivers/STM32L4xx_HAL_Driver/Src/stm32l4xx_hal_tim.c;../Drivers/STM32L4xx_HAL_Driver/Src/stm32l4xx_hal_tim_ex.c;..\\Src/system_stm32l4xx.c;../Drivers/CMSIS/Device/ST/STM32L4xx/Source/Templates/system_stm32l4xx.c;;
HeaderPath=..\Drivers\STM32L4xx_HAL_Driver\Inc;..\Drivers\STM32L4xx_HAL_Driver\Inc\Legacy;..\Drivers\CMSIS\Device\ST\STM32L4xx\Include;..\Drivers\CMSIS\Include;..\Inc;
CDefines=USE_HAL_DRIVER;STM32L431xx;USE_HAL_DRIVER;STM32L431xx;
diff --git a/board/BearPi_STM32L431RC/BSP/BearPi_STM32L31RC.ioc b/board/BearPi_STM32L431RC/BSP/BearPi_STM32L31RC.ioc
index 77281737..4a6c639d 100644
--- a/board/BearPi_STM32L431RC/BSP/BearPi_STM32L31RC.ioc
+++ b/board/BearPi_STM32L431RC/BSP/BearPi_STM32L31RC.ioc
@@ -14,17 +14,19 @@ LPUART1.WordLength=UART_WORDLENGTH_8B
Mcu.Family=STM32L4
Mcu.IP0=ADC1
Mcu.IP1=I2C1
-Mcu.IP10=USART2
-Mcu.IP11=USART3
+Mcu.IP10=SYS
+Mcu.IP11=USART1
+Mcu.IP12=USART2
+Mcu.IP13=USART3
Mcu.IP2=LPUART1
Mcu.IP3=NVIC
-Mcu.IP4=RCC
-Mcu.IP5=SPI1
-Mcu.IP6=SPI2
-Mcu.IP7=SPI3
-Mcu.IP8=SYS
-Mcu.IP9=USART1
-Mcu.IPNb=12
+Mcu.IP4=QUADSPI
+Mcu.IP5=RCC
+Mcu.IP6=SDMMC1
+Mcu.IP7=SPI1
+Mcu.IP8=SPI2
+Mcu.IP9=SPI3
+Mcu.IPNb=14
Mcu.Name=STM32L431R(B-C)Tx
Mcu.Package=LQFP64
Mcu.Pin0=PC13
@@ -35,31 +37,38 @@ Mcu.Pin12=PA4
Mcu.Pin13=PA6
Mcu.Pin14=PC4
Mcu.Pin15=PC5
-Mcu.Pin16=PB2
-Mcu.Pin17=PB13
-Mcu.Pin18=PB15
-Mcu.Pin19=PC6
+Mcu.Pin16=PB0
+Mcu.Pin17=PB1
+Mcu.Pin18=PB2
+Mcu.Pin19=PB10
Mcu.Pin2=PC15-OSC32_OUT (PC15)
-Mcu.Pin20=PC7
-Mcu.Pin21=PA9
-Mcu.Pin22=PA10
-Mcu.Pin23=PA12
-Mcu.Pin24=PA15 (JTDI)
-Mcu.Pin25=PC10
-Mcu.Pin26=PC11
-Mcu.Pin27=PB3 (JTDO-TRACESWO)
-Mcu.Pin28=PB5
-Mcu.Pin29=PB6
+Mcu.Pin20=PB11
+Mcu.Pin21=PB13
+Mcu.Pin22=PB15
+Mcu.Pin23=PC6
+Mcu.Pin24=PC7
+Mcu.Pin25=PC8
+Mcu.Pin26=PA9
+Mcu.Pin27=PA10
+Mcu.Pin28=PA12
+Mcu.Pin29=PA15 (JTDI)
Mcu.Pin3=PH0-OSC_IN (PH0)
-Mcu.Pin30=PB7
-Mcu.Pin31=VP_SYS_VS_Systick
+Mcu.Pin30=PC10
+Mcu.Pin31=PC11
+Mcu.Pin32=PC12
+Mcu.Pin33=PD2
+Mcu.Pin34=PB3 (JTDO-TRACESWO)
+Mcu.Pin35=PB5
+Mcu.Pin36=PB6
+Mcu.Pin37=PB7
+Mcu.Pin38=VP_SYS_VS_Systick
Mcu.Pin4=PH1-OSC_OUT (PH1)
Mcu.Pin5=PC0
Mcu.Pin6=PC1
Mcu.Pin7=PC2
Mcu.Pin8=PC3
Mcu.Pin9=PA1
-Mcu.PinsNb=32
+Mcu.PinsNb=39
Mcu.ThirdPartyNb=0
Mcu.UserConstants=
Mcu.UserName=STM32L431RCTx
@@ -68,6 +77,7 @@ MxDb.Version=DB.5.0.30
NVIC.BusFault_IRQn=true\:0\:0\:false\:false\:true\:false\:false
NVIC.DebugMonitor_IRQn=true\:0\:0\:false\:false\:true\:false\:false
NVIC.EXTI2_IRQn=true\:0\:0\:false\:false\:true\:true\:true
+NVIC.ForceEnableDMAVector=true
NVIC.HardFault_IRQn=true\:0\:0\:false\:false\:true\:false\:false
NVIC.LPUART1_IRQn=true\:0\:0\:false\:false\:true\:true\:true
NVIC.MemoryManagement_IRQn=true\:0\:0\:false\:false\:true\:false\:false
@@ -101,6 +111,14 @@ PA6.Mode=Full_Duplex_Master
PA6.Signal=SPI1_MISO
PA9.Mode=Asynchronous
PA9.Signal=USART1_TX
+PB0.Mode=Single Bank 1 2IOs
+PB0.Signal=QUADSPI_BK1_IO1
+PB1.Mode=Single Bank 1 2IOs
+PB1.Signal=QUADSPI_BK1_IO0
+PB10.Mode=Single Bank 1 2IOs
+PB10.Signal=QUADSPI_CLK
+PB11.Mode=Single Bank 1 2IOs
+PB11.Signal=QUADSPI_BK1_NCS
PB13.Locked=true
PB13.Mode=TX_Only_Simplex_Unidirect_Master
PB13.Signal=SPI2_SCK
@@ -133,6 +151,8 @@ PC10.Mode=Full_Duplex_Master
PC10.Signal=SPI3_SCK
PC11.Mode=Full_Duplex_Master
PC11.Signal=SPI3_MISO
+PC12.Mode=SD_1_bit
+PC12.Signal=SDMMC1_CK
PC13.GPIOParameters=GPIO_Label
PC13.GPIO_Label=LED
PC13.Locked=true
@@ -158,14 +178,10 @@ PC7.GPIOParameters=GPIO_Label
PC7.GPIO_Label=LCD_RST
PC7.Locked=true
PC7.Signal=GPIO_Output
-PCC.Checker=true
-PCC.Line=STM32L4x1
-PCC.MCU=STM32L431R(B-C)Tx
-PCC.PartNumber=STM32L431RCTx
-PCC.Seq0=0
-PCC.Series=STM32L4
-PCC.Temperature=25
-PCC.Vdd=3.0
+PC8.Mode=SD_1_bit
+PC8.Signal=SDMMC1_D0
+PD2.Mode=SD_1_bit
+PD2.Signal=SDMMC1_CMD
PH0-OSC_IN\ (PH0).Mode=HSE-External-Oscillator
PH0-OSC_IN\ (PH0).Signal=RCC_OSC_IN
PH1-OSC_OUT\ (PH1).Mode=HSE-External-Oscillator
@@ -193,11 +209,18 @@ ProjectManager.PreviousToolchain=
ProjectManager.ProjectBuild=false
ProjectManager.ProjectFileName=BearPi_STM32L31RC.ioc
ProjectManager.ProjectName=BearPi_STM32L31RC
+ProjectManager.RegisterCallBack=
ProjectManager.StackSize=0x400
ProjectManager.TargetToolchain=MDK-ARM V5
ProjectManager.ToolChainLocation=
ProjectManager.UnderRoot=false
-ProjectManager.functionlistsort=1-MX_GPIO_Init-GPIO-false-HAL-true,2-SystemClock_Config-RCC-false-HAL-false,3-MX_ADC1_Init-ADC1-false-HAL-true,4-MX_I2C1_Init-I2C1-false-HAL-true,5-MX_LPUART1_UART_Init-LPUART1-false-HAL-true,6-MX_USART2_UART_Init-USART2-false-HAL-true,7-MX_USART3_UART_Init-USART3-false-HAL-true,8-MX_SPI1_Init-SPI1-false-HAL-true,9-MX_SPI3_Init-SPI3-false-HAL-true,10-MX_SPI2_Init-SPI2-false-HAL-true
+ProjectManager.functionlistsort=1-MX_GPIO_Init-GPIO-false-HAL-true,2-SystemClock_Config-RCC-false-HAL-false,3-MX_ADC1_Init-ADC1-false-HAL-true,4-MX_I2C1_Init-I2C1-false-HAL-true,5-MX_LPUART1_UART_Init-LPUART1-false-HAL-true,6-MX_USART2_UART_Init-USART2-false-HAL-true,7-MX_USART3_UART_Init-USART3-false-HAL-true,8-MX_SPI1_Init-SPI1-false-HAL-true,9-MX_SPI3_Init-SPI3-false-HAL-true,10-MX_SPI2_Init-SPI2-false-HAL-true,11-MX_USART1_UART_Init-USART1-false-HAL-true,12-MX_SDMMC1_SD_Init-SDMMC1-false-HAL-true,13-MX_QUADSPI_Init-QUADSPI-false-HAL-true
+QUADSPI.ChipSelectHighTime=QSPI_CS_HIGH_TIME_4_CYCLE
+QUADSPI.ClockPrescaler=0
+QUADSPI.FifoThreshold=4
+QUADSPI.FlashSize=22
+QUADSPI.IPParameters=ClockPrescaler,FifoThreshold,SampleShifting,FlashSize,ChipSelectHighTime
+QUADSPI.SampleShifting=QSPI_SAMPLE_SHIFTING_HALFCYCLE
RCC.ADCFreq_Value=32000000
RCC.AHBFreq_Value=80000000
RCC.APB1Freq_Value=80000000
diff --git a/board/BearPi_STM32L431RC/BSP/Hardware/W25QXX-QSPI/w25qxx.c b/board/BearPi_STM32L431RC/BSP/Hardware/W25QXX-QSPI/w25qxx.c
new file mode 100644
index 00000000..765370a3
--- /dev/null
+++ b/board/BearPi_STM32L431RC/BSP/Hardware/W25QXX-QSPI/w25qxx.c
@@ -0,0 +1,343 @@
+#include "w25qxx.h"
+#include "quadspi.h"
+
+int w25qxx_init(void)
+{
+ MX_QUADSPI_Init();
+ return 0;
+}
+
+int w25qxx_memory_mapped(void)
+{
+ QSPI_CommandTypeDef cmd = {
+ // Instruction
+ .InstructionMode = QSPI_INSTRUCTION_1_LINE,
+ .Instruction = FAST_READ_DUAL_IO_CMD,
+ // Address
+ .AddressMode = QSPI_ADDRESS_2_LINES,
+ .Address = 0, // NOT USED for memory-mapped mode
+ .AddressSize = QSPI_ADDRESS_24_BITS,
+ // AlternateByte
+ .AlternateByteMode = QSPI_ALTERNATE_BYTES_2_LINES,
+ .AlternateBytes = 0xF0, // M7-M0 should be set to Fxh
+ .AlternateBytesSize = QSPI_ALTERNATE_BYTES_8_BITS,
+ // Dummy
+ .DummyCycles = 0,
+ // Data
+ .DataMode = QSPI_DATA_2_LINES,
+ .NbData = 0, // NOT USED for memory-mapped mode
+ // DDR
+ .DdrMode = QSPI_DDR_MODE_DISABLE,
+ };
+ QSPI_MemoryMappedTypeDef cfg = {
+ .TimeOutPeriod = 0,
+ .TimeOutActivation = QSPI_TIMEOUT_COUNTER_DISABLE,
+ };
+ if (HAL_QSPI_GetState(&hqspi) != HAL_QSPI_STATE_BUSY_MEM_MAPPED) {
+ if (HAL_QSPI_Abort(&hqspi) != HAL_OK) {
+ return -1;
+ }
+ if (HAL_QSPI_MemoryMapped(&hqspi, &cmd, &cfg) != HAL_OK) {
+ return -1;
+ }
+ }
+ return 0;
+}
+
+uint16_t w25qxx_read_deviceid(void)
+{
+ uint8_t recv_buf[2] = {0};
+ uint16_t device_id = 0;
+ QSPI_CommandTypeDef cmd = {
+ // Instruction
+ .InstructionMode = QSPI_INSTRUCTION_1_LINE,
+ .Instruction = ManufactDeviceID_CMD,
+ // Address
+ .AddressMode = QSPI_ADDRESS_1_LINE,
+ .Address = 0,
+ .AddressSize = QSPI_ADDRESS_24_BITS,
+ // AlternateByte
+ .AlternateByteMode = QSPI_ALTERNATE_BYTES_NONE,
+ // Dummy
+ .DummyCycles = 0,
+ // Data
+ .DataMode = QSPI_DATA_1_LINE,
+ .NbData = 2,
+ // DDR
+ .DdrMode = QSPI_DDR_MODE_DISABLE,
+ };
+ if (HAL_QSPI_Abort(&hqspi) != HAL_OK) {
+ return 0;
+ }
+ if (HAL_QSPI_Command(&hqspi, &cmd, HAL_QSPI_TIMEOUT_DEFAULT_VALUE) != HAL_OK) {
+ return 0;
+ }
+ if (HAL_QSPI_Receive(&hqspi, recv_buf, HAL_QSPI_TIMEOUT_DEFAULT_VALUE) != HAL_OK) {
+ return 0;
+ }
+ device_id = (recv_buf[0] << 8) | recv_buf[1];
+ return device_id;
+}
+
+static void w25qxx_wait_busy(void)
+{
+ uint8_t status;
+ QSPI_CommandTypeDef cmd = {
+ // Instruction
+ .InstructionMode = QSPI_INSTRUCTION_1_LINE,
+ .Instruction = READ_STATU_REGISTER_1,
+ // Address
+ .AddressMode = QSPI_ADDRESS_NONE,
+ // AlternateByte
+ .AlternateByteMode = QSPI_ALTERNATE_BYTES_NONE,
+ // Dummy
+ .DummyCycles = 0,
+ // Data
+ .DataMode = QSPI_DATA_1_LINE,
+ .NbData = 1,
+ // DDR
+ .DdrMode = QSPI_DDR_MODE_DISABLE,
+ };
+ HAL_QSPI_Command(&hqspi, &cmd, HAL_QSPI_TIMEOUT_DEFAULT_VALUE);
+ do {
+ HAL_QSPI_Receive(&hqspi, &status, HAL_QSPI_TIMEOUT_DEFAULT_VALUE);
+ } while ((status & 0x01) == 0x01);
+}
+
+int w25qxx_read(uint8_t *buffer, uint32_t start_addr, uint16_t nbytes)
+{
+ QSPI_CommandTypeDef cmd = {
+ // Instruction
+ .InstructionMode = QSPI_INSTRUCTION_1_LINE,
+ .Instruction = FAST_READ_DUAL_IO_CMD,
+ // Address
+ .AddressMode = QSPI_ADDRESS_2_LINES,
+ .Address = start_addr,
+ .AddressSize = QSPI_ADDRESS_24_BITS,
+ // AlternateByte
+ .AlternateByteMode = QSPI_ALTERNATE_BYTES_2_LINES,
+ .AlternateBytes = 0xF0, // M7-M0 should be set to Fxh
+ .AlternateBytesSize = QSPI_ALTERNATE_BYTES_8_BITS,
+ // Dummy
+ .DummyCycles = 0,
+ // Data
+ .DataMode = QSPI_DATA_2_LINES,
+ .NbData = nbytes,
+ // DDR
+ .DdrMode = QSPI_DDR_MODE_DISABLE,
+ };
+ if (HAL_QSPI_Abort(&hqspi) != HAL_OK) {
+ return -1;
+ }
+ if (HAL_QSPI_Command(&hqspi, &cmd, HAL_QSPI_TIMEOUT_DEFAULT_VALUE) != HAL_OK) {
+ return -1;
+ }
+ if (HAL_QSPI_Receive(&hqspi, buffer, HAL_QSPI_TIMEOUT_DEFAULT_VALUE) != HAL_OK) {
+ return -1;
+ }
+ return 0;
+}
+
+static void w25qxx_write_enable(void)
+{
+ QSPI_CommandTypeDef cmd = {
+ // Instruction
+ .InstructionMode = QSPI_INSTRUCTION_1_LINE,
+ .Instruction = WRITE_ENABLE_CMD,
+ // Address
+ .AddressMode = QSPI_ADDRESS_NONE,
+ // AlternateByte
+ .AlternateByteMode = QSPI_ALTERNATE_BYTES_NONE,
+ // Dummy
+ .DummyCycles = 0,
+ // Data
+ .DataMode = QSPI_DATA_NONE,
+ // DDR
+ .DdrMode = QSPI_DDR_MODE_DISABLE,
+ };
+ HAL_QSPI_Command(&hqspi, &cmd, HAL_QSPI_TIMEOUT_DEFAULT_VALUE);
+ // w25qxx_wait_busy();
+}
+
+static void w25qxx_write_disable(void)
+{
+ QSPI_CommandTypeDef cmd = {
+ // Instruction
+ .InstructionMode = QSPI_INSTRUCTION_1_LINE,
+ .Instruction = WRITE_DISABLE_CMD,
+ // Address
+ .AddressMode = QSPI_ADDRESS_NONE,
+ // AlternateByte
+ .AlternateByteMode = QSPI_ALTERNATE_BYTES_NONE,
+ // Dummy
+ .DummyCycles = 0,
+ // Data
+ .DataMode = QSPI_DATA_NONE,
+ // DDR
+ .DdrMode = QSPI_DDR_MODE_DISABLE,
+ };
+ HAL_QSPI_Command(&hqspi, &cmd, HAL_QSPI_TIMEOUT_DEFAULT_VALUE);
+ // w25qxx_wait_busy();
+}
+
+int w25qxx_erase_sector(uint32_t sector_addr)
+{
+ QSPI_CommandTypeDef cmd = {
+ // Instruction
+ .InstructionMode = QSPI_INSTRUCTION_1_LINE,
+ .Instruction = SECTOR_ERASE_CMD,
+ // Address
+ .AddressMode = QSPI_ADDRESS_1_LINE,
+ .Address = sector_addr,
+ .AddressSize = QSPI_ADDRESS_24_BITS,
+ // AlternateByte
+ .AlternateByteMode = QSPI_ALTERNATE_BYTES_NONE,
+ // Dummy
+ .DummyCycles = 0,
+ // Data
+ .DataMode = QSPI_DATA_NONE,
+ // DDR
+ .DdrMode = QSPI_DDR_MODE_DISABLE,
+ };
+
+ if (HAL_QSPI_Abort(&hqspi) != HAL_OK) {
+ return -1;
+ }
+
+ w25qxx_wait_busy();
+
+ w25qxx_write_enable();
+
+ if (HAL_QSPI_Command(&hqspi, &cmd, HAL_QSPI_TIMEOUT_DEFAULT_VALUE) != HAL_OK) {
+ return -1;
+ }
+
+ w25qxx_wait_busy();
+
+ return 0;
+}
+
+int w25qxx_erase_chip(void)
+{
+ QSPI_CommandTypeDef cmd = {
+ // Instruction
+ .InstructionMode = QSPI_INSTRUCTION_1_LINE,
+ .Instruction = CHIP_ERASE_CMD,
+ // Address
+ .AddressMode = QSPI_ADDRESS_NONE,
+ // AlternateByte
+ .AlternateByteMode = QSPI_ALTERNATE_BYTES_NONE,
+ // Dummy
+ .DummyCycles = 0,
+ // Data
+ .DataMode = QSPI_DATA_NONE,
+ // DDR
+ .DdrMode = QSPI_DDR_MODE_DISABLE,
+ };
+
+ if (HAL_QSPI_Abort(&hqspi) != HAL_OK) {
+ return -1;
+ }
+
+ w25qxx_wait_busy();
+
+ w25qxx_write_enable();
+
+ if (HAL_QSPI_Command(&hqspi, &cmd, HAL_QSPI_TIMEOUT_DEFAULT_VALUE) != HAL_OK) {
+ return -1;
+ }
+
+ w25qxx_wait_busy();
+
+ return 0;
+}
+
+int w25qxx_page_program(uint8_t *dat, uint32_t write_addr, uint16_t nbytes)
+{
+ QSPI_CommandTypeDef cmd = {
+ // Instruction
+ .InstructionMode = QSPI_INSTRUCTION_1_LINE,
+ .Instruction = PAGE_PROGRAM_CMD,
+ // Address
+ .AddressMode = QSPI_ADDRESS_1_LINE,
+ .Address = write_addr,
+ .AddressSize = QSPI_ADDRESS_24_BITS,
+ // AlternateByte
+ .AlternateByteMode = QSPI_ALTERNATE_BYTES_NONE,
+ // Dummy
+ .DummyCycles = 0,
+ // Data
+ .DataMode = QSPI_DATA_1_LINE,
+ .NbData = nbytes,
+ // DDR
+ .DdrMode = QSPI_DDR_MODE_DISABLE,
+ };
+
+ if (HAL_QSPI_Abort(&hqspi) != HAL_OK) {
+ return -1;
+ }
+
+ w25qxx_wait_busy();
+
+ w25qxx_write_enable();
+
+ if (HAL_QSPI_Command(&hqspi, &cmd, HAL_QSPI_TIMEOUT_DEFAULT_VALUE) != HAL_OK) {
+ return -1;
+ }
+ if (HAL_QSPI_Transmit(&hqspi, dat, HAL_QSPI_TIMEOUT_DEFAULT_VALUE) != HAL_OK) {
+ return -1;
+ }
+
+ w25qxx_wait_busy();
+
+ return 0;
+}
+
+int w25qxx_reset(void)
+{
+ QSPI_CommandTypeDef cmd1 = {
+ // Instruction
+ .InstructionMode = QSPI_INSTRUCTION_1_LINE,
+ .Instruction = ENABLE_RESET_CMD,
+ // Address
+ .AddressMode = QSPI_ADDRESS_NONE,
+ // AlternateByte
+ .AlternateByteMode = QSPI_ALTERNATE_BYTES_NONE,
+ // Dummy
+ .DummyCycles = 0,
+ // Data
+ .DataMode = QSPI_DATA_NONE,
+ // DDR
+ .DdrMode = QSPI_DDR_MODE_DISABLE,
+ };
+ QSPI_CommandTypeDef cmd2 = {
+ // Instruction
+ .InstructionMode = QSPI_INSTRUCTION_1_LINE,
+ .Instruction = RESET_DEVICE_CMD,
+ // Address
+ .AddressMode = QSPI_ADDRESS_NONE,
+ // AlternateByte
+ .AlternateByteMode = QSPI_ALTERNATE_BYTES_NONE,
+ // Dummy
+ .DummyCycles = 0,
+ // Data
+ .DataMode = QSPI_DATA_NONE,
+ // DDR
+ .DdrMode = QSPI_DDR_MODE_DISABLE,
+ };
+
+ if (HAL_QSPI_Abort(&hqspi) != HAL_OK) {
+ return -1;
+ }
+
+ if (HAL_QSPI_Command(&hqspi, &cmd1, HAL_QSPI_TIMEOUT_DEFAULT_VALUE) != HAL_OK) {
+ return -1;
+ }
+ if (HAL_QSPI_Command(&hqspi, &cmd2, HAL_QSPI_TIMEOUT_DEFAULT_VALUE) != HAL_OK) {
+ return -1;
+ }
+
+ w25qxx_wait_busy();
+
+ return 0;
+}
diff --git a/board/BearPi_STM32L431RC/BSP/Hardware/W25QXX-QSPI/w25qxx.h b/board/BearPi_STM32L431RC/BSP/Hardware/W25QXX-QSPI/w25qxx.h
new file mode 100644
index 00000000..b1a2051f
--- /dev/null
+++ b/board/BearPi_STM32L431RC/BSP/Hardware/W25QXX-QSPI/w25qxx.h
@@ -0,0 +1,40 @@
+#ifndef _W25QXX_H_
+#define _W25QXX_H_
+#include "main.h"
+
+enum {
+ ManufactDeviceID_CMD = 0x90,
+ READ_STATU_REGISTER_1 = 0x05,
+ READ_STATU_REGISTER_2 = 0x35,
+ WRITE_STATU_REGISTER = 0x01,
+ READ_DATA_CMD = 0x03,
+ FAST_READ_CMD = 0x0B,
+ FAST_READ_DUAL_O_CMD = 0x3B,
+ FAST_READ_DUAL_IO_CMD = 0xBB,
+ FAST_READ_QUAD_O_CMD = 0x6B,
+ FAST_READ_QUAD_IO_CMD = 0xEB,
+ WRITE_ENABLE_CMD = 0x06,
+ WRITE_DISABLE_CMD = 0x04,
+ SECTOR_ERASE_CMD = 0x20,
+ CHIP_ERASE_CMD = 0xc7,
+ PAGE_PROGRAM_CMD = 0x02,
+ QUAD_PAGE_PROGRAM_CMD = 0x32,
+ BLOCK_ERASE_64KB_CMD = 0xD8,
+ BLOCK_ERASE_32KB_CMD = 0x52,
+ ERASE_SUSPEND_CMD = 0x75,
+ ERASE_RESUME_CMD = 0x7A,
+ HIGH_PERFORM_MODE_CMD = 0xA3,
+ ENABLE_RESET_CMD = 0x66,
+ RESET_DEVICE_CMD = 0x99,
+};
+
+int w25qxx_init(void);
+int w25qxx_memory_mapped(void);
+uint16_t w25qxx_read_deviceid(void);
+int w25qxx_read(uint8_t* buffer, uint32_t start_addr, uint16_t nbytes);
+int w25qxx_erase_sector(uint32_t sector_addr);
+int w25qxx_erase_chip(void);
+int w25qxx_page_program(uint8_t* dat, uint32_t write_addr, uint16_t nbytes);
+int w25qxx_reset(void);
+
+#endif /* _W25QXX_H_ */
diff --git a/board/BearPi_STM32L431RC/BSP/Inc/quadspi.h b/board/BearPi_STM32L431RC/BSP/Inc/quadspi.h
new file mode 100644
index 00000000..118b51b4
--- /dev/null
+++ b/board/BearPi_STM32L431RC/BSP/Inc/quadspi.h
@@ -0,0 +1,58 @@
+/**
+ ******************************************************************************
+ * File Name : QUADSPI.h
+ * Description : This file provides code for the configuration
+ * of the QUADSPI instances.
+ ******************************************************************************
+ * @attention
+ *
+ *
© Copyright (c) 2022 STMicroelectronics.
+ * All rights reserved.
+ *
+ * This software component is licensed by ST under BSD 3-Clause license,
+ * the "License"; You may not use this file except in compliance with the
+ * License. You may obtain a copy of the License at:
+ * opensource.org/licenses/BSD-3-Clause
+ *
+ ******************************************************************************
+ */
+/* Define to prevent recursive inclusion -------------------------------------*/
+#ifndef __quadspi_H
+#define __quadspi_H
+#ifdef __cplusplus
+ extern "C" {
+#endif
+
+/* Includes ------------------------------------------------------------------*/
+#include "main.h"
+
+/* USER CODE BEGIN Includes */
+
+/* USER CODE END Includes */
+
+extern QSPI_HandleTypeDef hqspi;
+
+/* USER CODE BEGIN Private defines */
+
+/* USER CODE END Private defines */
+
+void MX_QUADSPI_Init(void);
+
+/* USER CODE BEGIN Prototypes */
+
+/* USER CODE END Prototypes */
+
+#ifdef __cplusplus
+}
+#endif
+#endif /*__ quadspi_H */
+
+/**
+ * @}
+ */
+
+/**
+ * @}
+ */
+
+/************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/
diff --git a/board/BearPi_STM32L431RC/BSP/Inc/sdmmc.h b/board/BearPi_STM32L431RC/BSP/Inc/sdmmc.h
new file mode 100644
index 00000000..1bfdc09b
--- /dev/null
+++ b/board/BearPi_STM32L431RC/BSP/Inc/sdmmc.h
@@ -0,0 +1,58 @@
+/**
+ ******************************************************************************
+ * File Name : SDMMC.h
+ * Description : This file provides code for the configuration
+ * of the SDMMC instances.
+ ******************************************************************************
+ * @attention
+ *
+ * © Copyright (c) 2020 STMicroelectronics.
+ * All rights reserved.
+ *
+ * This software component is licensed by ST under BSD 3-Clause license,
+ * the "License"; You may not use this file except in compliance with the
+ * License. You may obtain a copy of the License at:
+ * opensource.org/licenses/BSD-3-Clause
+ *
+ ******************************************************************************
+ */
+/* Define to prevent recursive inclusion -------------------------------------*/
+#ifndef __sdmmc_H
+#define __sdmmc_H
+#ifdef __cplusplus
+ extern "C" {
+#endif
+
+/* Includes ------------------------------------------------------------------*/
+#include "main.h"
+
+/* USER CODE BEGIN Includes */
+
+/* USER CODE END Includes */
+
+extern SD_HandleTypeDef hsd1;
+
+/* USER CODE BEGIN Private defines */
+
+/* USER CODE END Private defines */
+
+void MX_SDMMC1_SD_Init(void);
+
+/* USER CODE BEGIN Prototypes */
+
+/* USER CODE END Prototypes */
+
+#ifdef __cplusplus
+}
+#endif
+#endif /*__ sdmmc_H */
+
+/**
+ * @}
+ */
+
+/**
+ * @}
+ */
+
+/************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/
diff --git a/board/BearPi_STM32L431RC/BSP/Inc/stm32l4xx_hal_conf.h b/board/BearPi_STM32L431RC/BSP/Inc/stm32l4xx_hal_conf.h
index e75091c5..d825554f 100644
--- a/board/BearPi_STM32L431RC/BSP/Inc/stm32l4xx_hal_conf.h
+++ b/board/BearPi_STM32L431RC/BSP/Inc/stm32l4xx_hal_conf.h
@@ -78,11 +78,11 @@
/*#define HAL_OSPI_MODULE_ENABLED */
/*#define HAL_PCD_MODULE_ENABLED */
/*#define HAL_QSPI_MODULE_ENABLED */
-/*#define HAL_QSPI_MODULE_ENABLED */
+#define HAL_QSPI_MODULE_ENABLED
/*#define HAL_RNG_MODULE_ENABLED */
/*#define HAL_RTC_MODULE_ENABLED */
/*#define HAL_SAI_MODULE_ENABLED */
-/*#define HAL_SD_MODULE_ENABLED */
+#define HAL_SD_MODULE_ENABLED
/*#define HAL_SMBUS_MODULE_ENABLED */
/*#define HAL_SMARTCARD_MODULE_ENABLED */
#define HAL_SPI_MODULE_ENABLED
diff --git a/board/BearPi_STM32L431RC/BSP/Src/mcu_init.c b/board/BearPi_STM32L431RC/BSP/Src/mcu_init.c
index 7787f2e5..e0c1a37c 100644
--- a/board/BearPi_STM32L431RC/BSP/Src/mcu_init.c
+++ b/board/BearPi_STM32L431RC/BSP/Src/mcu_init.c
@@ -103,21 +103,24 @@ void SystemClock_Config(void)
{
Error_Handler();
}
- PeriphClkInit.PeriphClockSelection = RCC_PERIPHCLK_USART2|RCC_PERIPHCLK_USART3
- |RCC_PERIPHCLK_LPUART1|RCC_PERIPHCLK_I2C1
+ PeriphClkInit.PeriphClockSelection = RCC_PERIPHCLK_USART1|RCC_PERIPHCLK_USART2
+ |RCC_PERIPHCLK_USART3|RCC_PERIPHCLK_LPUART1
+ |RCC_PERIPHCLK_I2C1|RCC_PERIPHCLK_SDMMC1
|RCC_PERIPHCLK_ADC;
+ PeriphClkInit.Usart1ClockSelection = RCC_USART1CLKSOURCE_PCLK2;
PeriphClkInit.Usart2ClockSelection = RCC_USART2CLKSOURCE_PCLK1;
PeriphClkInit.Usart3ClockSelection = RCC_USART3CLKSOURCE_PCLK1;
PeriphClkInit.Lpuart1ClockSelection = RCC_LPUART1CLKSOURCE_PCLK1;
PeriphClkInit.I2c1ClockSelection = RCC_I2C1CLKSOURCE_PCLK1;
PeriphClkInit.AdcClockSelection = RCC_ADCCLKSOURCE_PLLSAI1;
+ PeriphClkInit.Sdmmc1ClockSelection = RCC_SDMMC1CLKSOURCE_PLLSAI1;
PeriphClkInit.PLLSAI1.PLLSAI1Source = RCC_PLLSOURCE_MSI;
PeriphClkInit.PLLSAI1.PLLSAI1M = 1;
PeriphClkInit.PLLSAI1.PLLSAI1N = 16;
PeriphClkInit.PLLSAI1.PLLSAI1P = RCC_PLLP_DIV7;
PeriphClkInit.PLLSAI1.PLLSAI1Q = RCC_PLLQ_DIV2;
PeriphClkInit.PLLSAI1.PLLSAI1R = RCC_PLLR_DIV2;
- PeriphClkInit.PLLSAI1.PLLSAI1ClockOut = RCC_PLLSAI1_ADC1CLK;
+ PeriphClkInit.PLLSAI1.PLLSAI1ClockOut = RCC_PLLSAI1_48M2CLK|RCC_PLLSAI1_ADC1CLK;
if (HAL_RCCEx_PeriphCLKConfig(&PeriphClkInit) != HAL_OK)
{
Error_Handler();
diff --git a/board/BearPi_STM32L431RC/BSP/Src/quadspi.c b/board/BearPi_STM32L431RC/BSP/Src/quadspi.c
new file mode 100644
index 00000000..e0033a86
--- /dev/null
+++ b/board/BearPi_STM32L431RC/BSP/Src/quadspi.c
@@ -0,0 +1,110 @@
+/**
+ ******************************************************************************
+ * File Name : QUADSPI.c
+ * Description : This file provides code for the configuration
+ * of the QUADSPI instances.
+ ******************************************************************************
+ * @attention
+ *
+ * © Copyright (c) 2022 STMicroelectronics.
+ * All rights reserved.
+ *
+ * This software component is licensed by ST under BSD 3-Clause license,
+ * the "License"; You may not use this file except in compliance with the
+ * License. You may obtain a copy of the License at:
+ * opensource.org/licenses/BSD-3-Clause
+ *
+ ******************************************************************************
+ */
+
+/* Includes ------------------------------------------------------------------*/
+#include "quadspi.h"
+
+/* USER CODE BEGIN 0 */
+
+/* USER CODE END 0 */
+
+QSPI_HandleTypeDef hqspi;
+
+/* QUADSPI init function */
+void MX_QUADSPI_Init(void)
+{
+
+ hqspi.Instance = QUADSPI;
+ hqspi.Init.ClockPrescaler = 0;
+ hqspi.Init.FifoThreshold = 4;
+ hqspi.Init.SampleShifting = QSPI_SAMPLE_SHIFTING_HALFCYCLE;
+ hqspi.Init.FlashSize = 22;
+ hqspi.Init.ChipSelectHighTime = QSPI_CS_HIGH_TIME_4_CYCLE;
+ hqspi.Init.ClockMode = QSPI_CLOCK_MODE_0;
+ hqspi.Init.FlashID = QSPI_FLASH_ID_1;
+ hqspi.Init.DualFlash = QSPI_DUALFLASH_DISABLE;
+ if (HAL_QSPI_Init(&hqspi) != HAL_OK)
+ {
+ Error_Handler();
+ }
+
+}
+
+void HAL_QSPI_MspInit(QSPI_HandleTypeDef* qspiHandle)
+{
+
+ GPIO_InitTypeDef GPIO_InitStruct = {0};
+ if(qspiHandle->Instance==QUADSPI)
+ {
+ /* USER CODE BEGIN QUADSPI_MspInit 0 */
+
+ /* USER CODE END QUADSPI_MspInit 0 */
+ /* QUADSPI clock enable */
+ __HAL_RCC_QSPI_CLK_ENABLE();
+
+ __HAL_RCC_GPIOB_CLK_ENABLE();
+ /**QUADSPI GPIO Configuration
+ PB0 ------> QUADSPI_BK1_IO1
+ PB1 ------> QUADSPI_BK1_IO0
+ PB10 ------> QUADSPI_CLK
+ PB11 ------> QUADSPI_BK1_NCS
+ */
+ GPIO_InitStruct.Pin = GPIO_PIN_0|GPIO_PIN_1|GPIO_PIN_10|GPIO_PIN_11;
+ GPIO_InitStruct.Mode = GPIO_MODE_AF_PP;
+ GPIO_InitStruct.Pull = GPIO_NOPULL;
+ GPIO_InitStruct.Speed = GPIO_SPEED_FREQ_VERY_HIGH;
+ GPIO_InitStruct.Alternate = GPIO_AF10_QUADSPI;
+ HAL_GPIO_Init(GPIOB, &GPIO_InitStruct);
+
+ /* USER CODE BEGIN QUADSPI_MspInit 1 */
+
+ /* USER CODE END QUADSPI_MspInit 1 */
+ }
+}
+
+void HAL_QSPI_MspDeInit(QSPI_HandleTypeDef* qspiHandle)
+{
+
+ if(qspiHandle->Instance==QUADSPI)
+ {
+ /* USER CODE BEGIN QUADSPI_MspDeInit 0 */
+
+ /* USER CODE END QUADSPI_MspDeInit 0 */
+ /* Peripheral clock disable */
+ __HAL_RCC_QSPI_CLK_DISABLE();
+
+ /**QUADSPI GPIO Configuration
+ PB0 ------> QUADSPI_BK1_IO1
+ PB1 ------> QUADSPI_BK1_IO0
+ PB10 ------> QUADSPI_CLK
+ PB11 ------> QUADSPI_BK1_NCS
+ */
+ HAL_GPIO_DeInit(GPIOB, GPIO_PIN_0|GPIO_PIN_1|GPIO_PIN_10|GPIO_PIN_11);
+
+ /* USER CODE BEGIN QUADSPI_MspDeInit 1 */
+
+ /* USER CODE END QUADSPI_MspDeInit 1 */
+ }
+}
+
+/* USER CODE BEGIN 1 */
+
+/* USER CODE END 1 */
+
+/************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/
diff --git a/board/BearPi_STM32L431RC/BSP/Src/sdmmc.c b/board/BearPi_STM32L431RC/BSP/Src/sdmmc.c
new file mode 100644
index 00000000..47745ea5
--- /dev/null
+++ b/board/BearPi_STM32L431RC/BSP/Src/sdmmc.c
@@ -0,0 +1,117 @@
+/**
+ ******************************************************************************
+ * File Name : SDMMC.c
+ * Description : This file provides code for the configuration
+ * of the SDMMC instances.
+ ******************************************************************************
+ * @attention
+ *
+ * © Copyright (c) 2020 STMicroelectronics.
+ * All rights reserved.
+ *
+ * This software component is licensed by ST under BSD 3-Clause license,
+ * the "License"; You may not use this file except in compliance with the
+ * License. You may obtain a copy of the License at:
+ * opensource.org/licenses/BSD-3-Clause
+ *
+ ******************************************************************************
+ */
+
+/* Includes ------------------------------------------------------------------*/
+#include "sdmmc.h"
+
+/* USER CODE BEGIN 0 */
+
+/* USER CODE END 0 */
+
+SD_HandleTypeDef hsd1;
+
+/* SDMMC1 init function */
+
+void MX_SDMMC1_SD_Init(void)
+{
+
+ hsd1.Instance = SDMMC1;
+ hsd1.Init.ClockEdge = SDMMC_CLOCK_EDGE_RISING;
+ hsd1.Init.ClockBypass = SDMMC_CLOCK_BYPASS_DISABLE;
+ hsd1.Init.ClockPowerSave = SDMMC_CLOCK_POWER_SAVE_DISABLE;
+ hsd1.Init.BusWide = SDMMC_BUS_WIDE_1B;
+ hsd1.Init.HardwareFlowControl = SDMMC_HARDWARE_FLOW_CONTROL_DISABLE;
+ hsd1.Init.ClockDiv = 0;
+ if (HAL_SD_Init(&hsd1) != HAL_OK)
+ {
+ Error_Handler();
+ }
+
+}
+
+void HAL_SD_MspInit(SD_HandleTypeDef* sdHandle)
+{
+
+ GPIO_InitTypeDef GPIO_InitStruct = {0};
+ if(sdHandle->Instance==SDMMC1)
+ {
+ /* USER CODE BEGIN SDMMC1_MspInit 0 */
+
+ /* USER CODE END SDMMC1_MspInit 0 */
+ /* SDMMC1 clock enable */
+ __HAL_RCC_SDMMC1_CLK_ENABLE();
+
+ __HAL_RCC_GPIOC_CLK_ENABLE();
+ __HAL_RCC_GPIOD_CLK_ENABLE();
+ /**SDMMC1 GPIO Configuration
+ PC8 ------> SDMMC1_D0
+ PC12 ------> SDMMC1_CK
+ PD2 ------> SDMMC1_CMD
+ */
+ GPIO_InitStruct.Pin = GPIO_PIN_8|GPIO_PIN_12;
+ GPIO_InitStruct.Mode = GPIO_MODE_AF_PP;
+ GPIO_InitStruct.Pull = GPIO_NOPULL;
+ GPIO_InitStruct.Speed = GPIO_SPEED_FREQ_VERY_HIGH;
+ GPIO_InitStruct.Alternate = GPIO_AF12_SDMMC1;
+ HAL_GPIO_Init(GPIOC, &GPIO_InitStruct);
+
+ GPIO_InitStruct.Pin = GPIO_PIN_2;
+ GPIO_InitStruct.Mode = GPIO_MODE_AF_PP;
+ GPIO_InitStruct.Pull = GPIO_NOPULL;
+ GPIO_InitStruct.Speed = GPIO_SPEED_FREQ_VERY_HIGH;
+ GPIO_InitStruct.Alternate = GPIO_AF12_SDMMC1;
+ HAL_GPIO_Init(GPIOD, &GPIO_InitStruct);
+
+ /* USER CODE BEGIN SDMMC1_MspInit 1 */
+
+ /* USER CODE END SDMMC1_MspInit 1 */
+ }
+}
+
+void HAL_SD_MspDeInit(SD_HandleTypeDef* sdHandle)
+{
+
+ if(sdHandle->Instance==SDMMC1)
+ {
+ /* USER CODE BEGIN SDMMC1_MspDeInit 0 */
+
+ /* USER CODE END SDMMC1_MspDeInit 0 */
+ /* Peripheral clock disable */
+ __HAL_RCC_SDMMC1_CLK_DISABLE();
+
+ /**SDMMC1 GPIO Configuration
+ PC8 ------> SDMMC1_D0
+ PC12 ------> SDMMC1_CK
+ PD2 ------> SDMMC1_CMD
+ */
+ HAL_GPIO_DeInit(GPIOC, GPIO_PIN_8|GPIO_PIN_12);
+
+ HAL_GPIO_DeInit(GPIOD, GPIO_PIN_2);
+
+ /* USER CODE BEGIN SDMMC1_MspDeInit 1 */
+
+ /* USER CODE END SDMMC1_MspDeInit 1 */
+ }
+}
+
+/* USER CODE BEGIN 1 */
+
+/* USER CODE END 1 */
+
+/************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/
diff --git a/board/BearPi_STM32L431RC/BSP/Src/stm32l4xx_it_mpy.c b/board/BearPi_STM32L431RC/BSP/Src/stm32l4xx_it_mpy.c
new file mode 100644
index 00000000..78cb75af
--- /dev/null
+++ b/board/BearPi_STM32L431RC/BSP/Src/stm32l4xx_it_mpy.c
@@ -0,0 +1,360 @@
+/* USER CODE BEGIN Header */
+/**
+ ******************************************************************************
+ * @file stm32l4xx_it.c
+ * @brief Interrupt Service Routines.
+ ******************************************************************************
+ * @attention
+ *
+ * © Copyright (c) 2019 STMicroelectronics.
+ * All rights reserved.
+ *
+ * This software component is licensed by ST under BSD 3-Clause license,
+ * the "License"; You may not use this file except in compliance with the
+ * License. You may obtain a copy of the License at:
+ * opensource.org/licenses/BSD-3-Clause
+ *
+ ******************************************************************************
+ */
+/* USER CODE END Header */
+
+/* Includes ------------------------------------------------------------------*/
+#include "main.h"
+#include "stm32l4xx_it.h"
+#include "tos_k.h"
+/* Private includes ----------------------------------------------------------*/
+/* USER CODE BEGIN Includes */
+#include "machine_uart.h"
+/* USER CODE END Includes */
+
+/* Private typedef -----------------------------------------------------------*/
+/* USER CODE BEGIN TD */
+
+/* USER CODE END TD */
+
+/* Private define ------------------------------------------------------------*/
+/* USER CODE BEGIN PD */
+
+/* USER CODE END PD */
+
+/* Private macro -------------------------------------------------------------*/
+/* USER CODE BEGIN PM */
+
+/* USER CODE END PM */
+
+/* Private variables ---------------------------------------------------------*/
+/* USER CODE BEGIN PV */
+
+/* USER CODE END PV */
+
+/* Private function prototypes -----------------------------------------------*/
+/* USER CODE BEGIN PFP */
+
+/* USER CODE END PFP */
+
+/* Private user code ---------------------------------------------------------*/
+/* USER CODE BEGIN 0 */
+
+/* USER CODE END 0 */
+
+/* External variables --------------------------------------------------------*/
+extern UART_HandleTypeDef hlpuart1;
+extern UART_HandleTypeDef huart2;
+extern UART_HandleTypeDef huart3;
+/* USER CODE BEGIN EV */
+
+/* USER CODE END EV */
+
+/******************************************************************************/
+/* Cortex-M4 Processor Interruption and Exception Handlers */
+/******************************************************************************/
+/**
+ * @brief This function handles Non maskable interrupt.
+ */
+void NMI_Handler(void)
+{
+ /* USER CODE BEGIN NonMaskableInt_IRQn 0 */
+
+ /* USER CODE END NonMaskableInt_IRQn 0 */
+ /* USER CODE BEGIN NonMaskableInt_IRQn 1 */
+
+ /* USER CODE END NonMaskableInt_IRQn 1 */
+}
+
+/**
+ * @brief This function handles Hard fault interrupt.
+ */
+void HardFault_Handler(void)
+{
+ /* USER CODE BEGIN HardFault_IRQn 0 */
+
+ /* USER CODE END HardFault_IRQn 0 */
+ while (1)
+ {
+ /* USER CODE BEGIN W1_HardFault_IRQn 0 */
+ /* USER CODE END W1_HardFault_IRQn 0 */
+ }
+}
+
+/**
+ * @brief This function handles Memory management fault.
+ */
+void MemManage_Handler(void)
+{
+ /* USER CODE BEGIN MemoryManagement_IRQn 0 */
+
+ /* USER CODE END MemoryManagement_IRQn 0 */
+ while (1)
+ {
+ /* USER CODE BEGIN W1_MemoryManagement_IRQn 0 */
+ /* USER CODE END W1_MemoryManagement_IRQn 0 */
+ }
+}
+
+/**
+ * @brief This function handles Prefetch fault, memory access fault.
+ */
+void BusFault_Handler(void)
+{
+ /* USER CODE BEGIN BusFault_IRQn 0 */
+
+ /* USER CODE END BusFault_IRQn 0 */
+ while (1)
+ {
+ /* USER CODE BEGIN W1_BusFault_IRQn 0 */
+ /* USER CODE END W1_BusFault_IRQn 0 */
+ }
+}
+
+/**
+ * @brief This function handles Undefined instruction or illegal state.
+ */
+void UsageFault_Handler(void)
+{
+ /* USER CODE BEGIN UsageFault_IRQn 0 */
+
+ /* USER CODE END UsageFault_IRQn 0 */
+ while (1)
+ {
+ /* USER CODE BEGIN W1_UsageFault_IRQn 0 */
+ /* USER CODE END W1_UsageFault_IRQn 0 */
+ }
+}
+
+/**
+ * @brief This function handles System service call via SWI instruction.
+ */
+void SVC_Handler(void)
+{
+ /* USER CODE BEGIN SVCall_IRQn 0 */
+
+ /* USER CODE END SVCall_IRQn 0 */
+ /* USER CODE BEGIN SVCall_IRQn 1 */
+
+ /* USER CODE END SVCall_IRQn 1 */
+}
+
+/**
+ * @brief This function handles Debug monitor.
+ */
+void DebugMon_Handler(void)
+{
+ /* USER CODE BEGIN DebugMonitor_IRQn 0 */
+
+ /* USER CODE END DebugMonitor_IRQn 0 */
+ /* USER CODE BEGIN DebugMonitor_IRQn 1 */
+
+ /* USER CODE END DebugMonitor_IRQn 1 */
+}
+
+/**
+ * @brief This function handles Pendable request for system service.
+ */
+__weak void PendSV_Handler(void)
+{
+ /* USER CODE BEGIN PendSV_IRQn 0 */
+
+ /* USER CODE END PendSV_IRQn 0 */
+ /* USER CODE BEGIN PendSV_IRQn 1 */
+
+ /* USER CODE END PendSV_IRQn 1 */
+}
+
+/**
+ * @brief This function handles System tick timer.
+ */
+void SysTick_Handler(void)
+{
+ /* USER CODE BEGIN SysTick_IRQn 0 */
+
+ /* USER CODE END SysTick_IRQn 0 */
+ HAL_IncTick();
+ if (tos_knl_is_running())
+ {
+ tos_knl_irq_enter();
+ tos_tick_handler();
+ tos_knl_irq_leave();
+ }
+ //HAL_SYSTICK_IRQHandler();
+ /* USER CODE BEGIN SysTick_IRQn 1 */
+
+ /* USER CODE END SysTick_IRQn 1 */
+}
+
+/******************************************************************************/
+/* STM32L4xx Peripheral Interrupt Handlers */
+/* Add here the Interrupt Handlers for the used peripherals. */
+/* For the available peripheral interrupt handler names, */
+/* please refer to the startup file (startup_stm32l4xx.s). */
+/******************************************************************************/
+
+/**
+ * @brief This function handles EXTI line1 interrupt.
+ */
+void EXTI1_IRQHandler(void)
+{
+ /* USER CODE BEGIN EXTI1_IRQn 0 */
+
+ /* USER CODE END EXTI1_IRQn 0 */
+ HAL_GPIO_EXTI_IRQHandler(GPIO_PIN_1);
+ /* USER CODE BEGIN EXTI1_IRQn 1 */
+
+ /* USER CODE END EXTI1_IRQn 1 */
+}
+
+/**
+ * @brief This function handles EXTI line2 interrupt.
+ */
+void EXTI2_IRQHandler(void)
+{
+ /* USER CODE BEGIN EXTI2_IRQn 0 */
+
+ /* USER CODE END EXTI2_IRQn 0 */
+ HAL_GPIO_EXTI_IRQHandler(GPIO_PIN_2);
+ /* USER CODE BEGIN EXTI2_IRQn 1 */
+
+ /* USER CODE END EXTI2_IRQn 1 */
+}
+
+/**
+ * @brief This function handles EXTI line3 interrupt.
+ */
+void EXTI3_IRQHandler(void)
+{
+ /* USER CODE BEGIN EXTI3_IRQn 0 */
+
+ /* USER CODE END EXTI3_IRQn 0 */
+ HAL_GPIO_EXTI_IRQHandler(GPIO_PIN_3);
+ /* USER CODE BEGIN EXTI3_IRQn 1 */
+
+ /* USER CODE END EXTI3_IRQn 1 */
+}
+
+/**
+ * @brief This function handles EXTI line4 interrupt.
+ */
+void EXTI4_IRQHandler(void)
+{
+ /* USER CODE BEGIN EXTI4_IRQn 0 */
+
+ /* USER CODE END EXTI4_IRQn 0 */
+ HAL_GPIO_EXTI_IRQHandler(GPIO_PIN_4);
+ /* USER CODE BEGIN EXTI4_IRQn 1 */
+
+ /* USER CODE END EXTI4_IRQn 1 */
+}
+
+/**
+ * @brief This function handles EXTI line[9:5] interrupts.
+ */
+void EXTI9_5_IRQHandler(void)
+{
+ /* USER CODE BEGIN EXTI9_5_IRQn 0 */
+
+ /* USER CODE END EXTI9_5_IRQn 0 */
+ HAL_GPIO_EXTI_IRQHandler(GPIO_PIN_5);
+ HAL_GPIO_EXTI_IRQHandler(GPIO_PIN_6);
+ HAL_GPIO_EXTI_IRQHandler(GPIO_PIN_7);
+ HAL_GPIO_EXTI_IRQHandler(GPIO_PIN_8);
+ HAL_GPIO_EXTI_IRQHandler(GPIO_PIN_9);
+ /* USER CODE BEGIN EXTI9_5_IRQn 1 */
+
+ /* USER CODE END EXTI9_5_IRQn 1 */
+}
+
+/**
+ * @brief This function handles EXTI line[15:10] interrupts.
+ */
+void EXTI15_10_IRQHandler(void)
+{
+ /* USER CODE BEGIN EXTI15_10_IRQn 0 */
+
+ /* USER CODE END EXTI15_10_IRQn 0 */
+ HAL_GPIO_EXTI_IRQHandler(GPIO_PIN_10);
+ HAL_GPIO_EXTI_IRQHandler(GPIO_PIN_11);
+ HAL_GPIO_EXTI_IRQHandler(GPIO_PIN_12);
+ HAL_GPIO_EXTI_IRQHandler(GPIO_PIN_13);
+ HAL_GPIO_EXTI_IRQHandler(GPIO_PIN_14);
+ HAL_GPIO_EXTI_IRQHandler(GPIO_PIN_15);
+ /* USER CODE BEGIN EXTI15_10_IRQn 1 */
+
+ /* USER CODE END EXTI15_10_IRQn 1 */
+}
+
+/**
+ * @brief This function handles USART2 global interrupt.
+ */
+void USART2_IRQHandler(void)
+{
+ /* USER CODE BEGIN USART2_IRQn 0 */
+
+ /* USER CODE END USART2_IRQn 0 */
+ HAL_UART_IRQHandler(&huart2);
+ /* USER CODE BEGIN USART2_IRQn 1 */
+
+ /* USER CODE END USART2_IRQn 1 */
+}
+
+/**
+ * @brief This function handles USART3 global interrupt.
+ */
+void USART3_IRQHandler(void)
+{
+ /* USER CODE BEGIN USART3_IRQn 0 */
+
+ /* USER CODE END USART3_IRQn 0 */
+ HAL_UART_IRQHandler(&huart3);
+ /* USER CODE BEGIN USART3_IRQn 1 */
+
+ /* USER CODE END USART3_IRQn 1 */
+}
+
+/**
+ * @brief This function handles LPUART1 global interrupt.
+ */
+void LPUART1_IRQHandler(void)
+{
+ /* USER CODE BEGIN LPUART1_IRQn 0 */
+
+ /* USER CODE END LPUART1_IRQn 0 */
+ HAL_UART_IRQHandler(&hlpuart1);
+ /* USER CODE BEGIN LPUART1_IRQn 1 */
+
+ /* USER CODE END LPUART1_IRQn 1 */
+}
+
+/* USER CODE BEGIN 1 */
+void HAL_UART_RxCpltCallback(UART_HandleTypeDef *huart)
+{
+ if (huart->Instance == LPUART1) {
+ mp_hal_uart_irq_handler(0);
+ } else if (huart->Instance == USART1) {
+ mp_hal_uart_irq_handler(1);
+ } else if (huart->Instance == USART2) {
+ mp_hal_uart_irq_handler(2);
+ } else if (huart->Instance == USART3) {
+ mp_hal_uart_irq_handler(3);
+ }
+}
+/* USER CODE END 1 */
+/************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/
diff --git a/board/BearPi_STM32L431RC/BSP/Src/usart.c b/board/BearPi_STM32L431RC/BSP/Src/usart.c
index c6353adf..794e1dcc 100644
--- a/board/BearPi_STM32L431RC/BSP/Src/usart.c
+++ b/board/BearPi_STM32L431RC/BSP/Src/usart.c
@@ -24,6 +24,7 @@
/* USER CODE BEGIN 0 */
uint8_t data;
uint8_t shell_data;
+extern void mp_hal_uart_rx_start(uint32_t uart_id);
/* USER CODE END 0 */
UART_HandleTypeDef hlpuart1;
@@ -49,10 +50,14 @@ void MX_LPUART1_UART_Init(void)
{
Error_Handler();
}
- HAL_UART_Receive_IT(&hlpuart1, &data, 1);
+#ifdef USE_MICROPYTHON
+ mp_hal_uart_rx_start(0);
+#else
+ HAL_UART_Receive_IT(&hlpuart1, &data, 1);
#if AT_INPUT_TYPE_FRAME_EN
__HAL_UART_ENABLE_IT(&hlpuart1, UART_IT_IDLE);
#endif
+#endif
}
/* USART1 init function */
@@ -73,6 +78,9 @@ void MX_USART1_UART_Init(void)
{
Error_Handler();
}
+#ifdef USE_MICROPYTHON
+ mp_hal_uart_rx_start(1);
+#endif
}
/* USART2 init function */
@@ -93,7 +101,11 @@ void MX_USART2_UART_Init(void)
{
Error_Handler();
}
+#ifdef USE_MICROPYTHON
+ mp_hal_uart_rx_start(2);
+#else
HAL_UART_Receive_IT(&huart2, &shell_data, 1);
+#endif
}
/* USART3 init function */
@@ -114,7 +126,9 @@ void MX_USART3_UART_Init(void)
{
Error_Handler();
}
-
+#ifdef USE_MICROPYTHON
+ mp_hal_uart_rx_start(3);
+#endif
}
void HAL_UART_MspInit(UART_HandleTypeDef* uartHandle)
diff --git a/board/BearPi_STM32L431RC/KEIL/fatfs_through_vfs/BearPi_STM32L31RC.uvoptx b/board/BearPi_STM32L431RC/KEIL/fatfs_through_vfs/BearPi_STM32L31RC.uvoptx
new file mode 100644
index 00000000..47b29653
--- /dev/null
+++ b/board/BearPi_STM32L431RC/KEIL/fatfs_through_vfs/BearPi_STM32L31RC.uvoptx
@@ -0,0 +1,1380 @@
+
+
+
+ 1.0
+
+ ### uVision Project, (C) Keil Software
+
+
+ *.c
+ *.s*; *.src; *.a*
+ *.obj; *.o
+ *.lib
+ *.txt; *.h; *.inc
+ *.plm
+ *.cpp
+ 0
+
+
+
+ 0
+ 0
+
+
+
+ TencentOS_tiny
+ 0x4
+ ARM-ADS
+
+ 80000000
+
+ 1
+ 1
+ 0
+ 1
+ 0
+
+
+ 1
+ 65535
+ 0
+ 0
+ 0
+
+
+ 79
+ 66
+ 8
+ .\list\
+
+
+ 1
+ 1
+ 1
+ 0
+ 1
+ 1
+ 0
+ 1
+ 0
+ 0
+ 0
+ 0
+
+
+ 1
+ 1
+ 1
+ 1
+ 1
+ 1
+ 1
+ 0
+ 0
+
+
+ 1
+ 0
+ 1
+
+ 18
+
+ 0
+ 1
+ 1
+ 1
+ 1
+ 1
+ 1
+ 1
+ 1
+ 1
+ 1
+ 1
+ 1
+ 1
+ 1
+ 1
+ 1
+ 1
+ 1
+ 0
+ 0
+ 1
+ 0
+ 0
+ 6
+
+
+
+
+
+
+
+
+
+
+ STLink\ST-LINKIII-KEIL_SWO.dll
+
+
+
+ 0
+ ARMRTXEVENTFLAGS
+ -L70 -Z18 -C0 -M0 -T1
+
+
+ 0
+ DLGTARM
+ (1010=-1,-1,-1,-1,0)(1007=-1,-1,-1,-1,0)(1008=-1,-1,-1,-1,0)(1009=-1,-1,-1,-1,0)(1012=-1,-1,-1,-1,0)
+
+
+ 0
+ ARMDBGFLAGS
+
+
+
+ 0
+ DLGUARM
+ (105=-1,-1,-1,-1,0)
+
+
+ 0
+ UL2CM3
+ UL2CM3(-S0 -C0 -P0 -FD20000000 -FC1000 -FN1 -FF0STM32L4xx_256 -FS08000000 -FL040000 -FP0($$Device:STM32L431RCTx$CMSIS\Flash\STM32L4xx_256.FLM))
+
+
+ 0
+ ST-LINKIII-KEIL_SWO
+ -U303030303030303030303031 -O10446 -SF10000 -C0 -A0 -I0 -HNlocalhost -HP7184 -P1 -N00("ARM CoreSight SW-DP (ARM Core") -D00(2BA01477) -L00(0) -TO18 -TC10000000 -TP21 -TDS8007 -TDT0 -TDC1F -TIEFFFFFFFF -TIP8 -FO15 -FD20000000 -FC1000 -FN1 -FF0STM32L4xx_256.FLM -FS08000000 -FL040000 -FP0($$Device:STM32L431RCTx$CMSIS\Flash\STM32L4xx_256.FLM)
+
+
+
+
+ 0
+ 0
+ 245
+ 1
+ 134228264
+ 0
+ 0
+ 0
+ 0
+ 0
+ 1
+ ..\..\..\..\arch\arm\arm-v7m\common\tos_cpu.c
+
+ \\TencentOS_tiny\../../../../arch/arm/arm-v7m/common/tos_cpu.c\245
+
+
+ 1
+ 0
+ 251
+ 1
+ 134228282
+ 0
+ 0
+ 0
+ 0
+ 0
+ 1
+ ..\..\..\..\arch\arm\arm-v7m\common\tos_cpu.c
+
+ \\TencentOS_tiny\../../../../arch/arm/arm-v7m/common/tos_cpu.c\251
+
+
+
+
+ 0
+ 1
+ tos_next_task
+
+
+ 1
+ 1
+ tos_rdyq.highest_prio
+
+
+ 2
+ 1
+ task_list
+
+
+ 3
+ 1
+ 0x20000280
+
+
+ 4
+ 1
+ tos_rdyq.highest_prio
+
+
+ 5
+ 1
+ owner
+
+
+ 6
+ 1
+ tos_curr_task
+
+
+ 7
+ 1
+ highest_pending_prio
+
+
+ 8
+ 1
+ task
+
+
+
+
+ 1
+ 0
+ 0x200016F4
+ 0
+
+
+
+ 0
+
+
+ 0
+ 1
+ 1
+ 0
+ 0
+ 0
+ 0
+ 1
+ 0
+ 0
+ 0
+ 0
+ 0
+ 0
+ 0
+ 0
+ 0
+ 0
+ 0
+ 0
+ 0
+ 0
+ 0
+ 0
+
+
+
+ 0
+ 0
+ 0
+
+
+
+
+
+
+
+
+
+ 1
+ 0
+ 0
+ 2
+ 10000000
+
+
+
+
+
+ Application/MDK-ARM
+ 0
+ 0
+ 0
+ 0
+
+ 1
+ 1
+ 2
+ 0
+ 0
+ 0
+ startup_stm32l431xx.s
+ startup_stm32l431xx.s
+ 0
+ 0
+
+
+
+
+ Application/User
+ 1
+ 0
+ 0
+ 0
+
+ 2
+ 2
+ 1
+ 0
+ 0
+ 0
+ ..\..\BSP\Src\gpio.c
+ gpio.c
+ 0
+ 0
+
+
+ 2
+ 3
+ 1
+ 0
+ 0
+ 0
+ ..\..\BSP\Src\main.c
+ main.c
+ 0
+ 0
+
+
+ 2
+ 4
+ 1
+ 0
+ 0
+ 0
+ ..\..\BSP\Src\mcu_init.c
+ mcu_init.c
+ 0
+ 0
+
+
+ 2
+ 5
+ 1
+ 0
+ 0
+ 0
+ ..\..\BSP\Src\stm32l4xx_hal_msp.c
+ stm32l4xx_hal_msp.c
+ 0
+ 0
+
+
+ 2
+ 6
+ 1
+ 0
+ 0
+ 0
+ ..\..\BSP\Src\stm32l4xx_it.c
+ stm32l4xx_it.c
+ 0
+ 0
+
+
+ 2
+ 7
+ 1
+ 0
+ 0
+ 0
+ ..\..\BSP\Src\usart.c
+ usart.c
+ 0
+ 0
+
+
+ 2
+ 8
+ 1
+ 0
+ 0
+ 0
+ ..\..\BSP\Src\adc.c
+ adc.c
+ 0
+ 0
+
+
+ 2
+ 9
+ 1
+ 0
+ 0
+ 0
+ ..\..\BSP\Src\i2c.c
+ i2c.c
+ 0
+ 0
+
+
+ 2
+ 10
+ 1
+ 0
+ 0
+ 0
+ ..\..\BSP\Src\spi.c
+ spi.c
+ 0
+ 0
+
+
+ 2
+ 11
+ 1
+ 0
+ 0
+ 0
+ ..\..\BSP\Src\sdmmc.c
+ sdmmc.c
+ 0
+ 0
+
+
+
+
+ examples
+ 0
+ 0
+ 0
+ 0
+
+ 3
+ 12
+ 1
+ 0
+ 0
+ 0
+ ..\..\..\..\examples\fatfs_through_vfs\fatfs_through_vfs_sample.c
+ fatfs_through_vfs_sample.c
+ 0
+ 0
+
+
+
+
+ Drivers/STM32L4xx_HAL_Driver
+ 0
+ 0
+ 0
+ 0
+
+ 4
+ 13
+ 1
+ 0
+ 0
+ 0
+ ..\..\..\..\platform\vendor_bsp\st\STM32L4xx_HAL_Driver\Src\stm32l4xx_hal_tim.c
+ stm32l4xx_hal_tim.c
+ 0
+ 0
+
+
+ 4
+ 14
+ 1
+ 0
+ 0
+ 0
+ ..\..\..\..\platform\vendor_bsp\st\STM32L4xx_HAL_Driver\Src\stm32l4xx_hal_tim_ex.c
+ stm32l4xx_hal_tim_ex.c
+ 0
+ 0
+
+
+ 4
+ 15
+ 1
+ 0
+ 0
+ 0
+ ..\..\..\..\platform\vendor_bsp\st\STM32L4xx_HAL_Driver\Src\stm32l4xx_hal_uart.c
+ stm32l4xx_hal_uart.c
+ 0
+ 0
+
+
+ 4
+ 16
+ 1
+ 0
+ 0
+ 0
+ ..\..\..\..\platform\vendor_bsp\st\STM32L4xx_HAL_Driver\Src\stm32l4xx_hal_uart_ex.c
+ stm32l4xx_hal_uart_ex.c
+ 0
+ 0
+
+
+ 4
+ 17
+ 1
+ 0
+ 0
+ 0
+ ..\..\..\..\platform\vendor_bsp\st\STM32L4xx_HAL_Driver\Src\stm32l4xx_hal.c
+ stm32l4xx_hal.c
+ 0
+ 0
+
+
+ 4
+ 18
+ 1
+ 0
+ 0
+ 0
+ ..\..\..\..\platform\vendor_bsp\st\STM32L4xx_HAL_Driver\Src\stm32l4xx_hal_i2c.c
+ stm32l4xx_hal_i2c.c
+ 0
+ 0
+
+
+ 4
+ 19
+ 1
+ 0
+ 0
+ 0
+ ..\..\..\..\platform\vendor_bsp\st\STM32L4xx_HAL_Driver\Src\stm32l4xx_hal_i2c_ex.c
+ stm32l4xx_hal_i2c_ex.c
+ 0
+ 0
+
+
+ 4
+ 20
+ 1
+ 0
+ 0
+ 0
+ ..\..\..\..\platform\vendor_bsp\st\STM32L4xx_HAL_Driver\Src\stm32l4xx_hal_rcc.c
+ stm32l4xx_hal_rcc.c
+ 0
+ 0
+
+
+ 4
+ 21
+ 1
+ 0
+ 0
+ 0
+ ..\..\..\..\platform\vendor_bsp\st\STM32L4xx_HAL_Driver\Src\stm32l4xx_hal_rcc_ex.c
+ stm32l4xx_hal_rcc_ex.c
+ 0
+ 0
+
+
+ 4
+ 22
+ 1
+ 0
+ 0
+ 0
+ ..\..\..\..\platform\vendor_bsp\st\STM32L4xx_HAL_Driver\Src\stm32l4xx_hal_flash.c
+ stm32l4xx_hal_flash.c
+ 0
+ 0
+
+
+ 4
+ 23
+ 1
+ 0
+ 0
+ 0
+ ..\..\..\..\platform\vendor_bsp\st\STM32L4xx_HAL_Driver\Src\stm32l4xx_hal_flash_ex.c
+ stm32l4xx_hal_flash_ex.c
+ 0
+ 0
+
+
+ 4
+ 24
+ 1
+ 0
+ 0
+ 0
+ ..\..\..\..\platform\vendor_bsp\st\STM32L4xx_HAL_Driver\Src\stm32l4xx_hal_flash_ramfunc.c
+ stm32l4xx_hal_flash_ramfunc.c
+ 0
+ 0
+
+
+ 4
+ 25
+ 1
+ 0
+ 0
+ 0
+ ..\..\..\..\platform\vendor_bsp\st\STM32L4xx_HAL_Driver\Src\stm32l4xx_hal_gpio.c
+ stm32l4xx_hal_gpio.c
+ 0
+ 0
+
+
+ 4
+ 26
+ 1
+ 0
+ 0
+ 0
+ ..\..\..\..\platform\vendor_bsp\st\STM32L4xx_HAL_Driver\Src\stm32l4xx_hal_dma.c
+ stm32l4xx_hal_dma.c
+ 0
+ 0
+
+
+ 4
+ 27
+ 1
+ 0
+ 0
+ 0
+ ..\..\..\..\platform\vendor_bsp\st\STM32L4xx_HAL_Driver\Src\stm32l4xx_hal_dma_ex.c
+ stm32l4xx_hal_dma_ex.c
+ 0
+ 0
+
+
+ 4
+ 28
+ 1
+ 0
+ 0
+ 0
+ ..\..\..\..\platform\vendor_bsp\st\STM32L4xx_HAL_Driver\Src\stm32l4xx_hal_pwr.c
+ stm32l4xx_hal_pwr.c
+ 0
+ 0
+
+
+ 4
+ 29
+ 1
+ 0
+ 0
+ 0
+ ..\..\..\..\platform\vendor_bsp\st\STM32L4xx_HAL_Driver\Src\stm32l4xx_hal_pwr_ex.c
+ stm32l4xx_hal_pwr_ex.c
+ 0
+ 0
+
+
+ 4
+ 30
+ 1
+ 0
+ 0
+ 0
+ ..\..\..\..\platform\vendor_bsp\st\STM32L4xx_HAL_Driver\Src\stm32l4xx_hal_cortex.c
+ stm32l4xx_hal_cortex.c
+ 0
+ 0
+
+
+ 4
+ 31
+ 1
+ 0
+ 0
+ 0
+ ..\..\..\..\platform\vendor_bsp\st\STM32L4xx_HAL_Driver\Src\stm32l4xx_hal_adc_ex.c
+ stm32l4xx_hal_adc_ex.c
+ 0
+ 0
+
+
+ 4
+ 32
+ 1
+ 0
+ 0
+ 0
+ ..\..\..\..\platform\vendor_bsp\st\STM32L4xx_HAL_Driver\Src\stm32l4xx_hal_adc.c
+ stm32l4xx_hal_adc.c
+ 0
+ 0
+
+
+ 4
+ 33
+ 1
+ 0
+ 0
+ 0
+ ..\..\..\..\platform\vendor_bsp\st\STM32L4xx_HAL_Driver\Src\stm32l4xx_hal_dac.c
+ stm32l4xx_hal_dac.c
+ 0
+ 0
+
+
+ 4
+ 34
+ 1
+ 0
+ 0
+ 0
+ ..\..\..\..\platform\vendor_bsp\st\STM32L4xx_HAL_Driver\Src\stm32l4xx_hal_dac_ex.c
+ stm32l4xx_hal_dac_ex.c
+ 0
+ 0
+
+
+ 4
+ 35
+ 1
+ 0
+ 0
+ 0
+ ..\..\..\..\platform\vendor_bsp\st\STM32L4xx_HAL_Driver\Src\stm32l4xx_hal_spi.c
+ stm32l4xx_hal_spi.c
+ 0
+ 0
+
+
+ 4
+ 36
+ 1
+ 0
+ 0
+ 0
+ ..\..\..\..\platform\vendor_bsp\st\STM32L4xx_HAL_Driver\Src\stm32l4xx_hal_spi_ex.c
+ stm32l4xx_hal_spi_ex.c
+ 0
+ 0
+
+
+ 4
+ 37
+ 1
+ 0
+ 0
+ 0
+ ..\..\..\..\platform\vendor_bsp\st\STM32L4xx_HAL_Driver\Src\stm32l4xx_hal_sd.c
+ stm32l4xx_hal_sd.c
+ 0
+ 0
+
+
+ 4
+ 38
+ 1
+ 0
+ 0
+ 0
+ ..\..\..\..\platform\vendor_bsp\st\STM32L4xx_HAL_Driver\Src\stm32l4xx_hal_sd_ex.c
+ stm32l4xx_hal_sd_ex.c
+ 0
+ 0
+
+
+ 4
+ 39
+ 1
+ 0
+ 0
+ 0
+ ..\..\..\..\platform\vendor_bsp\st\STM32L4xx_HAL_Driver\Src\stm32l4xx_ll_sdmmc.c
+ stm32l4xx_ll_sdmmc.c
+ 0
+ 0
+
+
+
+
+ Drivers/CMSIS
+ 0
+ 0
+ 0
+ 0
+
+ 5
+ 40
+ 1
+ 0
+ 0
+ 0
+ ..\..\BSP\Src\system_stm32l4xx.c
+ system_stm32l4xx.c
+ 0
+ 0
+
+
+
+
+ Hardware
+ 0
+ 0
+ 0
+ 0
+
+ 6
+ 41
+ 1
+ 0
+ 0
+ 0
+ ..\..\BSP\Hardware\BH1750\BH1750.c
+ BH1750.c
+ 0
+ 0
+
+
+ 6
+ 42
+ 1
+ 0
+ 0
+ 0
+ ..\..\BSP\Hardware\LCD_ST7789\lcd_spi2_drv.c
+ lcd_spi2_drv.c
+ 0
+ 0
+
+
+
+
+ kernel
+ 0
+ 0
+ 0
+ 0
+
+ 7
+ 43
+ 1
+ 0
+ 0
+ 0
+ ..\..\..\..\kernel\core\tos_mmblk.c
+ tos_mmblk.c
+ 0
+ 0
+
+
+ 7
+ 44
+ 1
+ 0
+ 0
+ 0
+ ..\..\..\..\kernel\core\tos_mmheap.c
+ tos_mmheap.c
+ 0
+ 0
+
+
+ 7
+ 45
+ 1
+ 0
+ 0
+ 0
+ ..\..\..\..\kernel\core\tos_mutex.c
+ tos_mutex.c
+ 0
+ 0
+
+
+ 7
+ 46
+ 1
+ 0
+ 0
+ 0
+ ..\..\..\..\kernel\core\tos_sched.c
+ tos_sched.c
+ 0
+ 0
+
+
+ 7
+ 47
+ 1
+ 0
+ 0
+ 0
+ ..\..\..\..\kernel\core\tos_sem.c
+ tos_sem.c
+ 0
+ 0
+
+
+ 7
+ 48
+ 1
+ 0
+ 0
+ 0
+ ..\..\..\..\kernel\core\tos_sys.c
+ tos_sys.c
+ 0
+ 0
+
+
+ 7
+ 49
+ 1
+ 0
+ 0
+ 0
+ ..\..\..\..\kernel\core\tos_task.c
+ tos_task.c
+ 0
+ 0
+
+
+ 7
+ 50
+ 1
+ 0
+ 0
+ 0
+ ..\..\..\..\kernel\core\tos_tick.c
+ tos_tick.c
+ 0
+ 0
+
+
+ 7
+ 51
+ 1
+ 0
+ 0
+ 0
+ ..\..\..\..\kernel\core\tos_time.c
+ tos_time.c
+ 0
+ 0
+
+
+ 7
+ 52
+ 1
+ 0
+ 0
+ 0
+ ..\..\..\..\kernel\core\tos_timer.c
+ tos_timer.c
+ 0
+ 0
+
+
+ 7
+ 53
+ 1
+ 0
+ 0
+ 0
+ ..\..\..\..\kernel\core\tos_event.c
+ tos_event.c
+ 0
+ 0
+
+
+ 7
+ 54
+ 1
+ 0
+ 0
+ 0
+ ..\..\..\..\kernel\core\tos_global.c
+ tos_global.c
+ 0
+ 0
+
+
+ 7
+ 55
+ 1
+ 0
+ 0
+ 0
+ ..\..\..\..\kernel\core\tos_pend.c
+ tos_pend.c
+ 0
+ 0
+
+
+ 7
+ 56
+ 1
+ 0
+ 0
+ 0
+ ..\..\..\..\kernel\core\tos_robin.c
+ tos_robin.c
+ 0
+ 0
+
+
+ 7
+ 57
+ 1
+ 0
+ 0
+ 0
+ ..\..\..\..\kernel\core\tos_binary_heap.c
+ tos_binary_heap.c
+ 0
+ 0
+
+
+ 7
+ 58
+ 1
+ 0
+ 0
+ 0
+ ..\..\..\..\kernel\core\tos_char_fifo.c
+ tos_char_fifo.c
+ 0
+ 0
+
+
+ 7
+ 59
+ 1
+ 0
+ 0
+ 0
+ ..\..\..\..\kernel\core\tos_completion.c
+ tos_completion.c
+ 0
+ 0
+
+
+ 7
+ 60
+ 1
+ 0
+ 0
+ 0
+ ..\..\..\..\kernel\core\tos_countdownlatch.c
+ tos_countdownlatch.c
+ 0
+ 0
+
+
+ 7
+ 61
+ 1
+ 0
+ 0
+ 0
+ ..\..\..\..\kernel\core\tos_mail_queue.c
+ tos_mail_queue.c
+ 0
+ 0
+
+
+ 7
+ 62
+ 1
+ 0
+ 0
+ 0
+ ..\..\..\..\kernel\core\tos_message_queue.c
+ tos_message_queue.c
+ 0
+ 0
+
+
+ 7
+ 63
+ 1
+ 0
+ 0
+ 0
+ ..\..\..\..\kernel\core\tos_priority_mail_queue.c
+ tos_priority_mail_queue.c
+ 0
+ 0
+
+
+ 7
+ 64
+ 1
+ 0
+ 0
+ 0
+ ..\..\..\..\kernel\core\tos_priority_message_queue.c
+ tos_priority_message_queue.c
+ 0
+ 0
+
+
+ 7
+ 65
+ 1
+ 0
+ 0
+ 0
+ ..\..\..\..\kernel\core\tos_priority_queue.c
+ tos_priority_queue.c
+ 0
+ 0
+
+
+ 7
+ 66
+ 1
+ 0
+ 0
+ 0
+ ..\..\..\..\kernel\core\tos_ring_queue.c
+ tos_ring_queue.c
+ 0
+ 0
+
+
+
+
+ cpu
+ 0
+ 0
+ 0
+ 0
+
+ 8
+ 67
+ 2
+ 0
+ 0
+ 0
+ ..\..\..\..\arch\arm\arm-v7m\cortex-m4\armcc\port_s.S
+ port_s.S
+ 0
+ 0
+
+
+ 8
+ 68
+ 1
+ 0
+ 0
+ 0
+ ..\..\..\..\arch\arm\arm-v7m\common\tos_cpu.c
+ tos_cpu.c
+ 0
+ 0
+
+
+ 8
+ 69
+ 1
+ 0
+ 0
+ 0
+ ..\..\..\..\arch\arm\arm-v7m\cortex-m4\armcc\port_c.c
+ port_c.c
+ 0
+ 0
+
+
+
+
+ config
+ 0
+ 0
+ 0
+ 0
+
+ 9
+ 70
+ 5
+ 0
+ 0
+ 0
+ ..\..\TOS-CONFIG\tos_config.h
+ tos_config.h
+ 0
+ 0
+
+
+
+
+ fatfs
+ 0
+ 0
+ 0
+ 0
+
+ 10
+ 71
+ 1
+ 0
+ 0
+ 0
+ ..\..\..\..\components\fs\fatfs\wrapper\tos_diskio.c
+ tos_diskio.c
+ 0
+ 0
+
+
+ 10
+ 72
+ 1
+ 0
+ 0
+ 0
+ ..\..\..\..\components\fs\fatfs\wrapper\tos_fatfs_drv.c
+ tos_fatfs_drv.c
+ 0
+ 0
+
+
+ 10
+ 73
+ 1
+ 0
+ 0
+ 0
+ ..\..\..\..\components\fs\fatfs\wrapper\tos_fatfs_vfs.c
+ tos_fatfs_vfs.c
+ 0
+ 0
+
+
+ 10
+ 74
+ 1
+ 0
+ 0
+ 0
+ ..\..\..\..\components\fs\fatfs\wrapper\tos_ff.c
+ tos_ff.c
+ 0
+ 0
+
+
+ 10
+ 75
+ 1
+ 0
+ 0
+ 0
+ ..\..\..\..\components\fs\fatfs\wrapper\tos_ffsystem.c
+ tos_ffsystem.c
+ 0
+ 0
+
+
+ 10
+ 76
+ 1
+ 0
+ 0
+ 0
+ ..\..\..\..\components\fs\fatfs\wrapper\tos_ffunicode.c
+ tos_ffunicode.c
+ 0
+ 0
+
+
+
+
+ vfs
+ 0
+ 0
+ 0
+ 0
+
+ 11
+ 77
+ 1
+ 0
+ 0
+ 0
+ ..\..\..\..\components\fs\vfs\tos_vfs.c
+ tos_vfs.c
+ 0
+ 0
+
+
+ 11
+ 78
+ 1
+ 0
+ 0
+ 0
+ ..\..\..\..\components\fs\vfs\tos_vfs_device.c
+ tos_vfs_device.c
+ 0
+ 0
+
+
+ 11
+ 79
+ 1
+ 0
+ 0
+ 0
+ ..\..\..\..\components\fs\vfs\tos_vfs_file.c
+ tos_vfs_file.c
+ 0
+ 0
+
+
+ 11
+ 80
+ 1
+ 0
+ 0
+ 0
+ ..\..\..\..\components\fs\vfs\tos_vfs_fs.c
+ tos_vfs_fs.c
+ 0
+ 0
+
+
+ 11
+ 81
+ 1
+ 0
+ 0
+ 0
+ ..\..\..\..\components\fs\vfs\tos_vfs_inode.c
+ tos_vfs_inode.c
+ 0
+ 0
+
+
+
+
+ hal
+ 0
+ 0
+ 0
+ 0
+
+ 12
+ 82
+ 1
+ 0
+ 0
+ 0
+ ..\..\..\..\platform\hal\st\stm32l4xx\src\tos_hal_sd.c
+ tos_hal_sd.c
+ 0
+ 0
+
+
+
+
+ ::CMSIS
+ 0
+ 0
+ 0
+ 1
+
+
+
diff --git a/board/BearPi_STM32L431RC/KEIL/fatfs_through_vfs/BearPi_STM32L31RC.uvprojx b/board/BearPi_STM32L431RC/KEIL/fatfs_through_vfs/BearPi_STM32L31RC.uvprojx
new file mode 100644
index 00000000..963c969d
--- /dev/null
+++ b/board/BearPi_STM32L431RC/KEIL/fatfs_through_vfs/BearPi_STM32L31RC.uvprojx
@@ -0,0 +1,872 @@
+
+
+
+ 2.1
+
+ ### uVision Project, (C) Keil Software
+
+
+
+ TencentOS_tiny
+ 0x4
+ ARM-ADS
+ 5060750::V5.06 update 6 (build 750)::ARMCC
+ 0
+
+
+ STM32L431RCTx
+ STMicroelectronics
+ Keil.STM32L4xx_DFP.2.2.0
+ http://www.keil.com/pack
+ IRAM(0x20000000-0x2000FFFF) IROM(0x8000000-0x803FFFF) CLOCK(8000000) FPU2 CPUTYPE("Cortex-M4")
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ $$Device:STM32L431RCTx$CMSIS\SVD\STM32L4x1.svd
+ 0
+ 0
+
+
+
+
+
+
+ 0
+ 0
+ 0
+ 0
+ 1
+
+ .\obj\
+ TencentOS_tiny
+ 1
+ 0
+ 1
+ 1
+ 0
+ .\list\
+ 1
+ 0
+ 0
+
+ 0
+ 0
+
+
+ 0
+ 0
+ 0
+ 0
+
+
+ 0
+ 0
+
+
+ 0
+ 0
+ 0
+ 0
+
+
+ 0
+ 0
+
+
+ 0
+ 0
+ 0
+ 0
+
+ 0
+
+
+
+ 0
+ 0
+ 0
+ 0
+ 0
+ 1
+ 0
+ 0
+ 0
+ 0
+ 3
+
+
+ 0
+
+
+ SARMCM3.DLL
+ -REMAP -MPU
+ DCM.DLL
+ -pCM4
+ SARMCM3.DLL
+ -MPU
+ TCM.DLL
+ -pCM4
+
+
+
+ 1
+ 0
+ 0
+ 0
+ 16
+
+
+
+
+ 1
+ 0
+ 0
+ 1
+ 1
+ 4107
+
+ 1
+ BIN\UL2CM3.DLL
+
+
+
+
+
+ 0
+
+
+
+ 0
+ 1
+ 1
+ 1
+ 1
+ 1
+ 1
+ 1
+ 0
+ 1
+ 1
+ 0
+ 1
+ 1
+ 0
+ 0
+ 1
+ 1
+ 1
+ 1
+ 1
+ 1
+ 1
+ 1
+ 1
+ 0
+ 0
+ "Cortex-M4"
+
+ 0
+ 0
+ 0
+ 1
+ 1
+ 0
+ 0
+ 2
+ 0
+ 0
+ 0
+ 8
+ 1
+ 0
+ 0
+ 0
+ 3
+ 3
+ 0
+ 0
+ 0
+ 0
+ 0
+ 0
+ 0
+ 0
+ 0
+ 0
+ 1
+ 0
+ 0
+ 0
+ 0
+ 1
+ 0
+
+
+ 0
+ 0x0
+ 0x0
+
+
+ 0
+ 0x0
+ 0x0
+
+
+ 0
+ 0x0
+ 0x0
+
+
+ 0
+ 0x0
+ 0x0
+
+
+ 0
+ 0x0
+ 0x0
+
+
+ 0
+ 0x0
+ 0x0
+
+
+ 0
+ 0x20000000
+ 0x10000
+
+
+ 1
+ 0x8000000
+ 0x40000
+
+
+ 0
+ 0x0
+ 0x0
+
+
+ 1
+ 0x0
+ 0x0
+
+
+ 1
+ 0x0
+ 0x0
+
+
+ 1
+ 0x0
+ 0x0
+
+
+ 1
+ 0x8000000
+ 0x40000
+
+
+ 1
+ 0x0
+ 0x0
+
+
+ 0
+ 0x0
+ 0x0
+
+
+ 0
+ 0x0
+ 0x0
+
+
+ 0
+ 0x0
+ 0x0
+
+
+ 0
+ 0x20000000
+ 0x10000
+
+
+ 0
+ 0x0
+ 0x0
+
+
+
+
+
+ 1
+ 1
+ 0
+ 0
+ 1
+ 0
+ 0
+ 0
+ 0
+ 0
+ 2
+ 0
+ 0
+ 1
+ 0
+ 0
+ 1
+ 1
+ 1
+ 1
+ 0
+ 0
+ 0
+
+
+ USE_HAL_DRIVER,STM32L431xx,WITH_TOS_NET_ADAPTER,USE_ESP8266
+
+ ..\..\BSP\Inc;..\..\..\..\platform\vendor_bsp\st\STM32L4xx_HAL_Driver\Inc;..\..\..\..\platform\vendor_bsp\st\STM32L4xx_HAL_Driver\Legacy;..\..\..\..\platform\vendor_bsp\st\CMSIS\Device\ST\STM32L4xx\Include;..\..\..\..\platform\vendor_bsp\st\CMSIS\Include;..\..\..\..\kernel\core\include;..\..\TOS-CONFIG;..\..\..\..\platform\arch\arm\cortex-m4\keil;..\..\..\..\kernel\pm\include;..\..\..\..\osal\cmsis_os;..\..\..\..\arch\arm\arm-v7m\common\include;..\..\..\..\arch\arm\arm-v7m\cortex-m4\armcc;..\..\..\..\net\at\include;..\..\..\..\kernel\hal\include;..\..\BSP\Hardware\LCD_ST7789;..\..\BSP\Hardware\BH1750;..\..\..\..\examples\fatfs_through_vfs;..\..\..\..\components\fs\vfs\include;..\..\..\..\components\fs\fatfs\wrapper\include;..\..\..\..\components\fs\fatfs\3rdparty
+
+
+
+ 1
+ 0
+ 0
+ 0
+ 0
+ 0
+ 0
+ 0
+ 0
+ 0
+
+
+
+
+
+
+
+
+ 1
+ 0
+ 0
+ 0
+ 1
+ 0
+ 0x08000000
+ 0x20000000
+
+
+
+
+
+
+
+
+
+
+
+
+ Application/MDK-ARM
+
+
+ startup_stm32l431xx.s
+ 2
+ startup_stm32l431xx.s
+
+
+
+
+ Application/User
+
+
+ gpio.c
+ 1
+ ..\..\BSP\Src\gpio.c
+
+
+ main.c
+ 1
+ ..\..\BSP\Src\main.c
+
+
+ mcu_init.c
+ 1
+ ..\..\BSP\Src\mcu_init.c
+
+
+ stm32l4xx_hal_msp.c
+ 1
+ ..\..\BSP\Src\stm32l4xx_hal_msp.c
+
+
+ stm32l4xx_it.c
+ 1
+ ..\..\BSP\Src\stm32l4xx_it.c
+
+
+ usart.c
+ 1
+ ..\..\BSP\Src\usart.c
+
+
+ adc.c
+ 1
+ ..\..\BSP\Src\adc.c
+
+
+ i2c.c
+ 1
+ ..\..\BSP\Src\i2c.c
+
+
+ spi.c
+ 1
+ ..\..\BSP\Src\spi.c
+
+
+ sdmmc.c
+ 1
+ ..\..\BSP\Src\sdmmc.c
+
+
+
+
+ examples
+
+
+ fatfs_through_vfs_sample.c
+ 1
+ ..\..\..\..\examples\fatfs_through_vfs\fatfs_through_vfs_sample.c
+
+
+
+
+ Drivers/STM32L4xx_HAL_Driver
+
+
+ stm32l4xx_hal_tim.c
+ 1
+ ..\..\..\..\platform\vendor_bsp\st\STM32L4xx_HAL_Driver\Src\stm32l4xx_hal_tim.c
+
+
+ stm32l4xx_hal_tim_ex.c
+ 1
+ ..\..\..\..\platform\vendor_bsp\st\STM32L4xx_HAL_Driver\Src\stm32l4xx_hal_tim_ex.c
+
+
+ stm32l4xx_hal_uart.c
+ 1
+ ..\..\..\..\platform\vendor_bsp\st\STM32L4xx_HAL_Driver\Src\stm32l4xx_hal_uart.c
+
+
+ stm32l4xx_hal_uart_ex.c
+ 1
+ ..\..\..\..\platform\vendor_bsp\st\STM32L4xx_HAL_Driver\Src\stm32l4xx_hal_uart_ex.c
+
+
+ stm32l4xx_hal.c
+ 1
+ ..\..\..\..\platform\vendor_bsp\st\STM32L4xx_HAL_Driver\Src\stm32l4xx_hal.c
+
+
+ stm32l4xx_hal_i2c.c
+ 1
+ ..\..\..\..\platform\vendor_bsp\st\STM32L4xx_HAL_Driver\Src\stm32l4xx_hal_i2c.c
+
+
+ stm32l4xx_hal_i2c_ex.c
+ 1
+ ..\..\..\..\platform\vendor_bsp\st\STM32L4xx_HAL_Driver\Src\stm32l4xx_hal_i2c_ex.c
+
+
+ stm32l4xx_hal_rcc.c
+ 1
+ ..\..\..\..\platform\vendor_bsp\st\STM32L4xx_HAL_Driver\Src\stm32l4xx_hal_rcc.c
+
+
+ stm32l4xx_hal_rcc_ex.c
+ 1
+ ..\..\..\..\platform\vendor_bsp\st\STM32L4xx_HAL_Driver\Src\stm32l4xx_hal_rcc_ex.c
+
+
+ stm32l4xx_hal_flash.c
+ 1
+ ..\..\..\..\platform\vendor_bsp\st\STM32L4xx_HAL_Driver\Src\stm32l4xx_hal_flash.c
+
+
+ stm32l4xx_hal_flash_ex.c
+ 1
+ ..\..\..\..\platform\vendor_bsp\st\STM32L4xx_HAL_Driver\Src\stm32l4xx_hal_flash_ex.c
+
+
+ stm32l4xx_hal_flash_ramfunc.c
+ 1
+ ..\..\..\..\platform\vendor_bsp\st\STM32L4xx_HAL_Driver\Src\stm32l4xx_hal_flash_ramfunc.c
+
+
+ stm32l4xx_hal_gpio.c
+ 1
+ ..\..\..\..\platform\vendor_bsp\st\STM32L4xx_HAL_Driver\Src\stm32l4xx_hal_gpio.c
+
+
+ stm32l4xx_hal_dma.c
+ 1
+ ..\..\..\..\platform\vendor_bsp\st\STM32L4xx_HAL_Driver\Src\stm32l4xx_hal_dma.c
+
+
+ stm32l4xx_hal_dma_ex.c
+ 1
+ ..\..\..\..\platform\vendor_bsp\st\STM32L4xx_HAL_Driver\Src\stm32l4xx_hal_dma_ex.c
+
+
+ stm32l4xx_hal_pwr.c
+ 1
+ ..\..\..\..\platform\vendor_bsp\st\STM32L4xx_HAL_Driver\Src\stm32l4xx_hal_pwr.c
+
+
+ stm32l4xx_hal_pwr_ex.c
+ 1
+ ..\..\..\..\platform\vendor_bsp\st\STM32L4xx_HAL_Driver\Src\stm32l4xx_hal_pwr_ex.c
+
+
+ stm32l4xx_hal_cortex.c
+ 1
+ ..\..\..\..\platform\vendor_bsp\st\STM32L4xx_HAL_Driver\Src\stm32l4xx_hal_cortex.c
+
+
+ stm32l4xx_hal_adc_ex.c
+ 1
+ ..\..\..\..\platform\vendor_bsp\st\STM32L4xx_HAL_Driver\Src\stm32l4xx_hal_adc_ex.c
+
+
+ stm32l4xx_hal_adc.c
+ 1
+ ..\..\..\..\platform\vendor_bsp\st\STM32L4xx_HAL_Driver\Src\stm32l4xx_hal_adc.c
+
+
+ stm32l4xx_hal_dac.c
+ 1
+ ..\..\..\..\platform\vendor_bsp\st\STM32L4xx_HAL_Driver\Src\stm32l4xx_hal_dac.c
+
+
+ stm32l4xx_hal_dac_ex.c
+ 1
+ ..\..\..\..\platform\vendor_bsp\st\STM32L4xx_HAL_Driver\Src\stm32l4xx_hal_dac_ex.c
+
+
+ stm32l4xx_hal_spi.c
+ 1
+ ..\..\..\..\platform\vendor_bsp\st\STM32L4xx_HAL_Driver\Src\stm32l4xx_hal_spi.c
+
+
+ stm32l4xx_hal_spi_ex.c
+ 1
+ ..\..\..\..\platform\vendor_bsp\st\STM32L4xx_HAL_Driver\Src\stm32l4xx_hal_spi_ex.c
+
+
+ stm32l4xx_hal_sd.c
+ 1
+ ..\..\..\..\platform\vendor_bsp\st\STM32L4xx_HAL_Driver\Src\stm32l4xx_hal_sd.c
+
+
+ stm32l4xx_hal_sd_ex.c
+ 1
+ ..\..\..\..\platform\vendor_bsp\st\STM32L4xx_HAL_Driver\Src\stm32l4xx_hal_sd_ex.c
+
+
+ stm32l4xx_ll_sdmmc.c
+ 1
+ ..\..\..\..\platform\vendor_bsp\st\STM32L4xx_HAL_Driver\Src\stm32l4xx_ll_sdmmc.c
+
+
+
+
+ Drivers/CMSIS
+
+
+ system_stm32l4xx.c
+ 1
+ ..\..\BSP\Src\system_stm32l4xx.c
+
+
+
+
+ Hardware
+
+
+ BH1750.c
+ 1
+ ..\..\BSP\Hardware\BH1750\BH1750.c
+
+
+ lcd_spi2_drv.c
+ 1
+ ..\..\BSP\Hardware\LCD_ST7789\lcd_spi2_drv.c
+
+
+
+
+ kernel
+
+
+ tos_mmblk.c
+ 1
+ ..\..\..\..\kernel\core\tos_mmblk.c
+
+
+ tos_mmheap.c
+ 1
+ ..\..\..\..\kernel\core\tos_mmheap.c
+
+
+ tos_mutex.c
+ 1
+ ..\..\..\..\kernel\core\tos_mutex.c
+
+
+ tos_sched.c
+ 1
+ ..\..\..\..\kernel\core\tos_sched.c
+
+
+ tos_sem.c
+ 1
+ ..\..\..\..\kernel\core\tos_sem.c
+
+
+ tos_sys.c
+ 1
+ ..\..\..\..\kernel\core\tos_sys.c
+
+
+ tos_task.c
+ 1
+ ..\..\..\..\kernel\core\tos_task.c
+
+
+ tos_tick.c
+ 1
+ ..\..\..\..\kernel\core\tos_tick.c
+
+
+ tos_time.c
+ 1
+ ..\..\..\..\kernel\core\tos_time.c
+
+
+ tos_timer.c
+ 1
+ ..\..\..\..\kernel\core\tos_timer.c
+
+
+ tos_event.c
+ 1
+ ..\..\..\..\kernel\core\tos_event.c
+
+
+ tos_global.c
+ 1
+ ..\..\..\..\kernel\core\tos_global.c
+
+
+ tos_pend.c
+ 1
+ ..\..\..\..\kernel\core\tos_pend.c
+
+
+ tos_robin.c
+ 1
+ ..\..\..\..\kernel\core\tos_robin.c
+
+
+ tos_binary_heap.c
+ 1
+ ..\..\..\..\kernel\core\tos_binary_heap.c
+
+
+ tos_char_fifo.c
+ 1
+ ..\..\..\..\kernel\core\tos_char_fifo.c
+
+
+ tos_completion.c
+ 1
+ ..\..\..\..\kernel\core\tos_completion.c
+
+
+ tos_countdownlatch.c
+ 1
+ ..\..\..\..\kernel\core\tos_countdownlatch.c
+
+
+ tos_mail_queue.c
+ 1
+ ..\..\..\..\kernel\core\tos_mail_queue.c
+
+
+ tos_message_queue.c
+ 1
+ ..\..\..\..\kernel\core\tos_message_queue.c
+
+
+ tos_priority_mail_queue.c
+ 1
+ ..\..\..\..\kernel\core\tos_priority_mail_queue.c
+
+
+ tos_priority_message_queue.c
+ 1
+ ..\..\..\..\kernel\core\tos_priority_message_queue.c
+
+
+ tos_priority_queue.c
+ 1
+ ..\..\..\..\kernel\core\tos_priority_queue.c
+
+
+ tos_ring_queue.c
+ 1
+ ..\..\..\..\kernel\core\tos_ring_queue.c
+
+
+
+
+ cpu
+
+
+ port_s.S
+ 2
+ ..\..\..\..\arch\arm\arm-v7m\cortex-m4\armcc\port_s.S
+
+
+ tos_cpu.c
+ 1
+ ..\..\..\..\arch\arm\arm-v7m\common\tos_cpu.c
+
+
+ port_c.c
+ 1
+ ..\..\..\..\arch\arm\arm-v7m\cortex-m4\armcc\port_c.c
+
+
+
+
+ config
+
+
+ tos_config.h
+ 5
+ ..\..\TOS-CONFIG\tos_config.h
+
+
+
+
+ fatfs
+
+
+ tos_diskio.c
+ 1
+ ..\..\..\..\components\fs\fatfs\wrapper\tos_diskio.c
+
+
+ tos_fatfs_drv.c
+ 1
+ ..\..\..\..\components\fs\fatfs\wrapper\tos_fatfs_drv.c
+
+
+ tos_fatfs_vfs.c
+ 1
+ ..\..\..\..\components\fs\fatfs\wrapper\tos_fatfs_vfs.c
+
+
+ tos_ff.c
+ 1
+ ..\..\..\..\components\fs\fatfs\wrapper\tos_ff.c
+
+
+ tos_ffsystem.c
+ 1
+ ..\..\..\..\components\fs\fatfs\wrapper\tos_ffsystem.c
+
+
+ tos_ffunicode.c
+ 1
+ ..\..\..\..\components\fs\fatfs\wrapper\tos_ffunicode.c
+
+
+
+
+ vfs
+
+
+ tos_vfs.c
+ 1
+ ..\..\..\..\components\fs\vfs\tos_vfs.c
+
+
+ tos_vfs_device.c
+ 1
+ ..\..\..\..\components\fs\vfs\tos_vfs_device.c
+
+
+ tos_vfs_file.c
+ 1
+ ..\..\..\..\components\fs\vfs\tos_vfs_file.c
+
+
+ tos_vfs_fs.c
+ 1
+ ..\..\..\..\components\fs\vfs\tos_vfs_fs.c
+
+
+ tos_vfs_inode.c
+ 1
+ ..\..\..\..\components\fs\vfs\tos_vfs_inode.c
+
+
+
+
+ hal
+
+
+ tos_hal_sd.c
+ 1
+ ..\..\..\..\platform\hal\st\stm32l4xx\src\tos_hal_sd.c
+
+
+
+
+ ::CMSIS
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/board/BearPi_STM32L431RC/KEIL/fatfs_through_vfs/startup_stm32l431xx.s b/board/BearPi_STM32L431RC/KEIL/fatfs_through_vfs/startup_stm32l431xx.s
new file mode 100644
index 00000000..6a5c15a5
--- /dev/null
+++ b/board/BearPi_STM32L431RC/KEIL/fatfs_through_vfs/startup_stm32l431xx.s
@@ -0,0 +1,404 @@
+;********************** COPYRIGHT(c) 2017 STMicroelectronics ******************
+;* File Name : startup_stm32l431xx.s
+;* Author : MCD Application Team
+;* Description : STM32L431xx Ultra Low Power devices vector table for MDK-ARM toolchain.
+;* This module performs:
+;* - Set the initial SP
+;* - Set the initial PC == Reset_Handler
+;* - Set the vector table entries with the exceptions ISR address
+;* - Branches to __main in the C library (which eventually
+;* calls main()).
+;* After Reset the Cortex-M4 processor is in Thread mode,
+;* priority is Privileged, and the Stack is set to Main.
+;* <<< Use Configuration Wizard in Context Menu >>>
+;*******************************************************************************
+;*
+;* Redistribution and use in source and binary forms, with or without modification,
+;* are permitted provided that the following conditions are met:
+;* 1. Redistributions of source code must retain the above copyright notice,
+;* this list of conditions and the following disclaimer.
+;* 2. Redistributions in binary form must reproduce the above copyright notice,
+;* this list of conditions and the following disclaimer in the documentation
+;* and/or other materials provided with the distribution.
+;* 3. Neither the name of STMicroelectronics nor the names of its contributors
+;* may be used to endorse or promote products derived from this software
+;* without specific prior written permission.
+;*
+;* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+;* AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+;* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+;* DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
+;* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+;* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
+;* SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
+;* CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
+;* OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+;* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+;*
+;*******************************************************************************
+;
+; Amount of memory (in bytes) allocated for Stack
+; Tailor this value to your application needs
+; Stack Configuration
+; Stack Size (in Bytes) <0x0-0xFFFFFFFF:8>
+;
+
+Stack_Size EQU 0x100
+
+ AREA STACK, NOINIT, READWRITE, ALIGN=3
+Stack_Mem SPACE Stack_Size
+__initial_sp
+
+
+; Heap Configuration
+; Heap Size (in Bytes) <0x0-0xFFFFFFFF:8>
+;
+
+Heap_Size EQU 0x100
+
+ AREA HEAP, NOINIT, READWRITE, ALIGN=3
+__heap_base
+Heap_Mem SPACE Heap_Size
+__heap_limit
+
+ PRESERVE8
+ THUMB
+
+
+; Vector Table Mapped to Address 0 at Reset
+ AREA RESET, DATA, READONLY
+ EXPORT __Vectors
+ EXPORT __Vectors_End
+ EXPORT __Vectors_Size
+
+__Vectors DCD __initial_sp ; Top of Stack
+ DCD Reset_Handler ; Reset Handler
+ DCD NMI_Handler ; NMI Handler
+ DCD HardFault_Handler ; Hard Fault Handler
+ DCD MemManage_Handler ; MPU Fault Handler
+ DCD BusFault_Handler ; Bus Fault Handler
+ DCD UsageFault_Handler ; Usage Fault Handler
+ DCD 0 ; Reserved
+ DCD 0 ; Reserved
+ DCD 0 ; Reserved
+ DCD 0 ; Reserved
+ DCD SVC_Handler ; SVCall Handler
+ DCD DebugMon_Handler ; Debug Monitor Handler
+ DCD 0 ; Reserved
+ DCD PendSV_Handler ; PendSV Handler
+ DCD SysTick_Handler ; SysTick Handler
+
+ ; External Interrupts
+ DCD WWDG_IRQHandler ; Window WatchDog
+ DCD PVD_PVM_IRQHandler ; PVD/PVM1/PVM2/PVM3/PVM4 through EXTI Line detection
+ DCD TAMP_STAMP_IRQHandler ; Tamper and TimeStamps through the EXTI line
+ DCD RTC_WKUP_IRQHandler ; RTC Wakeup through the EXTI line
+ DCD FLASH_IRQHandler ; FLASH
+ DCD RCC_IRQHandler ; RCC
+ DCD EXTI0_IRQHandler ; EXTI Line0
+ DCD EXTI1_IRQHandler ; EXTI Line1
+ DCD EXTI2_IRQHandler ; EXTI Line2
+ DCD EXTI3_IRQHandler ; EXTI Line3
+ DCD EXTI4_IRQHandler ; EXTI Line4
+ DCD DMA1_Channel1_IRQHandler ; DMA1 Channel 1
+ DCD DMA1_Channel2_IRQHandler ; DMA1 Channel 2
+ DCD DMA1_Channel3_IRQHandler ; DMA1 Channel 3
+ DCD DMA1_Channel4_IRQHandler ; DMA1 Channel 4
+ DCD DMA1_Channel5_IRQHandler ; DMA1 Channel 5
+ DCD DMA1_Channel6_IRQHandler ; DMA1 Channel 6
+ DCD DMA1_Channel7_IRQHandler ; DMA1 Channel 7
+ DCD ADC1_IRQHandler ; ADC1
+ DCD CAN1_TX_IRQHandler ; CAN1 TX
+ DCD CAN1_RX0_IRQHandler ; CAN1 RX0
+ DCD CAN1_RX1_IRQHandler ; CAN1 RX1
+ DCD CAN1_SCE_IRQHandler ; CAN1 SCE
+ DCD EXTI9_5_IRQHandler ; External Line[9:5]s
+ DCD TIM1_BRK_TIM15_IRQHandler ; TIM1 Break and TIM15
+ DCD TIM1_UP_TIM16_IRQHandler ; TIM1 Update and TIM16
+ DCD TIM1_TRG_COM_IRQHandler ; TIM1 Trigger and Commutation
+ DCD TIM1_CC_IRQHandler ; TIM1 Capture Compare
+ DCD TIM2_IRQHandler ; TIM2
+ DCD 0 ; Reserved
+ DCD 0 ; Reserved
+ DCD I2C1_EV_IRQHandler ; I2C1 Event
+ DCD I2C1_ER_IRQHandler ; I2C1 Error
+ DCD I2C2_EV_IRQHandler ; I2C2 Event
+ DCD I2C2_ER_IRQHandler ; I2C2 Error
+ DCD SPI1_IRQHandler ; SPI1
+ DCD SPI2_IRQHandler ; SPI2
+ DCD USART1_IRQHandler ; USART1
+ DCD USART2_IRQHandler ; USART2
+ DCD USART3_IRQHandler ; USART3
+ DCD EXTI15_10_IRQHandler ; External Line[15:10]
+ DCD RTC_Alarm_IRQHandler ; RTC Alarm (A and B) through EXTI Line
+ DCD 0 ; Reserved
+ DCD 0 ; Reserved
+ DCD 0 ; Reserved
+ DCD 0 ; Reserved
+ DCD 0 ; Reserved
+ DCD 0 ; Reserved
+ DCD 0 ; Reserved
+ DCD SDMMC1_IRQHandler ; SDMMC1
+ DCD 0 ; Reserved
+ DCD SPI3_IRQHandler ; SPI3
+ DCD 0 ; Reserved
+ DCD 0 ; Reserved
+ DCD TIM6_DAC_IRQHandler ; TIM6 and DAC1&2 underrun errors
+ DCD TIM7_IRQHandler ; TIM7
+ DCD DMA2_Channel1_IRQHandler ; DMA2 Channel 1
+ DCD DMA2_Channel2_IRQHandler ; DMA2 Channel 2
+ DCD DMA2_Channel3_IRQHandler ; DMA2 Channel 3
+ DCD DMA2_Channel4_IRQHandler ; DMA2 Channel 4
+ DCD DMA2_Channel5_IRQHandler ; DMA2 Channel 5
+ DCD 0 ; Reserved
+ DCD 0 ; Reserved
+ DCD 0 ; Reserved
+ DCD COMP_IRQHandler ; COMP Interrupt
+ DCD LPTIM1_IRQHandler ; LP TIM1 interrupt
+ DCD LPTIM2_IRQHandler ; LP TIM2 interrupt
+ DCD 0 ; Reserved
+ DCD DMA2_Channel6_IRQHandler ; DMA2 Channel 6
+ DCD DMA2_Channel7_IRQHandler ; DMA2 Channel 7
+ DCD LPUART1_IRQHandler ; LP UART1 interrupt
+ DCD QUADSPI_IRQHandler ; Quad SPI global interrupt
+ DCD I2C3_EV_IRQHandler ; I2C3 event
+ DCD I2C3_ER_IRQHandler ; I2C3 error
+ DCD SAI1_IRQHandler ; Serial Audio Interface 1 global interrupt
+ DCD 0 ; Reserved
+ DCD SWPMI1_IRQHandler ; Serial Wire Interface 1 global interrupt
+ DCD TSC_IRQHandler ; Touch Sense Controller global interrupt
+ DCD 0 ; Reserved
+ DCD 0 ; Reserved
+ DCD RNG_IRQHandler ; RNG global interrupt
+ DCD FPU_IRQHandler ; FPU
+ DCD CRS_IRQHandler ; CRS interrupt
+
+__Vectors_End
+
+__Vectors_Size EQU __Vectors_End - __Vectors
+
+ AREA |.text|, CODE, READONLY
+
+; Reset handler
+Reset_Handler PROC
+ EXPORT Reset_Handler [WEAK]
+ IMPORT SystemInit
+ IMPORT __main
+
+ LDR R0, =SystemInit
+ BLX R0
+ LDR R0, =__main
+ BX R0
+ ENDP
+
+; Dummy Exception Handlers (infinite loops which can be modified)
+
+NMI_Handler PROC
+ EXPORT NMI_Handler [WEAK]
+ B .
+ ENDP
+HardFault_Handler\
+ PROC
+ EXPORT HardFault_Handler [WEAK]
+ B .
+ ENDP
+MemManage_Handler\
+ PROC
+ EXPORT MemManage_Handler [WEAK]
+ B .
+ ENDP
+BusFault_Handler\
+ PROC
+ EXPORT BusFault_Handler [WEAK]
+ B .
+ ENDP
+UsageFault_Handler\
+ PROC
+ EXPORT UsageFault_Handler [WEAK]
+ B .
+ ENDP
+SVC_Handler PROC
+ EXPORT SVC_Handler [WEAK]
+ B .
+ ENDP
+DebugMon_Handler\
+ PROC
+ EXPORT DebugMon_Handler [WEAK]
+ B .
+ ENDP
+PendSV_Handler PROC
+ EXPORT PendSV_Handler [WEAK]
+ B .
+ ENDP
+SysTick_Handler PROC
+ EXPORT SysTick_Handler [WEAK]
+ B .
+ ENDP
+
+Default_Handler PROC
+
+ EXPORT WWDG_IRQHandler [WEAK]
+ EXPORT PVD_PVM_IRQHandler [WEAK]
+ EXPORT TAMP_STAMP_IRQHandler [WEAK]
+ EXPORT RTC_WKUP_IRQHandler [WEAK]
+ EXPORT FLASH_IRQHandler [WEAK]
+ EXPORT RCC_IRQHandler [WEAK]
+ EXPORT EXTI0_IRQHandler [WEAK]
+ EXPORT EXTI1_IRQHandler [WEAK]
+ EXPORT EXTI2_IRQHandler [WEAK]
+ EXPORT EXTI3_IRQHandler [WEAK]
+ EXPORT EXTI4_IRQHandler [WEAK]
+ EXPORT DMA1_Channel1_IRQHandler [WEAK]
+ EXPORT DMA1_Channel2_IRQHandler [WEAK]
+ EXPORT DMA1_Channel3_IRQHandler [WEAK]
+ EXPORT DMA1_Channel4_IRQHandler [WEAK]
+ EXPORT DMA1_Channel5_IRQHandler [WEAK]
+ EXPORT DMA1_Channel6_IRQHandler [WEAK]
+ EXPORT DMA1_Channel7_IRQHandler [WEAK]
+ EXPORT ADC1_IRQHandler [WEAK]
+ EXPORT CAN1_TX_IRQHandler [WEAK]
+ EXPORT CAN1_RX0_IRQHandler [WEAK]
+ EXPORT CAN1_RX1_IRQHandler [WEAK]
+ EXPORT CAN1_SCE_IRQHandler [WEAK]
+ EXPORT EXTI9_5_IRQHandler [WEAK]
+ EXPORT TIM1_BRK_TIM15_IRQHandler [WEAK]
+ EXPORT TIM1_UP_TIM16_IRQHandler [WEAK]
+ EXPORT TIM1_TRG_COM_IRQHandler [WEAK]
+ EXPORT TIM1_CC_IRQHandler [WEAK]
+ EXPORT TIM2_IRQHandler [WEAK]
+ EXPORT I2C1_EV_IRQHandler [WEAK]
+ EXPORT I2C1_ER_IRQHandler [WEAK]
+ EXPORT I2C2_EV_IRQHandler [WEAK]
+ EXPORT I2C2_ER_IRQHandler [WEAK]
+ EXPORT SPI1_IRQHandler [WEAK]
+ EXPORT SPI2_IRQHandler [WEAK]
+ EXPORT USART1_IRQHandler [WEAK]
+ EXPORT USART2_IRQHandler [WEAK]
+ EXPORT USART3_IRQHandler [WEAK]
+ EXPORT EXTI15_10_IRQHandler [WEAK]
+ EXPORT RTC_Alarm_IRQHandler [WEAK]
+ EXPORT SDMMC1_IRQHandler [WEAK]
+ EXPORT SPI3_IRQHandler [WEAK]
+ EXPORT TIM6_DAC_IRQHandler [WEAK]
+ EXPORT TIM7_IRQHandler [WEAK]
+ EXPORT DMA2_Channel1_IRQHandler [WEAK]
+ EXPORT DMA2_Channel2_IRQHandler [WEAK]
+ EXPORT DMA2_Channel3_IRQHandler [WEAK]
+ EXPORT DMA2_Channel4_IRQHandler [WEAK]
+ EXPORT DMA2_Channel5_IRQHandler [WEAK]
+ EXPORT COMP_IRQHandler [WEAK]
+ EXPORT LPTIM1_IRQHandler [WEAK]
+ EXPORT LPTIM2_IRQHandler [WEAK]
+ EXPORT DMA2_Channel6_IRQHandler [WEAK]
+ EXPORT DMA2_Channel7_IRQHandler [WEAK]
+ EXPORT LPUART1_IRQHandler [WEAK]
+ EXPORT QUADSPI_IRQHandler [WEAK]
+ EXPORT I2C3_EV_IRQHandler [WEAK]
+ EXPORT I2C3_ER_IRQHandler [WEAK]
+ EXPORT SAI1_IRQHandler [WEAK]
+ EXPORT SWPMI1_IRQHandler [WEAK]
+ EXPORT TSC_IRQHandler [WEAK]
+ EXPORT RNG_IRQHandler [WEAK]
+ EXPORT FPU_IRQHandler [WEAK]
+ EXPORT CRS_IRQHandler [WEAK]
+
+WWDG_IRQHandler
+PVD_PVM_IRQHandler
+TAMP_STAMP_IRQHandler
+RTC_WKUP_IRQHandler
+FLASH_IRQHandler
+RCC_IRQHandler
+EXTI0_IRQHandler
+EXTI1_IRQHandler
+EXTI2_IRQHandler
+EXTI3_IRQHandler
+EXTI4_IRQHandler
+DMA1_Channel1_IRQHandler
+DMA1_Channel2_IRQHandler
+DMA1_Channel3_IRQHandler
+DMA1_Channel4_IRQHandler
+DMA1_Channel5_IRQHandler
+DMA1_Channel6_IRQHandler
+DMA1_Channel7_IRQHandler
+ADC1_IRQHandler
+CAN1_TX_IRQHandler
+CAN1_RX0_IRQHandler
+CAN1_RX1_IRQHandler
+CAN1_SCE_IRQHandler
+EXTI9_5_IRQHandler
+TIM1_BRK_TIM15_IRQHandler
+TIM1_UP_TIM16_IRQHandler
+TIM1_TRG_COM_IRQHandler
+TIM1_CC_IRQHandler
+TIM2_IRQHandler
+I2C1_EV_IRQHandler
+I2C1_ER_IRQHandler
+I2C2_EV_IRQHandler
+I2C2_ER_IRQHandler
+SPI1_IRQHandler
+SPI2_IRQHandler
+USART1_IRQHandler
+USART2_IRQHandler
+USART3_IRQHandler
+EXTI15_10_IRQHandler
+RTC_Alarm_IRQHandler
+SDMMC1_IRQHandler
+SPI3_IRQHandler
+TIM6_DAC_IRQHandler
+TIM7_IRQHandler
+DMA2_Channel1_IRQHandler
+DMA2_Channel2_IRQHandler
+DMA2_Channel3_IRQHandler
+DMA2_Channel4_IRQHandler
+DMA2_Channel5_IRQHandler
+COMP_IRQHandler
+LPTIM1_IRQHandler
+LPTIM2_IRQHandler
+DMA2_Channel6_IRQHandler
+DMA2_Channel7_IRQHandler
+LPUART1_IRQHandler
+QUADSPI_IRQHandler
+I2C3_EV_IRQHandler
+I2C3_ER_IRQHandler
+SAI1_IRQHandler
+SWPMI1_IRQHandler
+TSC_IRQHandler
+RNG_IRQHandler
+FPU_IRQHandler
+CRS_IRQHandler
+
+ B .
+
+ ENDP
+
+ ALIGN
+
+;*******************************************************************************
+; User Stack and Heap initialization
+;*******************************************************************************
+ IF :DEF:__MICROLIB
+
+ EXPORT __initial_sp
+ EXPORT __heap_base
+ EXPORT __heap_limit
+
+ ELSE
+
+ IMPORT __use_two_region_memory
+ EXPORT __user_initial_stackheap
+
+__user_initial_stackheap
+
+ LDR R0, = Heap_Mem
+ LDR R1, =(Stack_Mem + Stack_Size)
+ LDR R2, = (Heap_Mem + Heap_Size)
+ LDR R3, = Stack_Mem
+ BX LR
+
+ ALIGN
+
+ ENDIF
+
+ END
+
+;************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE*****
diff --git a/board/BearPi_STM32L431RC/KEIL/micropython_basic_demo/BearPi_STM32L31RC.uvoptx b/board/BearPi_STM32L431RC/KEIL/micropython_basic_demo/BearPi_STM32L31RC.uvoptx
new file mode 100644
index 00000000..61b73046
--- /dev/null
+++ b/board/BearPi_STM32L431RC/KEIL/micropython_basic_demo/BearPi_STM32L31RC.uvoptx
@@ -0,0 +1,2923 @@
+
+
+
+ 1.0
+
+ ### uVision Project, (C) Keil Software
+
+
+ *.c
+ *.s*; *.src; *.a*
+ *.obj; *.o
+ *.lib
+ *.txt; *.h; *.inc
+ *.plm
+ *.cpp
+ 0
+
+
+
+ 0
+ 0
+
+
+
+ TencentOS_tiny
+ 0x4
+ ARM-ADS
+
+ 80000000
+
+ 1
+ 1
+ 0
+ 1
+ 0
+
+
+ 1
+ 65535
+ 0
+ 0
+ 0
+
+
+ 79
+ 66
+ 8
+ .\list\
+
+
+ 1
+ 1
+ 1
+ 0
+ 1
+ 1
+ 0
+ 1
+ 0
+ 0
+ 0
+ 0
+
+
+ 1
+ 1
+ 1
+ 1
+ 1
+ 1
+ 1
+ 0
+ 0
+
+
+ 1
+ 0
+ 1
+
+ 18
+
+ 0
+ 1
+ 1
+ 1
+ 1
+ 1
+ 1
+ 1
+ 1
+ 1
+ 1
+ 1
+ 1
+ 1
+ 1
+ 1
+ 1
+ 1
+ 1
+ 0
+ 0
+ 1
+ 0
+ 0
+ 6
+
+
+
+
+
+
+
+
+
+
+ STLink\ST-LINKIII-KEIL_SWO.dll
+
+
+
+ 0
+ ARMRTXEVENTFLAGS
+ -L70 -Z18 -C0 -M0 -T1
+
+
+ 0
+ DLGTARM
+ (1010=-1,-1,-1,-1,0)(1007=-1,-1,-1,-1,0)(1008=-1,-1,-1,-1,0)(1009=-1,-1,-1,-1,0)(1012=-1,-1,-1,-1,0)
+
+
+ 0
+ ARMDBGFLAGS
+
+
+
+ 0
+ DLGUARM
+ (105=-1,-1,-1,-1,0)
+
+
+ 0
+ UL2CM3
+ UL2CM3(-S0 -C0 -P0 -FD20000000 -FC1000 -FN1 -FF0STM32L4xx_256 -FS08000000 -FL040000 -FP0($$Device:STM32L431RCTx$CMSIS\Flash\STM32L4xx_256.FLM))
+
+
+ 0
+ ST-LINKIII-KEIL_SWO
+ -U303030303030303030303031 -O10446 -SF10000 -C0 -A0 -I0 -HNlocalhost -HP7184 -P1 -N00("ARM CoreSight SW-DP (ARM Core") -D00(2BA01477) -L00(0) -TO131090 -TC10000000 -TT10000000 -TP21 -TDS8007 -TDT0 -TDC1F -TIEFFFFFFFF -TIP8 -FO15 -FD20000000 -FC1000 -FN1 -FF0STM32L4xx_256.FLM -FS08000000 -FL040000 -FP0($$Device:STM32L431RCTx$CMSIS\Flash\STM32L4xx_256.FLM)
+
+
+
+
+
+ 0
+ 1
+ tos_next_task
+
+
+ 1
+ 1
+ tos_rdyq.highest_prio
+
+
+ 2
+ 1
+ task_list
+
+
+ 3
+ 1
+ 0x20000280
+
+
+ 4
+ 1
+ tos_rdyq.highest_prio
+
+
+ 5
+ 1
+ owner
+
+
+ 6
+ 1
+ tos_curr_task
+
+
+ 7
+ 1
+ highest_pending_prio
+
+
+ 8
+ 1
+ task
+
+
+
+
+ 1
+ 0
+ 0x200016F4
+ 0
+
+
+
+ 0
+
+
+ 0
+ 1
+ 1
+ 0
+ 0
+ 0
+ 0
+ 1
+ 0
+ 0
+ 0
+ 0
+ 0
+ 0
+ 0
+ 0
+ 0
+ 0
+ 0
+ 0
+ 0
+ 0
+ 0
+ 0
+
+
+
+ 0
+ 0
+ 0
+
+
+
+
+
+
+
+
+
+ 1
+ 0
+ 0
+ 2
+ 10000000
+
+
+
+
+
+ Application/MDK-ARM
+ 0
+ 0
+ 0
+ 0
+
+ 1
+ 1
+ 2
+ 0
+ 0
+ 0
+ startup_stm32l431xx.s
+ startup_stm32l431xx.s
+ 0
+ 0
+
+
+
+
+ Application/User
+ 0
+ 0
+ 0
+ 0
+
+ 2
+ 2
+ 1
+ 0
+ 0
+ 0
+ ..\..\BSP\Src\gpio.c
+ gpio.c
+ 0
+ 0
+
+
+ 2
+ 3
+ 1
+ 0
+ 0
+ 0
+ ..\..\BSP\Src\main.c
+ main.c
+ 0
+ 0
+
+
+ 2
+ 4
+ 1
+ 0
+ 0
+ 0
+ ..\..\BSP\Src\mcu_init.c
+ mcu_init.c
+ 0
+ 0
+
+
+ 2
+ 5
+ 1
+ 0
+ 0
+ 0
+ ..\..\BSP\Src\stm32l4xx_hal_msp.c
+ stm32l4xx_hal_msp.c
+ 0
+ 0
+
+
+ 2
+ 6
+ 1
+ 0
+ 0
+ 0
+ ..\..\BSP\Src\stm32l4xx_it_mpy.c
+ stm32l4xx_it_mpy.c
+ 0
+ 0
+
+
+ 2
+ 7
+ 1
+ 0
+ 0
+ 0
+ ..\..\BSP\Src\usart.c
+ usart.c
+ 0
+ 0
+
+
+ 2
+ 8
+ 1
+ 0
+ 0
+ 0
+ ..\..\BSP\Src\adc.c
+ adc.c
+ 0
+ 0
+
+
+ 2
+ 9
+ 1
+ 0
+ 0
+ 0
+ ..\..\BSP\Src\i2c.c
+ i2c.c
+ 0
+ 0
+
+
+ 2
+ 10
+ 1
+ 0
+ 0
+ 0
+ ..\..\BSP\Src\spi.c
+ spi.c
+ 0
+ 0
+
+
+
+
+ examples
+ 0
+ 0
+ 0
+ 0
+
+ 3
+ 11
+ 1
+ 0
+ 0
+ 0
+ ..\..\..\..\examples\micropython_demo\micropython_demo.c
+ micropython_demo.c
+ 0
+ 0
+
+
+
+
+ Drivers/STM32L4xx_HAL_Driver
+ 0
+ 0
+ 0
+ 0
+
+ 4
+ 12
+ 1
+ 0
+ 0
+ 0
+ ..\..\..\..\platform\vendor_bsp\st\STM32L4xx_HAL_Driver\Src\stm32l4xx_hal_tim.c
+ stm32l4xx_hal_tim.c
+ 0
+ 0
+
+
+ 4
+ 13
+ 1
+ 0
+ 0
+ 0
+ ..\..\..\..\platform\vendor_bsp\st\STM32L4xx_HAL_Driver\Src\stm32l4xx_hal_tim_ex.c
+ stm32l4xx_hal_tim_ex.c
+ 0
+ 0
+
+
+ 4
+ 14
+ 1
+ 0
+ 0
+ 0
+ ..\..\..\..\platform\vendor_bsp\st\STM32L4xx_HAL_Driver\Src\stm32l4xx_hal_uart.c
+ stm32l4xx_hal_uart.c
+ 0
+ 0
+
+
+ 4
+ 15
+ 1
+ 0
+ 0
+ 0
+ ..\..\..\..\platform\vendor_bsp\st\STM32L4xx_HAL_Driver\Src\stm32l4xx_hal_uart_ex.c
+ stm32l4xx_hal_uart_ex.c
+ 0
+ 0
+
+
+ 4
+ 16
+ 1
+ 0
+ 0
+ 0
+ ..\..\..\..\platform\vendor_bsp\st\STM32L4xx_HAL_Driver\Src\stm32l4xx_hal.c
+ stm32l4xx_hal.c
+ 0
+ 0
+
+
+ 4
+ 17
+ 1
+ 0
+ 0
+ 0
+ ..\..\..\..\platform\vendor_bsp\st\STM32L4xx_HAL_Driver\Src\stm32l4xx_hal_i2c.c
+ stm32l4xx_hal_i2c.c
+ 0
+ 0
+
+
+ 4
+ 18
+ 1
+ 0
+ 0
+ 0
+ ..\..\..\..\platform\vendor_bsp\st\STM32L4xx_HAL_Driver\Src\stm32l4xx_hal_i2c_ex.c
+ stm32l4xx_hal_i2c_ex.c
+ 0
+ 0
+
+
+ 4
+ 19
+ 1
+ 0
+ 0
+ 0
+ ..\..\..\..\platform\vendor_bsp\st\STM32L4xx_HAL_Driver\Src\stm32l4xx_hal_rcc.c
+ stm32l4xx_hal_rcc.c
+ 0
+ 0
+
+
+ 4
+ 20
+ 1
+ 0
+ 0
+ 0
+ ..\..\..\..\platform\vendor_bsp\st\STM32L4xx_HAL_Driver\Src\stm32l4xx_hal_rcc_ex.c
+ stm32l4xx_hal_rcc_ex.c
+ 0
+ 0
+
+
+ 4
+ 21
+ 1
+ 0
+ 0
+ 0
+ ..\..\..\..\platform\vendor_bsp\st\STM32L4xx_HAL_Driver\Src\stm32l4xx_hal_flash.c
+ stm32l4xx_hal_flash.c
+ 0
+ 0
+
+
+ 4
+ 22
+ 1
+ 0
+ 0
+ 0
+ ..\..\..\..\platform\vendor_bsp\st\STM32L4xx_HAL_Driver\Src\stm32l4xx_hal_flash_ex.c
+ stm32l4xx_hal_flash_ex.c
+ 0
+ 0
+
+
+ 4
+ 23
+ 1
+ 0
+ 0
+ 0
+ ..\..\..\..\platform\vendor_bsp\st\STM32L4xx_HAL_Driver\Src\stm32l4xx_hal_flash_ramfunc.c
+ stm32l4xx_hal_flash_ramfunc.c
+ 0
+ 0
+
+
+ 4
+ 24
+ 1
+ 0
+ 0
+ 0
+ ..\..\..\..\platform\vendor_bsp\st\STM32L4xx_HAL_Driver\Src\stm32l4xx_hal_gpio.c
+ stm32l4xx_hal_gpio.c
+ 0
+ 0
+
+
+ 4
+ 25
+ 1
+ 0
+ 0
+ 0
+ ..\..\..\..\platform\vendor_bsp\st\STM32L4xx_HAL_Driver\Src\stm32l4xx_hal_dma.c
+ stm32l4xx_hal_dma.c
+ 0
+ 0
+
+
+ 4
+ 26
+ 1
+ 0
+ 0
+ 0
+ ..\..\..\..\platform\vendor_bsp\st\STM32L4xx_HAL_Driver\Src\stm32l4xx_hal_dma_ex.c
+ stm32l4xx_hal_dma_ex.c
+ 0
+ 0
+
+
+ 4
+ 27
+ 1
+ 0
+ 0
+ 0
+ ..\..\..\..\platform\vendor_bsp\st\STM32L4xx_HAL_Driver\Src\stm32l4xx_hal_pwr.c
+ stm32l4xx_hal_pwr.c
+ 0
+ 0
+
+
+ 4
+ 28
+ 1
+ 0
+ 0
+ 0
+ ..\..\..\..\platform\vendor_bsp\st\STM32L4xx_HAL_Driver\Src\stm32l4xx_hal_pwr_ex.c
+ stm32l4xx_hal_pwr_ex.c
+ 0
+ 0
+
+
+ 4
+ 29
+ 1
+ 0
+ 0
+ 0
+ ..\..\..\..\platform\vendor_bsp\st\STM32L4xx_HAL_Driver\Src\stm32l4xx_hal_cortex.c
+ stm32l4xx_hal_cortex.c
+ 0
+ 0
+
+
+ 4
+ 30
+ 1
+ 0
+ 0
+ 0
+ ..\..\..\..\platform\vendor_bsp\st\STM32L4xx_HAL_Driver\Src\stm32l4xx_hal_adc_ex.c
+ stm32l4xx_hal_adc_ex.c
+ 0
+ 0
+
+
+ 4
+ 31
+ 1
+ 0
+ 0
+ 0
+ ..\..\..\..\platform\vendor_bsp\st\STM32L4xx_HAL_Driver\Src\stm32l4xx_hal_adc.c
+ stm32l4xx_hal_adc.c
+ 0
+ 0
+
+
+ 4
+ 32
+ 1
+ 0
+ 0
+ 0
+ ..\..\..\..\platform\vendor_bsp\st\STM32L4xx_HAL_Driver\Src\stm32l4xx_hal_dac.c
+ stm32l4xx_hal_dac.c
+ 0
+ 0
+
+
+ 4
+ 33
+ 1
+ 0
+ 0
+ 0
+ ..\..\..\..\platform\vendor_bsp\st\STM32L4xx_HAL_Driver\Src\stm32l4xx_hal_dac_ex.c
+ stm32l4xx_hal_dac_ex.c
+ 0
+ 0
+
+
+ 4
+ 34
+ 1
+ 0
+ 0
+ 0
+ ..\..\..\..\platform\vendor_bsp\st\STM32L4xx_HAL_Driver\Src\stm32l4xx_hal_spi.c
+ stm32l4xx_hal_spi.c
+ 0
+ 0
+
+
+ 4
+ 35
+ 1
+ 0
+ 0
+ 0
+ ..\..\..\..\platform\vendor_bsp\st\STM32L4xx_HAL_Driver\Src\stm32l4xx_hal_spi_ex.c
+ stm32l4xx_hal_spi_ex.c
+ 0
+ 0
+
+
+
+
+ Drivers/CMSIS
+ 0
+ 0
+ 0
+ 0
+
+ 5
+ 36
+ 1
+ 0
+ 0
+ 0
+ ..\..\BSP\Src\system_stm32l4xx.c
+ system_stm32l4xx.c
+ 0
+ 0
+
+
+
+
+ Hardware
+ 0
+ 0
+ 0
+ 0
+
+ 6
+ 37
+ 1
+ 0
+ 0
+ 0
+ ..\..\BSP\Hardware\BH1750\BH1750.c
+ BH1750.c
+ 0
+ 0
+
+
+ 6
+ 38
+ 1
+ 0
+ 0
+ 0
+ ..\..\BSP\Hardware\LCD_ST7789\lcd_spi2_drv.c
+ lcd_spi2_drv.c
+ 0
+ 0
+
+
+
+
+ kernel
+ 0
+ 0
+ 0
+ 0
+
+ 7
+ 39
+ 1
+ 0
+ 0
+ 0
+ ..\..\..\..\kernel\core\tos_mmblk.c
+ tos_mmblk.c
+ 0
+ 0
+
+
+ 7
+ 40
+ 1
+ 0
+ 0
+ 0
+ ..\..\..\..\kernel\core\tos_mmheap.c
+ tos_mmheap.c
+ 0
+ 0
+
+
+ 7
+ 41
+ 1
+ 0
+ 0
+ 0
+ ..\..\..\..\kernel\core\tos_mutex.c
+ tos_mutex.c
+ 0
+ 0
+
+
+ 7
+ 42
+ 1
+ 0
+ 0
+ 0
+ ..\..\..\..\kernel\core\tos_sched.c
+ tos_sched.c
+ 0
+ 0
+
+
+ 7
+ 43
+ 1
+ 0
+ 0
+ 0
+ ..\..\..\..\kernel\core\tos_sem.c
+ tos_sem.c
+ 0
+ 0
+
+
+ 7
+ 44
+ 1
+ 0
+ 0
+ 0
+ ..\..\..\..\kernel\core\tos_sys.c
+ tos_sys.c
+ 0
+ 0
+
+
+ 7
+ 45
+ 1
+ 0
+ 0
+ 0
+ ..\..\..\..\kernel\core\tos_task.c
+ tos_task.c
+ 0
+ 0
+
+
+ 7
+ 46
+ 1
+ 0
+ 0
+ 0
+ ..\..\..\..\kernel\core\tos_tick.c
+ tos_tick.c
+ 0
+ 0
+
+
+ 7
+ 47
+ 1
+ 0
+ 0
+ 0
+ ..\..\..\..\kernel\core\tos_time.c
+ tos_time.c
+ 0
+ 0
+
+
+ 7
+ 48
+ 1
+ 0
+ 0
+ 0
+ ..\..\..\..\kernel\core\tos_timer.c
+ tos_timer.c
+ 0
+ 0
+
+
+ 7
+ 49
+ 1
+ 0
+ 0
+ 0
+ ..\..\..\..\kernel\core\tos_event.c
+ tos_event.c
+ 0
+ 0
+
+
+ 7
+ 50
+ 1
+ 0
+ 0
+ 0
+ ..\..\..\..\kernel\core\tos_global.c
+ tos_global.c
+ 0
+ 0
+
+
+ 7
+ 51
+ 1
+ 0
+ 0
+ 0
+ ..\..\..\..\kernel\core\tos_pend.c
+ tos_pend.c
+ 0
+ 0
+
+
+ 7
+ 52
+ 1
+ 0
+ 0
+ 0
+ ..\..\..\..\kernel\core\tos_robin.c
+ tos_robin.c
+ 0
+ 0
+
+
+ 7
+ 53
+ 1
+ 0
+ 0
+ 0
+ ..\..\..\..\kernel\core\tos_binary_heap.c
+ tos_binary_heap.c
+ 0
+ 0
+
+
+ 7
+ 54
+ 1
+ 0
+ 0
+ 0
+ ..\..\..\..\kernel\core\tos_char_fifo.c
+ tos_char_fifo.c
+ 0
+ 0
+
+
+ 7
+ 55
+ 1
+ 0
+ 0
+ 0
+ ..\..\..\..\kernel\core\tos_completion.c
+ tos_completion.c
+ 0
+ 0
+
+
+ 7
+ 56
+ 1
+ 0
+ 0
+ 0
+ ..\..\..\..\kernel\core\tos_countdownlatch.c
+ tos_countdownlatch.c
+ 0
+ 0
+
+
+ 7
+ 57
+ 1
+ 0
+ 0
+ 0
+ ..\..\..\..\kernel\core\tos_mail_queue.c
+ tos_mail_queue.c
+ 0
+ 0
+
+
+ 7
+ 58
+ 1
+ 0
+ 0
+ 0
+ ..\..\..\..\kernel\core\tos_message_queue.c
+ tos_message_queue.c
+ 0
+ 0
+
+
+ 7
+ 59
+ 1
+ 0
+ 0
+ 0
+ ..\..\..\..\kernel\core\tos_priority_mail_queue.c
+ tos_priority_mail_queue.c
+ 0
+ 0
+
+
+ 7
+ 60
+ 1
+ 0
+ 0
+ 0
+ ..\..\..\..\kernel\core\tos_priority_message_queue.c
+ tos_priority_message_queue.c
+ 0
+ 0
+
+
+ 7
+ 61
+ 1
+ 0
+ 0
+ 0
+ ..\..\..\..\kernel\core\tos_priority_queue.c
+ tos_priority_queue.c
+ 0
+ 0
+
+
+ 7
+ 62
+ 1
+ 0
+ 0
+ 0
+ ..\..\..\..\kernel\core\tos_ring_queue.c
+ tos_ring_queue.c
+ 0
+ 0
+
+
+
+
+ hal
+ 0
+ 0
+ 0
+ 0
+
+ 8
+ 63
+ 1
+ 0
+ 0
+ 0
+ ..\..\..\..\platform\hal\st\stm32l4xx\src\tos_hal_uart.c
+ tos_hal_uart.c
+ 0
+ 0
+
+
+ 8
+ 64
+ 1
+ 0
+ 0
+ 0
+ .\board\hal\mp_tos_hal_pin.c
+ mp_tos_hal_pin.c
+ 0
+ 0
+
+
+ 8
+ 65
+ 1
+ 0
+ 0
+ 0
+ .\board\hal\mp_tos_hal_spi.c
+ mp_tos_hal_spi.c
+ 0
+ 0
+
+
+ 8
+ 66
+ 1
+ 0
+ 0
+ 0
+ .\board\hal\mp_tos_hal_uart.c
+ mp_tos_hal_uart.c
+ 0
+ 0
+
+
+
+
+ cpu
+ 0
+ 0
+ 0
+ 0
+
+ 9
+ 67
+ 2
+ 0
+ 0
+ 0
+ ..\..\..\..\arch\arm\arm-v7m\cortex-m4\armcc\port_s.S
+ port_s.S
+ 0
+ 0
+
+
+ 9
+ 68
+ 1
+ 0
+ 0
+ 0
+ ..\..\..\..\arch\arm\arm-v7m\common\tos_cpu.c
+ tos_cpu.c
+ 0
+ 0
+
+
+ 9
+ 69
+ 1
+ 0
+ 0
+ 0
+ ..\..\..\..\arch\arm\arm-v7m\cortex-m4\armcc\port_c.c
+ port_c.c
+ 0
+ 0
+
+
+
+
+ config
+ 0
+ 0
+ 0
+ 0
+
+ 10
+ 70
+ 5
+ 0
+ 0
+ 0
+ ..\..\TOS-CONFIG\tos_config.h
+ tos_config.h
+ 0
+ 0
+
+
+
+
+ micropython/py
+ 0
+ 0
+ 0
+ 0
+
+ 11
+ 71
+ 1
+ 0
+ 0
+ 0
+ ..\..\..\..\components\language\micropython\py\argcheck.c
+ argcheck.c
+ 0
+ 0
+
+
+ 11
+ 72
+ 1
+ 0
+ 0
+ 0
+ ..\..\..\..\components\language\micropython\py\asmarm.c
+ asmarm.c
+ 0
+ 0
+
+
+ 11
+ 73
+ 1
+ 0
+ 0
+ 0
+ ..\..\..\..\components\language\micropython\py\asmbase.c
+ asmbase.c
+ 0
+ 0
+
+
+ 11
+ 74
+ 1
+ 0
+ 0
+ 0
+ ..\..\..\..\components\language\micropython\py\asmthumb.c
+ asmthumb.c
+ 0
+ 0
+
+
+ 11
+ 75
+ 1
+ 0
+ 0
+ 0
+ ..\..\..\..\components\language\micropython\py\asmx64.c
+ asmx64.c
+ 0
+ 0
+
+
+ 11
+ 76
+ 1
+ 0
+ 0
+ 0
+ ..\..\..\..\components\language\micropython\py\asmx86.c
+ asmx86.c
+ 0
+ 0
+
+
+ 11
+ 77
+ 1
+ 0
+ 0
+ 0
+ ..\..\..\..\components\language\micropython\py\asmxtensa.c
+ asmxtensa.c
+ 0
+ 0
+
+
+ 11
+ 78
+ 1
+ 0
+ 0
+ 0
+ ..\..\..\..\components\language\micropython\py\bc.c
+ bc.c
+ 0
+ 0
+
+
+ 11
+ 79
+ 1
+ 0
+ 0
+ 0
+ ..\..\..\..\components\language\micropython\py\binary.c
+ binary.c
+ 0
+ 0
+
+
+ 11
+ 80
+ 1
+ 0
+ 0
+ 0
+ ..\..\..\..\components\language\micropython\py\builtinevex.c
+ builtinevex.c
+ 0
+ 0
+
+
+ 11
+ 81
+ 1
+ 0
+ 0
+ 0
+ ..\..\..\..\components\language\micropython\py\builtinhelp.c
+ builtinhelp.c
+ 0
+ 0
+
+
+ 11
+ 82
+ 1
+ 0
+ 0
+ 0
+ ..\..\..\..\components\language\micropython\py\builtinimport.c
+ builtinimport.c
+ 0
+ 0
+
+
+ 11
+ 83
+ 1
+ 0
+ 0
+ 0
+ ..\..\..\..\components\language\micropython\py\compile.c
+ compile.c
+ 0
+ 0
+
+
+ 11
+ 84
+ 1
+ 0
+ 0
+ 0
+ ..\..\..\..\components\language\micropython\py\emitbc.c
+ emitbc.c
+ 0
+ 0
+
+
+ 11
+ 85
+ 1
+ 0
+ 0
+ 0
+ ..\..\..\..\components\language\micropython\py\emitcommon.c
+ emitcommon.c
+ 0
+ 0
+
+
+ 11
+ 86
+ 1
+ 0
+ 0
+ 0
+ ..\..\..\..\components\language\micropython\py\emitglue.c
+ emitglue.c
+ 0
+ 0
+
+
+ 11
+ 87
+ 1
+ 0
+ 0
+ 0
+ ..\..\..\..\components\language\micropython\py\emitinlinethumb.c
+ emitinlinethumb.c
+ 0
+ 0
+
+
+ 11
+ 88
+ 1
+ 0
+ 0
+ 0
+ ..\..\..\..\components\language\micropython\py\emitinlinextensa.c
+ emitinlinextensa.c
+ 0
+ 0
+
+
+ 11
+ 89
+ 1
+ 0
+ 0
+ 0
+ ..\..\..\..\components\language\micropython\py\emitnarm.c
+ emitnarm.c
+ 0
+ 0
+
+
+ 11
+ 90
+ 1
+ 0
+ 0
+ 0
+ ..\..\..\..\components\language\micropython\py\emitnative.c
+ emitnative.c
+ 0
+ 0
+
+
+ 11
+ 91
+ 1
+ 0
+ 0
+ 0
+ ..\..\..\..\components\language\micropython\py\emitnthumb.c
+ emitnthumb.c
+ 0
+ 0
+
+
+ 11
+ 92
+ 1
+ 0
+ 0
+ 0
+ ..\..\..\..\components\language\micropython\py\emitnx64.c
+ emitnx64.c
+ 0
+ 0
+
+
+ 11
+ 93
+ 1
+ 0
+ 0
+ 0
+ ..\..\..\..\components\language\micropython\py\emitnx86.c
+ emitnx86.c
+ 0
+ 0
+
+
+ 11
+ 94
+ 1
+ 0
+ 0
+ 0
+ ..\..\..\..\components\language\micropython\py\emitnxtensa.c
+ emitnxtensa.c
+ 0
+ 0
+
+
+ 11
+ 95
+ 1
+ 0
+ 0
+ 0
+ ..\..\..\..\components\language\micropython\py\emitnxtensawin.c
+ emitnxtensawin.c
+ 0
+ 0
+
+
+ 11
+ 96
+ 1
+ 0
+ 0
+ 0
+ ..\..\..\..\components\language\micropython\py\formatfloat.c
+ formatfloat.c
+ 0
+ 0
+
+
+ 11
+ 97
+ 1
+ 0
+ 0
+ 0
+ ..\..\..\..\components\language\micropython\py\frozenmod.c
+ frozenmod.c
+ 0
+ 0
+
+
+ 11
+ 98
+ 1
+ 0
+ 0
+ 0
+ ..\..\..\..\components\language\micropython\py\gc.c
+ gc.c
+ 0
+ 0
+
+
+ 11
+ 99
+ 1
+ 0
+ 0
+ 0
+ ..\..\..\..\components\language\micropython\py\lexer.c
+ lexer.c
+ 0
+ 0
+
+
+ 11
+ 100
+ 1
+ 0
+ 0
+ 0
+ ..\..\..\..\components\language\micropython\py\malloc.c
+ malloc.c
+ 0
+ 0
+
+
+ 11
+ 101
+ 1
+ 0
+ 0
+ 0
+ ..\..\..\..\components\language\micropython\py\map.c
+ map.c
+ 0
+ 0
+
+
+ 11
+ 102
+ 1
+ 0
+ 0
+ 0
+ ..\..\..\..\components\language\micropython\py\modarray.c
+ modarray.c
+ 0
+ 0
+
+
+ 11
+ 103
+ 1
+ 0
+ 0
+ 0
+ ..\..\..\..\components\language\micropython\py\modbuiltins.c
+ modbuiltins.c
+ 0
+ 0
+
+
+ 11
+ 104
+ 1
+ 0
+ 0
+ 0
+ ..\..\..\..\components\language\micropython\py\modcmath.c
+ modcmath.c
+ 0
+ 0
+
+
+ 11
+ 105
+ 1
+ 0
+ 0
+ 0
+ ..\..\..\..\components\language\micropython\py\modcollections.c
+ modcollections.c
+ 0
+ 0
+
+
+ 11
+ 106
+ 1
+ 0
+ 0
+ 0
+ ..\..\..\..\components\language\micropython\py\modgc.c
+ modgc.c
+ 0
+ 0
+
+
+ 11
+ 107
+ 1
+ 0
+ 0
+ 0
+ ..\..\..\..\components\language\micropython\py\modio.c
+ modio.c
+ 0
+ 0
+
+
+ 11
+ 108
+ 1
+ 0
+ 0
+ 0
+ ..\..\..\..\components\language\micropython\py\modmath.c
+ modmath.c
+ 0
+ 0
+
+
+ 11
+ 109
+ 1
+ 0
+ 0
+ 0
+ ..\..\..\..\components\language\micropython\py\modmicropython.c
+ modmicropython.c
+ 0
+ 0
+
+
+ 11
+ 110
+ 1
+ 0
+ 0
+ 0
+ ..\..\..\..\components\language\micropython\py\modstruct.c
+ modstruct.c
+ 0
+ 0
+
+
+ 11
+ 111
+ 1
+ 0
+ 0
+ 0
+ ..\..\..\..\components\language\micropython\py\modsys.c
+ modsys.c
+ 0
+ 0
+
+
+ 11
+ 112
+ 1
+ 0
+ 0
+ 0
+ ..\..\..\..\components\language\micropython\py\modthread.c
+ modthread.c
+ 0
+ 0
+
+
+ 11
+ 113
+ 1
+ 0
+ 0
+ 0
+ ..\..\..\..\components\language\micropython\py\moduerrno.c
+ moduerrno.c
+ 0
+ 0
+
+
+ 11
+ 114
+ 1
+ 0
+ 0
+ 0
+ ..\..\..\..\components\language\micropython\py\mpprint.c
+ mpprint.c
+ 0
+ 0
+
+
+ 11
+ 115
+ 1
+ 0
+ 0
+ 0
+ ..\..\..\..\components\language\micropython\py\mpstate.c
+ mpstate.c
+ 0
+ 0
+
+
+ 11
+ 116
+ 1
+ 0
+ 0
+ 0
+ ..\..\..\..\components\language\micropython\py\mpz.c
+ mpz.c
+ 0
+ 0
+
+
+ 11
+ 117
+ 1
+ 0
+ 0
+ 0
+ ..\..\..\..\components\language\micropython\py\nativeglue.c
+ nativeglue.c
+ 0
+ 0
+
+
+ 11
+ 118
+ 1
+ 0
+ 0
+ 0
+ ..\..\..\..\components\language\micropython\py\nlr.c
+ nlr.c
+ 0
+ 0
+
+
+ 11
+ 119
+ 1
+ 0
+ 0
+ 0
+ ..\..\..\..\components\language\micropython\py\nlraarch64.c
+ nlraarch64.c
+ 0
+ 0
+
+
+ 11
+ 120
+ 1
+ 0
+ 0
+ 0
+ ..\..\..\..\components\language\micropython\py\nlrpowerpc.c
+ nlrpowerpc.c
+ 0
+ 0
+
+
+ 11
+ 121
+ 1
+ 0
+ 0
+ 0
+ ..\..\..\..\components\language\micropython\py\nlrsetjmp.c
+ nlrsetjmp.c
+ 0
+ 0
+
+
+ 11
+ 122
+ 1
+ 0
+ 0
+ 0
+ ..\..\..\..\components\language\micropython\py\nlrthumb.c
+ nlrthumb.c
+ 0
+ 0
+
+
+ 11
+ 123
+ 1
+ 0
+ 0
+ 0
+ ..\..\..\..\components\language\micropython\py\nlrx64.c
+ nlrx64.c
+ 0
+ 0
+
+
+ 11
+ 124
+ 1
+ 0
+ 0
+ 0
+ ..\..\..\..\components\language\micropython\py\nlrx86.c
+ nlrx86.c
+ 0
+ 0
+
+
+ 11
+ 125
+ 1
+ 0
+ 0
+ 0
+ ..\..\..\..\components\language\micropython\py\nlrxtensa.c
+ nlrxtensa.c
+ 0
+ 0
+
+
+ 11
+ 126
+ 1
+ 0
+ 0
+ 0
+ ..\..\..\..\components\language\micropython\py\obj.c
+ obj.c
+ 0
+ 0
+
+
+ 11
+ 127
+ 1
+ 0
+ 0
+ 0
+ ..\..\..\..\components\language\micropython\py\objarray.c
+ objarray.c
+ 0
+ 0
+
+
+ 11
+ 128
+ 1
+ 0
+ 0
+ 0
+ ..\..\..\..\components\language\micropython\py\objattrtuple.c
+ objattrtuple.c
+ 0
+ 0
+
+
+ 11
+ 129
+ 1
+ 0
+ 0
+ 0
+ ..\..\..\..\components\language\micropython\py\objbool.c
+ objbool.c
+ 0
+ 0
+
+
+ 11
+ 130
+ 1
+ 0
+ 0
+ 0
+ ..\..\..\..\components\language\micropython\py\objboundmeth.c
+ objboundmeth.c
+ 0
+ 0
+
+
+ 11
+ 131
+ 1
+ 0
+ 0
+ 0
+ ..\..\..\..\components\language\micropython\py\objcell.c
+ objcell.c
+ 0
+ 0
+
+
+ 11
+ 132
+ 1
+ 0
+ 0
+ 0
+ ..\..\..\..\components\language\micropython\py\objclosure.c
+ objclosure.c
+ 0
+ 0
+
+
+ 11
+ 133
+ 1
+ 0
+ 0
+ 0
+ ..\..\..\..\components\language\micropython\py\objcomplex.c
+ objcomplex.c
+ 0
+ 0
+
+
+ 11
+ 134
+ 1
+ 0
+ 0
+ 0
+ ..\..\..\..\components\language\micropython\py\objdeque.c
+ objdeque.c
+ 0
+ 0
+
+
+ 11
+ 135
+ 1
+ 0
+ 0
+ 0
+ ..\..\..\..\components\language\micropython\py\objdict.c
+ objdict.c
+ 0
+ 0
+
+
+ 11
+ 136
+ 1
+ 0
+ 0
+ 0
+ ..\..\..\..\components\language\micropython\py\objenumerate.c
+ objenumerate.c
+ 0
+ 0
+
+
+ 11
+ 137
+ 1
+ 0
+ 0
+ 0
+ ..\..\..\..\components\language\micropython\py\objexcept.c
+ objexcept.c
+ 0
+ 0
+
+
+ 11
+ 138
+ 1
+ 0
+ 0
+ 0
+ ..\..\..\..\components\language\micropython\py\objfilter.c
+ objfilter.c
+ 0
+ 0
+
+
+ 11
+ 139
+ 1
+ 0
+ 0
+ 0
+ ..\..\..\..\components\language\micropython\py\objfloat.c
+ objfloat.c
+ 0
+ 0
+
+
+ 11
+ 140
+ 1
+ 0
+ 0
+ 0
+ ..\..\..\..\components\language\micropython\py\objfun.c
+ objfun.c
+ 0
+ 0
+
+
+ 11
+ 141
+ 1
+ 0
+ 0
+ 0
+ ..\..\..\..\components\language\micropython\py\objgenerator.c
+ objgenerator.c
+ 0
+ 0
+
+
+ 11
+ 142
+ 1
+ 0
+ 0
+ 0
+ ..\..\..\..\components\language\micropython\py\objgetitemiter.c
+ objgetitemiter.c
+ 0
+ 0
+
+
+ 11
+ 143
+ 1
+ 0
+ 0
+ 0
+ ..\..\..\..\components\language\micropython\py\objint.c
+ objint.c
+ 0
+ 0
+
+
+ 11
+ 144
+ 1
+ 0
+ 0
+ 0
+ ..\..\..\..\components\language\micropython\py\objint_longlong.c
+ objint_longlong.c
+ 0
+ 0
+
+
+ 11
+ 145
+ 1
+ 0
+ 0
+ 0
+ ..\..\..\..\components\language\micropython\py\objint_mpz.c
+ objint_mpz.c
+ 0
+ 0
+
+
+ 11
+ 146
+ 1
+ 0
+ 0
+ 0
+ ..\..\..\..\components\language\micropython\py\objlist.c
+ objlist.c
+ 0
+ 0
+
+
+ 11
+ 147
+ 1
+ 0
+ 0
+ 0
+ ..\..\..\..\components\language\micropython\py\objmap.c
+ objmap.c
+ 0
+ 0
+
+
+ 11
+ 148
+ 1
+ 0
+ 0
+ 0
+ ..\..\..\..\components\language\micropython\py\objmodule.c
+ objmodule.c
+ 0
+ 0
+
+
+ 11
+ 149
+ 1
+ 0
+ 0
+ 0
+ ..\..\..\..\components\language\micropython\py\objnamedtuple.c
+ objnamedtuple.c
+ 0
+ 0
+
+
+ 11
+ 150
+ 1
+ 0
+ 0
+ 0
+ ..\..\..\..\components\language\micropython\py\objnone.c
+ objnone.c
+ 0
+ 0
+
+
+ 11
+ 151
+ 1
+ 0
+ 0
+ 0
+ ..\..\..\..\components\language\micropython\py\objobject.c
+ objobject.c
+ 0
+ 0
+
+
+ 11
+ 152
+ 1
+ 0
+ 0
+ 0
+ ..\..\..\..\components\language\micropython\py\objpolyiter.c
+ objpolyiter.c
+ 0
+ 0
+
+
+ 11
+ 153
+ 1
+ 0
+ 0
+ 0
+ ..\..\..\..\components\language\micropython\py\objproperty.c
+ objproperty.c
+ 0
+ 0
+
+
+ 11
+ 154
+ 1
+ 0
+ 0
+ 0
+ ..\..\..\..\components\language\micropython\py\objrange.c
+ objrange.c
+ 0
+ 0
+
+
+ 11
+ 155
+ 1
+ 0
+ 0
+ 0
+ ..\..\..\..\components\language\micropython\py\objreversed.c
+ objreversed.c
+ 0
+ 0
+
+
+ 11
+ 156
+ 1
+ 0
+ 0
+ 0
+ ..\..\..\..\components\language\micropython\py\objset.c
+ objset.c
+ 0
+ 0
+
+
+ 11
+ 157
+ 1
+ 0
+ 0
+ 0
+ ..\..\..\..\components\language\micropython\py\objsingleton.c
+ objsingleton.c
+ 0
+ 0
+
+
+ 11
+ 158
+ 1
+ 0
+ 0
+ 0
+ ..\..\..\..\components\language\micropython\py\objslice.c
+ objslice.c
+ 0
+ 0
+
+
+ 11
+ 159
+ 1
+ 0
+ 0
+ 0
+ ..\..\..\..\components\language\micropython\py\objstr.c
+ objstr.c
+ 0
+ 0
+
+
+ 11
+ 160
+ 1
+ 0
+ 0
+ 0
+ ..\..\..\..\components\language\micropython\py\objstringio.c
+ objstringio.c
+ 0
+ 0
+
+
+ 11
+ 161
+ 1
+ 0
+ 0
+ 0
+ ..\..\..\..\components\language\micropython\py\objstrunicode.c
+ objstrunicode.c
+ 0
+ 0
+
+
+ 11
+ 162
+ 1
+ 0
+ 0
+ 0
+ ..\..\..\..\components\language\micropython\py\objtuple.c
+ objtuple.c
+ 0
+ 0
+
+
+ 11
+ 163
+ 1
+ 0
+ 0
+ 0
+ ..\..\..\..\components\language\micropython\py\objtype.c
+ objtype.c
+ 0
+ 0
+
+
+ 11
+ 164
+ 1
+ 0
+ 0
+ 0
+ ..\..\..\..\components\language\micropython\py\objzip.c
+ objzip.c
+ 0
+ 0
+
+
+ 11
+ 165
+ 1
+ 0
+ 0
+ 0
+ ..\..\..\..\components\language\micropython\py\opmethods.c
+ opmethods.c
+ 0
+ 0
+
+
+ 11
+ 166
+ 1
+ 0
+ 0
+ 0
+ ..\..\..\..\components\language\micropython\py\pairheap.c
+ pairheap.c
+ 0
+ 0
+
+
+ 11
+ 167
+ 1
+ 0
+ 0
+ 0
+ ..\..\..\..\components\language\micropython\py\parse.c
+ parse.c
+ 0
+ 0
+
+
+ 11
+ 168
+ 1
+ 0
+ 0
+ 0
+ ..\..\..\..\components\language\micropython\py\parsenum.c
+ parsenum.c
+ 0
+ 0
+
+
+ 11
+ 169
+ 1
+ 0
+ 0
+ 0
+ ..\..\..\..\components\language\micropython\py\parsenumbase.c
+ parsenumbase.c
+ 0
+ 0
+
+
+ 11
+ 170
+ 1
+ 0
+ 0
+ 0
+ ..\..\..\..\components\language\micropython\py\persistentcode.c
+ persistentcode.c
+ 0
+ 0
+
+
+ 11
+ 171
+ 1
+ 0
+ 0
+ 0
+ ..\..\..\..\components\language\micropython\py\profile.c
+ profile.c
+ 0
+ 0
+
+
+ 11
+ 172
+ 1
+ 0
+ 0
+ 0
+ ..\..\..\..\components\language\micropython\py\pystack.c
+ pystack.c
+ 0
+ 0
+
+
+ 11
+ 173
+ 1
+ 0
+ 0
+ 0
+ ..\..\..\..\components\language\micropython\py\qstr.c
+ qstr.c
+ 0
+ 0
+
+
+ 11
+ 174
+ 1
+ 0
+ 0
+ 0
+ ..\..\..\..\components\language\micropython\py\reader.c
+ reader.c
+ 0
+ 0
+
+
+ 11
+ 175
+ 1
+ 0
+ 0
+ 0
+ ..\..\..\..\components\language\micropython\py\repl.c
+ repl.c
+ 0
+ 0
+
+
+ 11
+ 176
+ 1
+ 0
+ 0
+ 0
+ ..\..\..\..\components\language\micropython\py\ringbuf.c
+ ringbuf.c
+ 0
+ 0
+
+
+ 11
+ 177
+ 1
+ 0
+ 0
+ 0
+ ..\..\..\..\components\language\micropython\py\runtime.c
+ runtime.c
+ 0
+ 0
+
+
+ 11
+ 178
+ 1
+ 0
+ 0
+ 0
+ ..\..\..\..\components\language\micropython\py\runtime_utils.c
+ runtime_utils.c
+ 0
+ 0
+
+
+ 11
+ 179
+ 1
+ 0
+ 0
+ 0
+ ..\..\..\..\components\language\micropython\py\scheduler.c
+ scheduler.c
+ 0
+ 0
+
+
+ 11
+ 180
+ 1
+ 0
+ 0
+ 0
+ ..\..\..\..\components\language\micropython\py\scope.c
+ scope.c
+ 0
+ 0
+
+
+ 11
+ 181
+ 1
+ 0
+ 0
+ 0
+ ..\..\..\..\components\language\micropython\py\sequence.c
+ sequence.c
+ 0
+ 0
+
+
+ 11
+ 182
+ 1
+ 0
+ 0
+ 0
+ ..\..\..\..\components\language\micropython\py\showbc.c
+ showbc.c
+ 0
+ 0
+
+
+ 11
+ 183
+ 1
+ 0
+ 0
+ 0
+ ..\..\..\..\components\language\micropython\py\smallint.c
+ smallint.c
+ 0
+ 0
+
+
+ 11
+ 184
+ 1
+ 0
+ 0
+ 0
+ ..\..\..\..\components\language\micropython\py\stackctrl.c
+ stackctrl.c
+ 0
+ 0
+
+
+ 11
+ 185
+ 1
+ 0
+ 0
+ 0
+ ..\..\..\..\components\language\micropython\py\stream.c
+ stream.c
+ 0
+ 0
+
+
+ 11
+ 186
+ 1
+ 0
+ 0
+ 0
+ ..\..\..\..\components\language\micropython\py\unicode.c
+ unicode.c
+ 0
+ 0
+
+
+ 11
+ 187
+ 1
+ 0
+ 0
+ 0
+ ..\..\..\..\components\language\micropython\py\vm.c
+ vm.c
+ 0
+ 0
+
+
+ 11
+ 188
+ 1
+ 0
+ 0
+ 0
+ ..\..\..\..\components\language\micropython\py\vstr.c
+ vstr.c
+ 0
+ 0
+
+
+ 11
+ 189
+ 1
+ 0
+ 0
+ 0
+ ..\..\..\..\components\language\micropython\py\warning.c
+ warning.c
+ 0
+ 0
+
+
+
+
+ micropython/shared
+ 0
+ 0
+ 0
+ 0
+
+ 12
+ 190
+ 1
+ 0
+ 0
+ 0
+ ..\..\..\..\components\language\micropython\shared\readline\readline.c
+ readline.c
+ 0
+ 0
+
+
+ 12
+ 191
+ 1
+ 0
+ 0
+ 0
+ ..\..\..\..\components\language\micropython\shared\runtime\pyexec.c
+ pyexec.c
+ 0
+ 0
+
+
+ 12
+ 192
+ 1
+ 0
+ 0
+ 0
+ ..\..\..\..\components\language\micropython\shared\runtime\sys_stdio_mphal.c
+ sys_stdio_mphal.c
+ 0
+ 0
+
+
+ 12
+ 193
+ 1
+ 0
+ 0
+ 0
+ ..\..\..\..\components\language\micropython\shared\runtime\interrupt_char.c
+ interrupt_char.c
+ 0
+ 0
+
+
+ 12
+ 194
+ 1
+ 0
+ 0
+ 0
+ ..\..\..\..\components\language\micropython\shared\runtime\stdout_helpers.c
+ stdout_helpers.c
+ 0
+ 0
+
+
+
+
+ micropython/extmod
+ 0
+ 0
+ 0
+ 0
+
+ 13
+ 195
+ 1
+ 0
+ 0
+ 0
+ ..\..\..\..\components\language\micropython\extmod\utime_mphal.c
+ utime_mphal.c
+ 0
+ 0
+
+
+ 13
+ 196
+ 1
+ 0
+ 0
+ 0
+ ..\..\..\..\components\language\micropython\extmod\machine_signal.c
+ machine_signal.c
+ 0
+ 0
+
+
+ 13
+ 197
+ 1
+ 0
+ 0
+ 0
+ ..\..\..\..\components\language\micropython\extmod\virtpin.c
+ virtpin.c
+ 0
+ 0
+
+
+ 13
+ 198
+ 1
+ 0
+ 0
+ 0
+ ..\..\..\..\components\language\micropython\extmod\machine_mem.c
+ machine_mem.c
+ 0
+ 0
+
+
+
+
+ micropython/port
+ 0
+ 0
+ 0
+ 0
+
+ 14
+ 199
+ 1
+ 0
+ 0
+ 0
+ ..\..\..\..\components\language\micropython\port\help.c
+ help.c
+ 0
+ 0
+
+
+ 14
+ 200
+ 1
+ 0
+ 0
+ 0
+ ..\..\..\..\components\language\micropython\port\mphalport.c
+ mphalport.c
+ 0
+ 0
+
+
+ 14
+ 201
+ 1
+ 0
+ 0
+ 0
+ ..\..\..\..\components\language\micropython\port\mpmain.c
+ mpmain.c
+ 0
+ 0
+
+
+ 14
+ 202
+ 1
+ 0
+ 0
+ 0
+ ..\..\..\..\components\language\micropython\port\mpthreadport.c
+ mpthreadport.c
+ 0
+ 0
+
+
+ 14
+ 203
+ 1
+ 0
+ 0
+ 0
+ ..\..\..\..\components\language\micropython\port\modules\machine_hw_spi.c
+ machine_hw_spi.c
+ 0
+ 0
+
+
+ 14
+ 204
+ 1
+ 0
+ 0
+ 0
+ ..\..\..\..\components\language\micropython\port\modules\machine_pin.c
+ machine_pin.c
+ 0
+ 0
+
+
+ 14
+ 205
+ 1
+ 0
+ 0
+ 0
+ ..\..\..\..\components\language\micropython\port\modules\machine_timer.c
+ machine_timer.c
+ 0
+ 0
+
+
+ 14
+ 206
+ 1
+ 0
+ 0
+ 0
+ ..\..\..\..\components\language\micropython\port\modules\machine_uart.c
+ machine_uart.c
+ 0
+ 0
+
+
+ 14
+ 207
+ 1
+ 0
+ 0
+ 0
+ ..\..\..\..\components\language\micropython\port\modules\modesp8266.c
+ modesp8266.c
+ 0
+ 0
+
+
+ 14
+ 208
+ 1
+ 0
+ 0
+ 0
+ ..\..\..\..\components\language\micropython\port\modules\modmachine.c
+ modmachine.c
+ 0
+ 0
+
+
+ 14
+ 209
+ 1
+ 0
+ 0
+ 0
+ ..\..\..\..\components\language\micropython\port\modules\modutime.c
+ modutime.c
+ 0
+ 0
+
+
+ 14
+ 210
+ 1
+ 0
+ 0
+ 0
+ ..\..\..\..\components\language\micropython\port\modules\vfs_tos.c
+ vfs_tos.c
+ 0
+ 0
+
+
+ 14
+ 211
+ 1
+ 0
+ 0
+ 0
+ ..\..\..\..\components\language\micropython\port\modules\vfs_tos_file.c
+ vfs_tos_file.c
+ 0
+ 0
+
+
+ 14
+ 212
+ 1
+ 0
+ 0
+ 0
+ .\board\mphalboard.c
+ mphalboard.c
+ 0
+ 0
+
+
+
+
+ ::CMSIS
+ 0
+ 0
+ 0
+ 1
+
+
+
diff --git a/board/BearPi_STM32L431RC/KEIL/micropython_basic_demo/BearPi_STM32L31RC.uvprojx b/board/BearPi_STM32L431RC/KEIL/micropython_basic_demo/BearPi_STM32L31RC.uvprojx
new file mode 100644
index 00000000..56bae191
--- /dev/null
+++ b/board/BearPi_STM32L431RC/KEIL/micropython_basic_demo/BearPi_STM32L31RC.uvprojx
@@ -0,0 +1,1532 @@
+
+
+
+ 2.1
+
+ ### uVision Project, (C) Keil Software
+
+
+
+ TencentOS_tiny
+ 0x4
+ ARM-ADS
+ 5060750::V5.06 update 6 (build 750)::ARMCC
+ 0
+
+
+ STM32L431RCTx
+ STMicroelectronics
+ Keil.STM32L4xx_DFP.2.2.0
+ http://www.keil.com/pack
+ IRAM(0x20000000-0x2000FFFF) IROM(0x8000000-0x803FFFF) CLOCK(8000000) FPU2 CPUTYPE("Cortex-M4")
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ $$Device:STM32L431RCTx$CMSIS\SVD\STM32L4x1.svd
+ 0
+ 0
+
+
+
+
+
+
+ 0
+ 0
+ 0
+ 0
+ 1
+
+ .\obj\
+ TencentOS_tiny
+ 1
+ 0
+ 1
+ 1
+ 0
+ .\list\
+ 1
+ 0
+ 0
+
+ 0
+ 0
+
+
+ 0
+ 0
+ 0
+ 0
+
+
+ 0
+ 0
+ cmd.exe /C cd $P..\..\..\..\components\language\micropython\port & make clean-build V=1
+ cmd.exe /C cd $P..\..\..\..\components\language\micropython\port & make genhdr V=1 PYTHON=python PORT_BOARD_DIR=$Pboard TARGET_GENHDR_DIR=$Pgenhdr
+ 0
+ 0
+ 0
+ 0
+
+
+ 0
+ 0
+
+
+ 0
+ 0
+ 0
+ 0
+
+ 0
+
+
+
+ 0
+ 0
+ 0
+ 0
+ 0
+ 1
+ 0
+ 0
+ 0
+ 0
+ 3
+
+
+ 0
+
+
+ SARMCM3.DLL
+ -REMAP -MPU
+ DCM.DLL
+ -pCM4
+ SARMCM3.DLL
+ -MPU
+ TCM.DLL
+ -pCM4
+
+
+
+ 1
+ 0
+ 0
+ 0
+ 16
+
+
+
+
+ 1
+ 0
+ 0
+ 1
+ 1
+ 4096
+
+ 1
+ BIN\UL2CM3.DLL
+ "" ()
+
+
+
+
+ 0
+
+
+
+ 0
+ 1
+ 1
+ 1
+ 1
+ 1
+ 1
+ 1
+ 0
+ 1
+ 1
+ 0
+ 1
+ 1
+ 0
+ 0
+ 1
+ 1
+ 1
+ 1
+ 1
+ 1
+ 1
+ 1
+ 1
+ 0
+ 0
+ "Cortex-M4"
+
+ 0
+ 0
+ 0
+ 1
+ 1
+ 0
+ 0
+ 2
+ 0
+ 0
+ 0
+ 8
+ 1
+ 0
+ 0
+ 0
+ 3
+ 3
+ 0
+ 0
+ 0
+ 0
+ 0
+ 0
+ 0
+ 0
+ 0
+ 0
+ 1
+ 0
+ 0
+ 0
+ 0
+ 1
+ 0
+
+
+ 0
+ 0x0
+ 0x0
+
+
+ 0
+ 0x0
+ 0x0
+
+
+ 0
+ 0x0
+ 0x0
+
+
+ 0
+ 0x0
+ 0x0
+
+
+ 0
+ 0x0
+ 0x0
+
+
+ 0
+ 0x0
+ 0x0
+
+
+ 0
+ 0x20000000
+ 0x10000
+
+
+ 1
+ 0x8000000
+ 0x40000
+
+
+ 0
+ 0x0
+ 0x0
+
+
+ 1
+ 0x0
+ 0x0
+
+
+ 1
+ 0x0
+ 0x0
+
+
+ 1
+ 0x0
+ 0x0
+
+
+ 1
+ 0x8000000
+ 0x40000
+
+
+ 1
+ 0x0
+ 0x0
+
+
+ 0
+ 0x0
+ 0x0
+
+
+ 0
+ 0x0
+ 0x0
+
+
+ 0
+ 0x0
+ 0x0
+
+
+ 0
+ 0x20000000
+ 0x10000
+
+
+ 0
+ 0x0
+ 0x0
+
+
+
+
+
+ 1
+ 1
+ 0
+ 0
+ 1
+ 0
+ 0
+ 0
+ 0
+ 0
+ 2
+ 0
+ 0
+ 1
+ 1
+ 0
+ 1
+ 1
+ 1
+ 1
+ 0
+ 0
+ 0
+
+
+ USE_HAL_DRIVER,STM32L431xx,WITH_TOS_NET_ADAPTER,USE_ESP8266,USE_MICROPYTHON
+
+ ..\..\BSP\Inc;..\..\..\..\platform\vendor_bsp\st\STM32L4xx_HAL_Driver\Inc;..\..\..\..\platform\vendor_bsp\st\STM32L4xx_HAL_Driver\Legacy;..\..\..\..\platform\vendor_bsp\st\CMSIS\Device\ST\STM32L4xx\Include;..\..\..\..\platform\vendor_bsp\st\CMSIS\Include;..\..\..\..\kernel\core\include;..\..\TOS-CONFIG;..\..\..\..\platform\arch\arm\cortex-m4\keil;..\..\..\..\kernel\pm\include;..\..\..\..\osal\cmsis_os;..\..\..\..\arch\arm\arm-v7m\common\include;..\..\..\..\arch\arm\arm-v7m\cortex-m4\armcc;..\..\..\..\net\at\include;..\..\..\..\kernel\hal\include;..\..\BSP\Hardware\LCD_ST7789;..\..\BSP\Hardware\BH1750;..\..\..\..\examples\micropython_demo;..\..\..\..\components\language\micropython;..\..\..\..\components\language\micropython\port;..\..\..\..\components\language\micropython\port\modules;..\micropython_basic_demo;.\board;.\board\hal
+
+
+
+ 1
+ 0
+ 0
+ 0
+ 0
+ 0
+ 0
+ 0
+ 0
+ 0
+
+
+
+
+
+
+
+
+ 1
+ 0
+ 0
+ 0
+ 1
+ 0
+ 0x08000000
+ 0x20000000
+
+
+
+
+
+
+
+
+
+
+
+
+ Application/MDK-ARM
+
+
+ startup_stm32l431xx.s
+ 2
+ startup_stm32l431xx.s
+
+
+
+
+ Application/User
+
+
+ gpio.c
+ 1
+ ..\..\BSP\Src\gpio.c
+
+
+ main.c
+ 1
+ ..\..\BSP\Src\main.c
+
+
+ mcu_init.c
+ 1
+ ..\..\BSP\Src\mcu_init.c
+
+
+ stm32l4xx_hal_msp.c
+ 1
+ ..\..\BSP\Src\stm32l4xx_hal_msp.c
+
+
+ stm32l4xx_it_mpy.c
+ 1
+ ..\..\BSP\Src\stm32l4xx_it_mpy.c
+
+
+ usart.c
+ 1
+ ..\..\BSP\Src\usart.c
+
+
+ adc.c
+ 1
+ ..\..\BSP\Src\adc.c
+
+
+ i2c.c
+ 1
+ ..\..\BSP\Src\i2c.c
+
+
+ spi.c
+ 1
+ ..\..\BSP\Src\spi.c
+
+
+
+
+ examples
+
+
+ micropython_demo.c
+ 1
+ ..\..\..\..\examples\micropython_demo\micropython_demo.c
+
+
+
+
+ Drivers/STM32L4xx_HAL_Driver
+
+
+ stm32l4xx_hal_tim.c
+ 1
+ ..\..\..\..\platform\vendor_bsp\st\STM32L4xx_HAL_Driver\Src\stm32l4xx_hal_tim.c
+
+
+ stm32l4xx_hal_tim_ex.c
+ 1
+ ..\..\..\..\platform\vendor_bsp\st\STM32L4xx_HAL_Driver\Src\stm32l4xx_hal_tim_ex.c
+
+
+ stm32l4xx_hal_uart.c
+ 1
+ ..\..\..\..\platform\vendor_bsp\st\STM32L4xx_HAL_Driver\Src\stm32l4xx_hal_uart.c
+
+
+ stm32l4xx_hal_uart_ex.c
+ 1
+ ..\..\..\..\platform\vendor_bsp\st\STM32L4xx_HAL_Driver\Src\stm32l4xx_hal_uart_ex.c
+
+
+ stm32l4xx_hal.c
+ 1
+ ..\..\..\..\platform\vendor_bsp\st\STM32L4xx_HAL_Driver\Src\stm32l4xx_hal.c
+
+
+ stm32l4xx_hal_i2c.c
+ 1
+ ..\..\..\..\platform\vendor_bsp\st\STM32L4xx_HAL_Driver\Src\stm32l4xx_hal_i2c.c
+
+
+ stm32l4xx_hal_i2c_ex.c
+ 1
+ ..\..\..\..\platform\vendor_bsp\st\STM32L4xx_HAL_Driver\Src\stm32l4xx_hal_i2c_ex.c
+
+
+ stm32l4xx_hal_rcc.c
+ 1
+ ..\..\..\..\platform\vendor_bsp\st\STM32L4xx_HAL_Driver\Src\stm32l4xx_hal_rcc.c
+
+
+ stm32l4xx_hal_rcc_ex.c
+ 1
+ ..\..\..\..\platform\vendor_bsp\st\STM32L4xx_HAL_Driver\Src\stm32l4xx_hal_rcc_ex.c
+
+
+ stm32l4xx_hal_flash.c
+ 1
+ ..\..\..\..\platform\vendor_bsp\st\STM32L4xx_HAL_Driver\Src\stm32l4xx_hal_flash.c
+
+
+ stm32l4xx_hal_flash_ex.c
+ 1
+ ..\..\..\..\platform\vendor_bsp\st\STM32L4xx_HAL_Driver\Src\stm32l4xx_hal_flash_ex.c
+
+
+ stm32l4xx_hal_flash_ramfunc.c
+ 1
+ ..\..\..\..\platform\vendor_bsp\st\STM32L4xx_HAL_Driver\Src\stm32l4xx_hal_flash_ramfunc.c
+
+
+ stm32l4xx_hal_gpio.c
+ 1
+ ..\..\..\..\platform\vendor_bsp\st\STM32L4xx_HAL_Driver\Src\stm32l4xx_hal_gpio.c
+
+
+ stm32l4xx_hal_dma.c
+ 1
+ ..\..\..\..\platform\vendor_bsp\st\STM32L4xx_HAL_Driver\Src\stm32l4xx_hal_dma.c
+
+
+ stm32l4xx_hal_dma_ex.c
+ 1
+ ..\..\..\..\platform\vendor_bsp\st\STM32L4xx_HAL_Driver\Src\stm32l4xx_hal_dma_ex.c
+
+
+ stm32l4xx_hal_pwr.c
+ 1
+ ..\..\..\..\platform\vendor_bsp\st\STM32L4xx_HAL_Driver\Src\stm32l4xx_hal_pwr.c
+
+
+ stm32l4xx_hal_pwr_ex.c
+ 1
+ ..\..\..\..\platform\vendor_bsp\st\STM32L4xx_HAL_Driver\Src\stm32l4xx_hal_pwr_ex.c
+
+
+ stm32l4xx_hal_cortex.c
+ 1
+ ..\..\..\..\platform\vendor_bsp\st\STM32L4xx_HAL_Driver\Src\stm32l4xx_hal_cortex.c
+
+
+ stm32l4xx_hal_adc_ex.c
+ 1
+ ..\..\..\..\platform\vendor_bsp\st\STM32L4xx_HAL_Driver\Src\stm32l4xx_hal_adc_ex.c
+
+
+ stm32l4xx_hal_adc.c
+ 1
+ ..\..\..\..\platform\vendor_bsp\st\STM32L4xx_HAL_Driver\Src\stm32l4xx_hal_adc.c
+
+
+ stm32l4xx_hal_dac.c
+ 1
+ ..\..\..\..\platform\vendor_bsp\st\STM32L4xx_HAL_Driver\Src\stm32l4xx_hal_dac.c
+
+
+ stm32l4xx_hal_dac_ex.c
+ 1
+ ..\..\..\..\platform\vendor_bsp\st\STM32L4xx_HAL_Driver\Src\stm32l4xx_hal_dac_ex.c
+
+
+ stm32l4xx_hal_spi.c
+ 1
+ ..\..\..\..\platform\vendor_bsp\st\STM32L4xx_HAL_Driver\Src\stm32l4xx_hal_spi.c
+
+
+ stm32l4xx_hal_spi_ex.c
+ 1
+ ..\..\..\..\platform\vendor_bsp\st\STM32L4xx_HAL_Driver\Src\stm32l4xx_hal_spi_ex.c
+
+
+
+
+ Drivers/CMSIS
+
+
+ system_stm32l4xx.c
+ 1
+ ..\..\BSP\Src\system_stm32l4xx.c
+
+
+
+
+ Hardware
+
+
+ BH1750.c
+ 1
+ ..\..\BSP\Hardware\BH1750\BH1750.c
+
+
+ lcd_spi2_drv.c
+ 1
+ ..\..\BSP\Hardware\LCD_ST7789\lcd_spi2_drv.c
+
+
+
+
+ kernel
+
+
+ tos_mmblk.c
+ 1
+ ..\..\..\..\kernel\core\tos_mmblk.c
+
+
+ tos_mmheap.c
+ 1
+ ..\..\..\..\kernel\core\tos_mmheap.c
+
+
+ tos_mutex.c
+ 1
+ ..\..\..\..\kernel\core\tos_mutex.c
+
+
+ tos_sched.c
+ 1
+ ..\..\..\..\kernel\core\tos_sched.c
+
+
+ tos_sem.c
+ 1
+ ..\..\..\..\kernel\core\tos_sem.c
+
+
+ tos_sys.c
+ 1
+ ..\..\..\..\kernel\core\tos_sys.c
+
+
+ tos_task.c
+ 1
+ ..\..\..\..\kernel\core\tos_task.c
+
+
+ tos_tick.c
+ 1
+ ..\..\..\..\kernel\core\tos_tick.c
+
+
+ tos_time.c
+ 1
+ ..\..\..\..\kernel\core\tos_time.c
+
+
+ tos_timer.c
+ 1
+ ..\..\..\..\kernel\core\tos_timer.c
+
+
+ tos_event.c
+ 1
+ ..\..\..\..\kernel\core\tos_event.c
+
+
+ tos_global.c
+ 1
+ ..\..\..\..\kernel\core\tos_global.c
+
+
+ tos_pend.c
+ 1
+ ..\..\..\..\kernel\core\tos_pend.c
+
+
+ tos_robin.c
+ 1
+ ..\..\..\..\kernel\core\tos_robin.c
+
+
+ tos_binary_heap.c
+ 1
+ ..\..\..\..\kernel\core\tos_binary_heap.c
+
+
+ tos_char_fifo.c
+ 1
+ ..\..\..\..\kernel\core\tos_char_fifo.c
+
+
+ tos_completion.c
+ 1
+ ..\..\..\..\kernel\core\tos_completion.c
+
+
+ tos_countdownlatch.c
+ 1
+ ..\..\..\..\kernel\core\tos_countdownlatch.c
+
+
+ tos_mail_queue.c
+ 1
+ ..\..\..\..\kernel\core\tos_mail_queue.c
+
+
+ tos_message_queue.c
+ 1
+ ..\..\..\..\kernel\core\tos_message_queue.c
+
+
+ tos_priority_mail_queue.c
+ 1
+ ..\..\..\..\kernel\core\tos_priority_mail_queue.c
+
+
+ tos_priority_message_queue.c
+ 1
+ ..\..\..\..\kernel\core\tos_priority_message_queue.c
+
+
+ tos_priority_queue.c
+ 1
+ ..\..\..\..\kernel\core\tos_priority_queue.c
+
+
+ tos_ring_queue.c
+ 1
+ ..\..\..\..\kernel\core\tos_ring_queue.c
+
+
+
+
+ hal
+
+
+ tos_hal_uart.c
+ 1
+ ..\..\..\..\platform\hal\st\stm32l4xx\src\tos_hal_uart.c
+
+
+ mp_tos_hal_pin.c
+ 1
+ .\board\hal\mp_tos_hal_pin.c
+
+
+ mp_tos_hal_spi.c
+ 1
+ .\board\hal\mp_tos_hal_spi.c
+
+
+ mp_tos_hal_uart.c
+ 1
+ .\board\hal\mp_tos_hal_uart.c
+
+
+
+
+ cpu
+
+
+ port_s.S
+ 2
+ ..\..\..\..\arch\arm\arm-v7m\cortex-m4\armcc\port_s.S
+
+
+ tos_cpu.c
+ 1
+ ..\..\..\..\arch\arm\arm-v7m\common\tos_cpu.c
+
+
+ port_c.c
+ 1
+ ..\..\..\..\arch\arm\arm-v7m\cortex-m4\armcc\port_c.c
+
+
+
+
+ config
+
+
+ tos_config.h
+ 5
+ ..\..\TOS-CONFIG\tos_config.h
+
+
+
+
+ micropython/py
+
+
+ argcheck.c
+ 1
+ ..\..\..\..\components\language\micropython\py\argcheck.c
+
+
+ asmarm.c
+ 1
+ ..\..\..\..\components\language\micropython\py\asmarm.c
+
+
+ asmbase.c
+ 1
+ ..\..\..\..\components\language\micropython\py\asmbase.c
+
+
+ asmthumb.c
+ 1
+ ..\..\..\..\components\language\micropython\py\asmthumb.c
+
+
+ asmx64.c
+ 1
+ ..\..\..\..\components\language\micropython\py\asmx64.c
+
+
+ asmx86.c
+ 1
+ ..\..\..\..\components\language\micropython\py\asmx86.c
+
+
+ asmxtensa.c
+ 1
+ ..\..\..\..\components\language\micropython\py\asmxtensa.c
+
+
+ bc.c
+ 1
+ ..\..\..\..\components\language\micropython\py\bc.c
+
+
+ binary.c
+ 1
+ ..\..\..\..\components\language\micropython\py\binary.c
+
+
+ builtinevex.c
+ 1
+ ..\..\..\..\components\language\micropython\py\builtinevex.c
+
+
+ builtinhelp.c
+ 1
+ ..\..\..\..\components\language\micropython\py\builtinhelp.c
+
+
+ builtinimport.c
+ 1
+ ..\..\..\..\components\language\micropython\py\builtinimport.c
+
+
+ compile.c
+ 1
+ ..\..\..\..\components\language\micropython\py\compile.c
+
+
+ emitbc.c
+ 1
+ ..\..\..\..\components\language\micropython\py\emitbc.c
+
+
+ emitcommon.c
+ 1
+ ..\..\..\..\components\language\micropython\py\emitcommon.c
+
+
+ emitglue.c
+ 1
+ ..\..\..\..\components\language\micropython\py\emitglue.c
+
+
+ emitinlinethumb.c
+ 1
+ ..\..\..\..\components\language\micropython\py\emitinlinethumb.c
+
+
+ emitinlinextensa.c
+ 1
+ ..\..\..\..\components\language\micropython\py\emitinlinextensa.c
+
+
+ emitnarm.c
+ 1
+ ..\..\..\..\components\language\micropython\py\emitnarm.c
+
+
+ emitnative.c
+ 1
+ ..\..\..\..\components\language\micropython\py\emitnative.c
+
+
+ emitnthumb.c
+ 1
+ ..\..\..\..\components\language\micropython\py\emitnthumb.c
+
+
+ emitnx64.c
+ 1
+ ..\..\..\..\components\language\micropython\py\emitnx64.c
+
+
+ emitnx86.c
+ 1
+ ..\..\..\..\components\language\micropython\py\emitnx86.c
+
+
+ emitnxtensa.c
+ 1
+ ..\..\..\..\components\language\micropython\py\emitnxtensa.c
+
+
+ emitnxtensawin.c
+ 1
+ ..\..\..\..\components\language\micropython\py\emitnxtensawin.c
+
+
+ formatfloat.c
+ 1
+ ..\..\..\..\components\language\micropython\py\formatfloat.c
+
+
+ frozenmod.c
+ 1
+ ..\..\..\..\components\language\micropython\py\frozenmod.c
+
+
+ gc.c
+ 1
+ ..\..\..\..\components\language\micropython\py\gc.c
+
+
+ lexer.c
+ 1
+ ..\..\..\..\components\language\micropython\py\lexer.c
+
+
+ malloc.c
+ 1
+ ..\..\..\..\components\language\micropython\py\malloc.c
+
+
+ map.c
+ 1
+ ..\..\..\..\components\language\micropython\py\map.c
+
+
+ modarray.c
+ 1
+ ..\..\..\..\components\language\micropython\py\modarray.c
+
+
+ modbuiltins.c
+ 1
+ ..\..\..\..\components\language\micropython\py\modbuiltins.c
+
+
+ modcmath.c
+ 1
+ ..\..\..\..\components\language\micropython\py\modcmath.c
+
+
+ modcollections.c
+ 1
+ ..\..\..\..\components\language\micropython\py\modcollections.c
+
+
+ modgc.c
+ 1
+ ..\..\..\..\components\language\micropython\py\modgc.c
+
+
+ modio.c
+ 1
+ ..\..\..\..\components\language\micropython\py\modio.c
+
+
+ modmath.c
+ 1
+ ..\..\..\..\components\language\micropython\py\modmath.c
+
+
+ modmicropython.c
+ 1
+ ..\..\..\..\components\language\micropython\py\modmicropython.c
+
+
+ modstruct.c
+ 1
+ ..\..\..\..\components\language\micropython\py\modstruct.c
+
+
+ modsys.c
+ 1
+ ..\..\..\..\components\language\micropython\py\modsys.c
+
+
+ modthread.c
+ 1
+ ..\..\..\..\components\language\micropython\py\modthread.c
+
+
+ moduerrno.c
+ 1
+ ..\..\..\..\components\language\micropython\py\moduerrno.c
+
+
+ mpprint.c
+ 1
+ ..\..\..\..\components\language\micropython\py\mpprint.c
+
+
+ mpstate.c
+ 1
+ ..\..\..\..\components\language\micropython\py\mpstate.c
+
+
+ mpz.c
+ 1
+ ..\..\..\..\components\language\micropython\py\mpz.c
+
+
+ nativeglue.c
+ 1
+ ..\..\..\..\components\language\micropython\py\nativeglue.c
+
+
+ nlr.c
+ 1
+ ..\..\..\..\components\language\micropython\py\nlr.c
+
+
+ nlraarch64.c
+ 1
+ ..\..\..\..\components\language\micropython\py\nlraarch64.c
+
+
+ nlrpowerpc.c
+ 1
+ ..\..\..\..\components\language\micropython\py\nlrpowerpc.c
+
+
+ nlrsetjmp.c
+ 1
+ ..\..\..\..\components\language\micropython\py\nlrsetjmp.c
+
+
+ nlrthumb.c
+ 1
+ ..\..\..\..\components\language\micropython\py\nlrthumb.c
+
+
+ nlrx64.c
+ 1
+ ..\..\..\..\components\language\micropython\py\nlrx64.c
+
+
+ nlrx86.c
+ 1
+ ..\..\..\..\components\language\micropython\py\nlrx86.c
+
+
+ nlrxtensa.c
+ 1
+ ..\..\..\..\components\language\micropython\py\nlrxtensa.c
+
+
+ obj.c
+ 1
+ ..\..\..\..\components\language\micropython\py\obj.c
+
+
+ objarray.c
+ 1
+ ..\..\..\..\components\language\micropython\py\objarray.c
+
+
+ objattrtuple.c
+ 1
+ ..\..\..\..\components\language\micropython\py\objattrtuple.c
+
+
+ objbool.c
+ 1
+ ..\..\..\..\components\language\micropython\py\objbool.c
+
+
+ objboundmeth.c
+ 1
+ ..\..\..\..\components\language\micropython\py\objboundmeth.c
+
+
+ objcell.c
+ 1
+ ..\..\..\..\components\language\micropython\py\objcell.c
+
+
+ objclosure.c
+ 1
+ ..\..\..\..\components\language\micropython\py\objclosure.c
+
+
+ objcomplex.c
+ 1
+ ..\..\..\..\components\language\micropython\py\objcomplex.c
+
+
+ objdeque.c
+ 1
+ ..\..\..\..\components\language\micropython\py\objdeque.c
+
+
+ objdict.c
+ 1
+ ..\..\..\..\components\language\micropython\py\objdict.c
+
+
+ objenumerate.c
+ 1
+ ..\..\..\..\components\language\micropython\py\objenumerate.c
+
+
+ objexcept.c
+ 1
+ ..\..\..\..\components\language\micropython\py\objexcept.c
+
+
+ objfilter.c
+ 1
+ ..\..\..\..\components\language\micropython\py\objfilter.c
+
+
+ objfloat.c
+ 1
+ ..\..\..\..\components\language\micropython\py\objfloat.c
+
+
+ objfun.c
+ 1
+ ..\..\..\..\components\language\micropython\py\objfun.c
+
+
+ objgenerator.c
+ 1
+ ..\..\..\..\components\language\micropython\py\objgenerator.c
+
+
+ objgetitemiter.c
+ 1
+ ..\..\..\..\components\language\micropython\py\objgetitemiter.c
+
+
+ objint.c
+ 1
+ ..\..\..\..\components\language\micropython\py\objint.c
+
+
+ objint_longlong.c
+ 1
+ ..\..\..\..\components\language\micropython\py\objint_longlong.c
+
+
+ objint_mpz.c
+ 1
+ ..\..\..\..\components\language\micropython\py\objint_mpz.c
+
+
+ objlist.c
+ 1
+ ..\..\..\..\components\language\micropython\py\objlist.c
+
+
+ objmap.c
+ 1
+ ..\..\..\..\components\language\micropython\py\objmap.c
+
+
+ objmodule.c
+ 1
+ ..\..\..\..\components\language\micropython\py\objmodule.c
+
+
+ objnamedtuple.c
+ 1
+ ..\..\..\..\components\language\micropython\py\objnamedtuple.c
+
+
+ objnone.c
+ 1
+ ..\..\..\..\components\language\micropython\py\objnone.c
+
+
+ objobject.c
+ 1
+ ..\..\..\..\components\language\micropython\py\objobject.c
+
+
+ objpolyiter.c
+ 1
+ ..\..\..\..\components\language\micropython\py\objpolyiter.c
+
+
+ objproperty.c
+ 1
+ ..\..\..\..\components\language\micropython\py\objproperty.c
+
+
+ objrange.c
+ 1
+ ..\..\..\..\components\language\micropython\py\objrange.c
+
+
+ objreversed.c
+ 1
+ ..\..\..\..\components\language\micropython\py\objreversed.c
+
+
+ objset.c
+ 1
+ ..\..\..\..\components\language\micropython\py\objset.c
+
+
+ objsingleton.c
+ 1
+ ..\..\..\..\components\language\micropython\py\objsingleton.c
+
+
+ objslice.c
+ 1
+ ..\..\..\..\components\language\micropython\py\objslice.c
+
+
+ objstr.c
+ 1
+ ..\..\..\..\components\language\micropython\py\objstr.c
+
+
+ objstringio.c
+ 1
+ ..\..\..\..\components\language\micropython\py\objstringio.c
+
+
+ objstrunicode.c
+ 1
+ ..\..\..\..\components\language\micropython\py\objstrunicode.c
+
+
+ objtuple.c
+ 1
+ ..\..\..\..\components\language\micropython\py\objtuple.c
+
+
+ objtype.c
+ 1
+ ..\..\..\..\components\language\micropython\py\objtype.c
+
+
+ objzip.c
+ 1
+ ..\..\..\..\components\language\micropython\py\objzip.c
+
+
+ opmethods.c
+ 1
+ ..\..\..\..\components\language\micropython\py\opmethods.c
+
+
+ pairheap.c
+ 1
+ ..\..\..\..\components\language\micropython\py\pairheap.c
+
+
+ parse.c
+ 1
+ ..\..\..\..\components\language\micropython\py\parse.c
+
+
+ parsenum.c
+ 1
+ ..\..\..\..\components\language\micropython\py\parsenum.c
+
+
+ parsenumbase.c
+ 1
+ ..\..\..\..\components\language\micropython\py\parsenumbase.c
+
+
+ persistentcode.c
+ 1
+ ..\..\..\..\components\language\micropython\py\persistentcode.c
+
+
+ profile.c
+ 1
+ ..\..\..\..\components\language\micropython\py\profile.c
+
+
+ pystack.c
+ 1
+ ..\..\..\..\components\language\micropython\py\pystack.c
+
+
+ qstr.c
+ 1
+ ..\..\..\..\components\language\micropython\py\qstr.c
+
+
+ reader.c
+ 1
+ ..\..\..\..\components\language\micropython\py\reader.c
+
+
+ repl.c
+ 1
+ ..\..\..\..\components\language\micropython\py\repl.c
+
+
+ ringbuf.c
+ 1
+ ..\..\..\..\components\language\micropython\py\ringbuf.c
+
+
+ runtime.c
+ 1
+ ..\..\..\..\components\language\micropython\py\runtime.c
+
+
+ runtime_utils.c
+ 1
+ ..\..\..\..\components\language\micropython\py\runtime_utils.c
+
+
+ scheduler.c
+ 1
+ ..\..\..\..\components\language\micropython\py\scheduler.c
+
+
+ scope.c
+ 1
+ ..\..\..\..\components\language\micropython\py\scope.c
+
+
+ sequence.c
+ 1
+ ..\..\..\..\components\language\micropython\py\sequence.c
+
+
+ showbc.c
+ 1
+ ..\..\..\..\components\language\micropython\py\showbc.c
+
+
+ smallint.c
+ 1
+ ..\..\..\..\components\language\micropython\py\smallint.c
+
+
+ stackctrl.c
+ 1
+ ..\..\..\..\components\language\micropython\py\stackctrl.c
+
+
+ stream.c
+ 1
+ ..\..\..\..\components\language\micropython\py\stream.c
+
+
+ unicode.c
+ 1
+ ..\..\..\..\components\language\micropython\py\unicode.c
+
+
+ vm.c
+ 1
+ ..\..\..\..\components\language\micropython\py\vm.c
+
+
+ vstr.c
+ 1
+ ..\..\..\..\components\language\micropython\py\vstr.c
+
+
+ warning.c
+ 1
+ ..\..\..\..\components\language\micropython\py\warning.c
+
+
+
+
+ micropython/shared
+
+
+ readline.c
+ 1
+ ..\..\..\..\components\language\micropython\shared\readline\readline.c
+
+
+ pyexec.c
+ 1
+ ..\..\..\..\components\language\micropython\shared\runtime\pyexec.c
+
+
+ sys_stdio_mphal.c
+ 1
+ ..\..\..\..\components\language\micropython\shared\runtime\sys_stdio_mphal.c
+
+
+ interrupt_char.c
+ 1
+ ..\..\..\..\components\language\micropython\shared\runtime\interrupt_char.c
+
+
+ stdout_helpers.c
+ 1
+ ..\..\..\..\components\language\micropython\shared\runtime\stdout_helpers.c
+
+
+
+
+ micropython/extmod
+
+
+ utime_mphal.c
+ 1
+ ..\..\..\..\components\language\micropython\extmod\utime_mphal.c
+
+
+ machine_signal.c
+ 1
+ ..\..\..\..\components\language\micropython\extmod\machine_signal.c
+
+
+ virtpin.c
+ 1
+ ..\..\..\..\components\language\micropython\extmod\virtpin.c
+
+
+ machine_mem.c
+ 1
+ ..\..\..\..\components\language\micropython\extmod\machine_mem.c
+
+
+
+
+ micropython/port
+
+
+ help.c
+ 1
+ ..\..\..\..\components\language\micropython\port\help.c
+
+
+ mphalport.c
+ 1
+ ..\..\..\..\components\language\micropython\port\mphalport.c
+
+
+ mpmain.c
+ 1
+ ..\..\..\..\components\language\micropython\port\mpmain.c
+
+
+ mpthreadport.c
+ 1
+ ..\..\..\..\components\language\micropython\port\mpthreadport.c
+
+
+ machine_hw_spi.c
+ 1
+ ..\..\..\..\components\language\micropython\port\modules\machine_hw_spi.c
+
+
+ machine_pin.c
+ 1
+ ..\..\..\..\components\language\micropython\port\modules\machine_pin.c
+
+
+ machine_timer.c
+ 1
+ ..\..\..\..\components\language\micropython\port\modules\machine_timer.c
+
+
+ machine_uart.c
+ 1
+ ..\..\..\..\components\language\micropython\port\modules\machine_uart.c
+
+
+ modesp8266.c
+ 1
+ ..\..\..\..\components\language\micropython\port\modules\modesp8266.c
+
+
+ modmachine.c
+ 1
+ ..\..\..\..\components\language\micropython\port\modules\modmachine.c
+
+
+ modutime.c
+ 1
+ ..\..\..\..\components\language\micropython\port\modules\modutime.c
+
+
+ vfs_tos.c
+ 1
+ ..\..\..\..\components\language\micropython\port\modules\vfs_tos.c
+
+
+ vfs_tos_file.c
+ 1
+ ..\..\..\..\components\language\micropython\port\modules\vfs_tos_file.c
+
+
+ mphalboard.c
+ 1
+ .\board\mphalboard.c
+
+
+
+
+ ::CMSIS
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/board/BearPi_STM32L431RC/KEIL/micropython_basic_demo/board/hal/mp_tos_hal_pin.c b/board/BearPi_STM32L431RC/KEIL/micropython_basic_demo/board/hal/mp_tos_hal_pin.c
new file mode 100644
index 00000000..1090378b
--- /dev/null
+++ b/board/BearPi_STM32L431RC/KEIL/micropython_basic_demo/board/hal/mp_tos_hal_pin.c
@@ -0,0 +1,273 @@
+#include "tos_k.h"
+#include "mp_tos_hal_pin.h"
+#include "gpio.h"
+
+#define ST_EXTI_VECTOR_SIZE 16
+
+#define ST_PORT_NUM(port) ((uint8_t)((port) >> 4) & 0x0F)
+#define ST_PIN_NUM(port) ((uint8_t)((port) & 0x0F))
+
+__STATIC__ hal_pin_cb_t hal_pin_irq_handler[ST_EXTI_VECTOR_SIZE];
+__STATIC__ void *hal_pin_irq_handler_arg[ST_EXTI_VECTOR_SIZE];
+__STATIC__ GPIO_TypeDef *hal_pin_irq_gpio[ST_EXTI_VECTOR_SIZE];
+
+__STATIC__ const uint8_t nvic_irq_channel[ST_EXTI_VECTOR_SIZE] = {
+ EXTI0_IRQn, EXTI1_IRQn, EXTI2_IRQn, EXTI3_IRQn,
+ EXTI4_IRQn, EXTI9_5_IRQn, EXTI9_5_IRQn, EXTI9_5_IRQn,
+ EXTI9_5_IRQn, EXTI9_5_IRQn, EXTI15_10_IRQn, EXTI15_10_IRQn,
+ EXTI15_10_IRQn, EXTI15_10_IRQn, EXTI15_10_IRQn, EXTI15_10_IRQn,
+};
+
+__STATIC__ int mask2no(uint32_t mask) {
+ for (int i = 0; i < 32; i++) {
+ if ((1U << i) == mask) {
+ return i;
+ }
+ }
+ return -1;
+}
+
+__API__ int tos_hal_pin_init(hal_pin_t *pin, hal_pin_port_t port, hal_pin_mode_t mode)
+{
+ GPIO_TypeDef *gpiox;
+ uint32_t gpio_pin;
+ GPIO_InitTypeDef gpio_init;
+
+ if (!pin) {
+ return -1;
+ }
+
+ gpiox = (GPIO_TypeDef *)(GPIOA_BASE + ST_PORT_NUM(port) * 0x0400UL);
+ gpio_pin = 1UL << ST_PIN_NUM(port);
+
+ gpio_init.Pin = gpio_pin;
+ gpio_init.Speed = GPIO_SPEED_FREQ_HIGH;
+ switch (mode) {
+ case HAL_PIN_MODE_OUTPUT:
+ gpio_init.Mode = GPIO_MODE_OUTPUT_PP;
+ gpio_init.Pull = GPIO_NOPULL;
+ break;
+ case HAL_PIN_MODE_OUTPUT_OD:
+ gpio_init.Mode = GPIO_MODE_OUTPUT_OD;
+ gpio_init.Pull = GPIO_NOPULL;
+ break;
+ case HAL_PIN_MODE_INPUT:
+ gpio_init.Mode = GPIO_MODE_INPUT;
+ gpio_init.Pull = GPIO_NOPULL;
+ break;
+ case HAL_PIN_MODE_INPUT_PULLUP:
+ gpio_init.Mode = GPIO_MODE_INPUT;
+ gpio_init.Pull = GPIO_PULLUP;
+ break;
+ case HAL_PIN_MODE_INPUT_PULLDOWN:
+ gpio_init.Mode = GPIO_MODE_INPUT;
+ gpio_init.Pull = GPIO_PULLDOWN;
+ break;
+ default:
+ return -1;
+ }
+ HAL_GPIO_Init((GPIO_TypeDef *)gpiox, &gpio_init);
+
+ pin->port = port;
+ pin->private_gpio = gpiox;
+ pin->private_pin = gpio_pin;
+ pin->mode = mode;
+
+ return 0;
+}
+
+__API__ int tos_hal_pin_irq(hal_pin_t *pin, hal_pin_irq_t irq)
+{
+ GPIO_TypeDef *gpiox;
+ uint32_t gpio_pin;
+ uint32_t gpio_pin_num;
+ GPIO_InitTypeDef gpio_init;
+ TOS_CPU_CPSR_ALLOC();
+
+ if (!pin) {
+ return -1;
+ }
+
+ if (!pin->private_gpio || !pin->private_pin) {
+ return -1;
+ }
+
+ gpiox = (GPIO_TypeDef *)pin->private_gpio;
+ gpio_pin = (uint32_t)pin->private_pin;
+ gpio_pin_num = mask2no(gpio_pin);
+ if (gpio_pin_num >= ST_EXTI_VECTOR_SIZE) {
+ return -1;
+ }
+
+ TOS_CPU_INT_DISABLE();
+ if (hal_pin_irq_gpio[gpio_pin_num] != NULL && hal_pin_irq_gpio[gpio_pin_num] != gpiox) {
+ TOS_CPU_INT_ENABLE();
+ return -1;
+ }
+
+ if (irq == HAL_PIN_IRQ_NONE) {
+ hal_pin_irq_gpio[gpio_pin_num] = NULL;
+ hal_pin_irq_handler[gpio_pin_num] = NULL;
+ hal_pin_irq_handler_arg[gpio_pin_num] = NULL;
+ TOS_CPU_INT_ENABLE();
+ HAL_NVIC_DisableIRQ(nvic_irq_channel[gpio_pin_num]);
+ } else {
+ hal_pin_irq_gpio[gpio_pin_num] = gpiox;
+ TOS_CPU_INT_ENABLE();
+ gpio_init.Pin = gpio_pin;
+ gpio_init.Speed = GPIO_SPEED_FREQ_HIGH;
+ gpio_init.Mode = GPIO_MODE_IT_RISING_FALLING;
+ switch (irq) {
+ case HAL_PIN_IRQ_RISING:
+ gpio_init.Mode = GPIO_MODE_IT_RISING;
+ break;
+ case HAL_PIN_IRQ_FALLING:
+ gpio_init.Mode = GPIO_MODE_IT_FALLING;
+ break;
+ case HAL_PIN_IRQ_RISING_FALLING:
+ gpio_init.Mode = GPIO_MODE_IT_RISING_FALLING;
+ break;
+ }
+ switch (pin->mode) {
+ case HAL_PIN_MODE_INPUT_PULLUP:
+ gpio_init.Pull = GPIO_PULLUP;
+ break;
+ case HAL_PIN_MODE_INPUT_PULLDOWN:
+ gpio_init.Pull = GPIO_PULLDOWN;
+ break;
+ default:
+ gpio_init.Pull = GPIO_NOPULL;
+ break;
+ }
+ HAL_GPIO_Init(gpiox, &gpio_init);
+ HAL_NVIC_SetPriority(nvic_irq_channel[gpio_pin_num], 2, 0);
+ HAL_NVIC_EnableIRQ(nvic_irq_channel[gpio_pin_num]);
+
+ pin->irq = irq;
+ }
+
+ return 0;
+}
+
+__API__ int tos_hal_pin_irq_callback(hal_pin_t *pin, hal_pin_cb_t callback, void *cb_arg)
+{
+ GPIO_TypeDef *gpiox;
+ uint32_t gpio_pin;
+ uint32_t gpio_pin_num;
+ TOS_CPU_CPSR_ALLOC();
+
+ if (!pin) {
+ return -1;
+ }
+
+ if (!pin->private_gpio || !pin->private_pin) {
+ return -1;
+ }
+
+ gpiox = (GPIO_TypeDef *)pin->private_gpio;
+ gpio_pin = (uint32_t)pin->private_pin;
+ gpio_pin_num = mask2no(gpio_pin);
+ if (gpio_pin_num >= ST_EXTI_VECTOR_SIZE) {
+ return -1;
+ }
+
+ TOS_CPU_INT_DISABLE();
+ if (hal_pin_irq_gpio[gpio_pin_num] != NULL && hal_pin_irq_gpio[gpio_pin_num] != gpiox) {
+ TOS_CPU_INT_ENABLE();
+ return -1;
+ }
+ hal_pin_irq_handler[gpio_pin_num] = gpiox;
+ hal_pin_irq_handler[gpio_pin_num] = callback;
+ hal_pin_irq_handler_arg[gpio_pin_num] = cb_arg;
+ TOS_CPU_INT_ENABLE();
+
+ return 0;
+}
+
+__API__ int tos_hal_pin_write(hal_pin_t *pin, int state)
+{
+ GPIO_TypeDef *gpiox;
+ uint32_t gpio_pin;
+
+ if (!pin) {
+ return -1;
+ }
+
+ if (!pin->private_gpio || !pin->private_pin) {
+ return -1;
+ }
+
+ gpiox = (GPIO_TypeDef *)pin->private_gpio;
+ gpio_pin = (uint32_t)pin->private_pin;
+
+ HAL_GPIO_WritePin(gpiox, gpio_pin, (state == 0) ? GPIO_PIN_RESET : GPIO_PIN_SET);
+
+ return 0;
+}
+
+__API__ int tos_hal_pin_read(hal_pin_t *pin)
+{
+ GPIO_TypeDef *gpiox;
+ uint32_t gpio_pin;
+
+ if (!pin) {
+ return -1;
+ }
+
+ if (!pin->private_gpio || !pin->private_pin) {
+ return -1;
+ }
+
+ gpiox = (GPIO_TypeDef *)pin->private_gpio;
+ gpio_pin = (uint32_t)pin->private_pin;
+
+ return (HAL_GPIO_ReadPin(gpiox, gpio_pin) == GPIO_PIN_RESET) ? 0 : 1;
+}
+
+__API__ int tos_hal_pin_deinit(hal_pin_t *pin)
+{
+ GPIO_TypeDef *gpiox;
+ uint32_t gpio_pin;
+ uint32_t gpio_pin_num;
+ TOS_CPU_CPSR_ALLOC();
+
+ if (!pin) {
+ return -1;
+ }
+
+ if (!pin->private_gpio || !pin->private_pin) {
+ return -1;
+ }
+
+ gpiox = (GPIO_TypeDef *)pin->private_gpio;
+ gpio_pin = (uint32_t)pin->private_pin;
+ gpio_pin_num = mask2no(gpio_pin);
+
+ TOS_CPU_INT_DISABLE();
+ if (hal_pin_irq_gpio[gpio_pin_num] == gpiox) {
+ hal_pin_irq_gpio[gpio_pin_num] = NULL;
+ hal_pin_irq_handler[gpio_pin_num] = NULL;
+ hal_pin_irq_handler_arg[gpio_pin_num] = NULL;
+ }
+ TOS_CPU_INT_ENABLE();
+ HAL_GPIO_DeInit(gpiox, gpio_pin);
+
+ return 0;
+}
+
+void HAL_GPIO_EXTI_Callback(uint16_t GPIO_Pin)
+{
+ uint32_t gpio_pin_num = mask2no(GPIO_Pin);
+ hal_pin_cb_t callback;
+ uint32_t cb_arg;
+ if (gpio_pin_num < ST_EXTI_VECTOR_SIZE) {
+
+ callback = hal_pin_irq_handler[gpio_pin_num];
+ cb_arg = hal_pin_irq_handler_arg[gpio_pin_num];
+ if (callback) {
+ callback(cb_arg);
+ }
+ }
+}
+
+
diff --git a/board/BearPi_STM32L431RC/KEIL/micropython_basic_demo/board/hal/mp_tos_hal_pin.h b/board/BearPi_STM32L431RC/KEIL/micropython_basic_demo/board/hal/mp_tos_hal_pin.h
new file mode 100644
index 00000000..6ac564d1
--- /dev/null
+++ b/board/BearPi_STM32L431RC/KEIL/micropython_basic_demo/board/hal/mp_tos_hal_pin.h
@@ -0,0 +1,45 @@
+#ifndef _TOS_HAL_PIN_H_
+#define _TOS_HAL_PIN_H_
+
+typedef unsigned char hal_pin_port_t;
+
+typedef enum hal_pin_mode_en {
+ HAL_PIN_MODE_OUTPUT = 0,
+ HAL_PIN_MODE_OUTPUT_OD,
+ HAL_PIN_MODE_INPUT,
+ HAL_PIN_MODE_INPUT_PULLUP,
+ HAL_PIN_MODE_INPUT_PULLDOWN,
+} hal_pin_mode_t;
+
+typedef enum hal_pin_irq_en {
+ HAL_PIN_IRQ_NONE = 0x00,
+ HAL_PIN_IRQ_RISING = 0x01,
+ HAL_PIN_IRQ_FALLING = 0x02,
+ HAL_PIN_IRQ_RISING_FALLING = 0x03,
+} hal_pin_irq_t;
+
+typedef struct hal_pin_st {
+ hal_pin_port_t port;
+ void *private_gpio;
+ void *private_pin;
+ hal_pin_mode_t mode;
+ hal_pin_irq_t irq;
+} hal_pin_t;
+
+
+typedef void (*hal_pin_cb_t)(void *arg);
+
+__API__ int tos_hal_pin_init(hal_pin_t *pin, hal_pin_port_t port, hal_pin_mode_t mode);
+
+__API__ int tos_hal_pin_write(hal_pin_t *pin, int state);
+
+__API__ int tos_hal_pin_read(hal_pin_t *pin);
+
+__API__ int tos_hal_pin_mode(hal_pin_t *pin, hal_pin_mode_t mode);
+
+__API__ int tos_hal_pin_irq(hal_pin_t *pin, hal_pin_irq_t irq);
+
+__API__ int tos_hal_pin_irq_callback(hal_pin_t *pin, hal_pin_cb_t callback, void *cb_arg);
+
+
+#endif
diff --git a/board/BearPi_STM32L431RC/KEIL/micropython_basic_demo/board/hal/mp_tos_hal_spi.c b/board/BearPi_STM32L431RC/KEIL/micropython_basic_demo/board/hal/mp_tos_hal_spi.c
new file mode 100644
index 00000000..b4f58be9
--- /dev/null
+++ b/board/BearPi_STM32L431RC/KEIL/micropython_basic_demo/board/hal/mp_tos_hal_spi.c
@@ -0,0 +1,80 @@
+#include "tos_k.h"
+#include "mp_tos_hal_spi.h"
+#include "stm32l4xx_hal.h"
+#include "spi.h"
+
+__API__ int tos_hal_spi_init(hal_spi_t *spi, hal_spi_port_t port)
+{
+ if (!spi) {
+ return -1;
+ }
+
+ if (port == HAL_SPI_PORT_1) {
+ spi->private_spi = &hspi1;
+ MX_SPI1_Init();
+ } else if (port == HAL_SPI_PORT_2) {
+ spi->private_spi = &hspi2;
+ MX_SPI2_Init();
+ } else if (port == HAL_SPI_PORT_3) {
+ spi->private_spi = &hspi3;
+ MX_SPI3_Init();
+ } else {
+ return -1;
+ }
+
+ return 0;
+}
+
+__API__ int tos_hal_spi_transfer(hal_spi_t *spi, const uint8_t *send_buf, uint8_t *recv_buf, size_t size, uint32_t timeout)
+{
+ HAL_StatusTypeDef hal_status;
+ SPI_HandleTypeDef *spi_handle;
+
+ if (!spi || (!send_buf && !recv_buf)) {
+ return -1;
+ }
+
+ if (!spi->private_spi) {
+ return -1;
+ }
+
+ spi_handle = (SPI_HandleTypeDef *)spi->private_spi;
+
+ if (send_buf && recv_buf) {
+ hal_status = HAL_SPI_TransmitReceive(spi_handle, send_buf, recv_buf, size, timeout);
+ } else if (send_buf) {
+ hal_status = HAL_SPI_Transmit(spi_handle, send_buf, size, timeout);
+ } else if (recv_buf) {
+ hal_status = HAL_SPI_Receive(spi_handle, send_buf, size, timeout);
+ }
+
+ if (hal_status != HAL_OK) {
+ return -1;
+ }
+ return 0;
+}
+
+__API__ int tos_hal_spi_deinit(hal_spi_t *spi)
+{
+ HAL_StatusTypeDef hal_status;
+ SPI_HandleTypeDef *spi_handle;
+
+ if (!spi) {
+ return -1;
+ }
+
+ if (!spi->private_spi) {
+ return -1;
+ }
+
+ spi_handle = (SPI_HandleTypeDef *)spi->private_spi;
+
+ hal_status = HAL_SPI_DeInit(spi_handle);
+ HAL_SPI_MspDeInit(spi_handle);
+
+ if (hal_status != HAL_OK) {
+ return -1;
+ }
+
+ return 0;
+}
diff --git a/board/BearPi_STM32L431RC/KEIL/micropython_basic_demo/board/hal/mp_tos_hal_spi.h b/board/BearPi_STM32L431RC/KEIL/micropython_basic_demo/board/hal/mp_tos_hal_spi.h
new file mode 100644
index 00000000..6dad4e9f
--- /dev/null
+++ b/board/BearPi_STM32L431RC/KEIL/micropython_basic_demo/board/hal/mp_tos_hal_spi.h
@@ -0,0 +1,22 @@
+#ifndef _TOS_HAL_SPI_H_
+#define _TOS_HAL_SPI_H_
+
+typedef enum hal_spi_port_en {
+ HAL_SPI_PORT_0 = 0,
+ HAL_SPI_PORT_1,
+ HAL_SPI_PORT_2,
+ HAL_SPI_PORT_3,
+} hal_spi_port_t;
+
+typedef struct hal_spi_st {
+ hal_spi_port_t port;
+ void *private_spi;
+} hal_spi_t;
+
+__API__ int tos_hal_spi_init(hal_spi_t *spi, hal_spi_port_t port);
+
+__API__ int tos_hal_spi_transfer(hal_spi_t *spi, const uint8_t *send_buf, uint8_t *recv_buf, size_t size, uint32_t timeout);
+
+__API__ int tos_hal_spi_deinit(hal_spi_t *spi);
+
+#endif
diff --git a/board/BearPi_STM32L431RC/KEIL/micropython_basic_demo/board/hal/mp_tos_hal_uart.c b/board/BearPi_STM32L431RC/KEIL/micropython_basic_demo/board/hal/mp_tos_hal_uart.c
new file mode 100644
index 00000000..a86dd40d
--- /dev/null
+++ b/board/BearPi_STM32L431RC/KEIL/micropython_basic_demo/board/hal/mp_tos_hal_uart.c
@@ -0,0 +1,26 @@
+#include "tos_k.h"
+#include "mp_tos_hal_uart.h"
+#include "stm32l4xx_hal.h"
+#include "usart.h"
+
+__API__ int tos_hal_uart_recv_start(hal_uart_t *uart, const uint8_t *buf, size_t size)
+{
+ HAL_StatusTypeDef hal_status;
+ UART_HandleTypeDef *uart_handle;
+
+ if (!uart || !buf) {
+ return -1;
+ }
+
+ if (!uart->private_uart) {
+ return -1;
+ }
+
+ uart_handle = (UART_HandleTypeDef *)uart->private_uart;
+
+ hal_status = HAL_UART_Receive_IT(uart_handle, (uint8_t *)buf, size);
+ if (hal_status != HAL_OK) {
+ return -1;
+ }
+ return 0;
+}
diff --git a/board/BearPi_STM32L431RC/KEIL/micropython_basic_demo/board/hal/mp_tos_hal_uart.h b/board/BearPi_STM32L431RC/KEIL/micropython_basic_demo/board/hal/mp_tos_hal_uart.h
new file mode 100644
index 00000000..31b79dbf
--- /dev/null
+++ b/board/BearPi_STM32L431RC/KEIL/micropython_basic_demo/board/hal/mp_tos_hal_uart.h
@@ -0,0 +1,8 @@
+#ifndef _MP_TOS_HAL_UART_H_
+#define _MP_TOS_HAL_UART_H_
+
+#include "tos_hal_uart.h"
+
+__API__ int tos_hal_uart_recv_start(hal_uart_t *uart, const uint8_t *buf, size_t size);
+
+#endif
diff --git a/board/BearPi_STM32L431RC/KEIL/micropython_basic_demo/board/mpconfigboard.h b/board/BearPi_STM32L431RC/KEIL/micropython_basic_demo/board/mpconfigboard.h
new file mode 100644
index 00000000..326a2eb3
--- /dev/null
+++ b/board/BearPi_STM32L431RC/KEIL/micropython_basic_demo/board/mpconfigboard.h
@@ -0,0 +1,10 @@
+/* board specific config */
+#define MICROPY_HW_BOARD_NAME "BearPi"
+#define MICROPY_HW_MCU_NAME "STM32F431RC"
+
+#define MICROPY_HW_UART_NUM 4
+#define MICROPY_HW_UART_REPL 2
+#define MICROPY_HW_SPI_NUM 4
+
+/* project specific config */
+#define MICROPY_CONFIG_ROM_LEVEL (MICROPY_CONFIG_ROM_LEVEL_BASIC_FEATURES)
diff --git a/board/BearPi_STM32L431RC/KEIL/micropython_basic_demo/board/mpconfigboard.mk b/board/BearPi_STM32L431RC/KEIL/micropython_basic_demo/board/mpconfigboard.mk
new file mode 100644
index 00000000..e69de29b
diff --git a/board/BearPi_STM32L431RC/KEIL/micropython_basic_demo/board/mphalboard.c b/board/BearPi_STM32L431RC/KEIL/micropython_basic_demo/board/mphalboard.c
new file mode 100644
index 00000000..58d8f0a0
--- /dev/null
+++ b/board/BearPi_STM32L431RC/KEIL/micropython_basic_demo/board/mphalboard.c
@@ -0,0 +1,109 @@
+
+#include "py/mpconfig.h"
+#include "py/mphal.h"
+#include "py/obj.h"
+#include "py/runtime.h"
+
+#include "modmachine.h"
+
+#if !(MP_GEN_HDR)
+#include "tos_k.h"
+#include "main.h"
+#endif
+
+/********************** Tick *************************/
+
+static uint32_t systick_get_us() {
+ // get systick value
+ uint32_t counter = SysTick->VAL;
+ uint32_t load = SysTick->LOAD;
+
+ // convert from decrementing to incrementing
+ counter = load - counter;
+
+ return (counter * 1000) / (load + 1);
+}
+
+mp_uint_t mp_hal_ticks_us(void) {
+ uint32_t ms = tos_tick2millisec(tos_systick_get());
+ uint32_t us = systick_get_us();
+ return ms * 1000 + us;
+}
+
+void mp_hal_delay_us(mp_uint_t usec) {
+ mp_uint_t ms = usec / 1000;
+ mp_uint_t us = usec % 1000;
+ if (ms > 0)
+ mp_hal_delay_ms(ms);
+ mp_uint_t start = mp_hal_ticks_us();
+ while (mp_hal_ticks_us() - start < us) {
+ }
+}
+
+/********************** GPIO *************************/
+
+#define ST_PIN(port_num, pin_num) ((uint8_t)(((port_num) << 4) & 0xF0) | ((pin_num) & 0x0F))
+
+STATIC const mp_rom_map_elem_t machine_pins_locals_dict_table[] = {
+
+ { MP_ROM_QSTR(MP_QSTR_A0), MP_ROM_INT(ST_PIN(0, 0)) },
+ { MP_ROM_QSTR(MP_QSTR_A1), MP_ROM_INT(ST_PIN(0, 1)) },
+ { MP_ROM_QSTR(MP_QSTR_A2), MP_ROM_INT(ST_PIN(0, 2)) },
+ { MP_ROM_QSTR(MP_QSTR_A3), MP_ROM_INT(ST_PIN(0, 3)) },
+ { MP_ROM_QSTR(MP_QSTR_A4), MP_ROM_INT(ST_PIN(0, 4)) },
+ { MP_ROM_QSTR(MP_QSTR_A5), MP_ROM_INT(ST_PIN(0, 5)) },
+ { MP_ROM_QSTR(MP_QSTR_A6), MP_ROM_INT(ST_PIN(0, 6)) },
+ { MP_ROM_QSTR(MP_QSTR_A7), MP_ROM_INT(ST_PIN(0, 7)) },
+ { MP_ROM_QSTR(MP_QSTR_A8), MP_ROM_INT(ST_PIN(0, 8)) },
+ { MP_ROM_QSTR(MP_QSTR_A9), MP_ROM_INT(ST_PIN(0, 9)) },
+ { MP_ROM_QSTR(MP_QSTR_A10), MP_ROM_INT(ST_PIN(0, 10)) },
+ { MP_ROM_QSTR(MP_QSTR_A11), MP_ROM_INT(ST_PIN(0, 11)) },
+ { MP_ROM_QSTR(MP_QSTR_A12), MP_ROM_INT(ST_PIN(0, 12)) },
+ { MP_ROM_QSTR(MP_QSTR_A13), MP_ROM_INT(ST_PIN(0, 13)) },
+ { MP_ROM_QSTR(MP_QSTR_A14), MP_ROM_INT(ST_PIN(0, 14)) },
+ { MP_ROM_QSTR(MP_QSTR_A15), MP_ROM_INT(ST_PIN(0, 15)) },
+
+ { MP_ROM_QSTR(MP_QSTR_B0), MP_ROM_INT(ST_PIN(1, 0)) },
+ { MP_ROM_QSTR(MP_QSTR_B1), MP_ROM_INT(ST_PIN(1, 1)) },
+ { MP_ROM_QSTR(MP_QSTR_B2), MP_ROM_INT(ST_PIN(1, 2)) },
+ { MP_ROM_QSTR(MP_QSTR_B3), MP_ROM_INT(ST_PIN(1, 3)) },
+ { MP_ROM_QSTR(MP_QSTR_B4), MP_ROM_INT(ST_PIN(1, 4)) },
+ { MP_ROM_QSTR(MP_QSTR_B5), MP_ROM_INT(ST_PIN(1, 5)) },
+ { MP_ROM_QSTR(MP_QSTR_B6), MP_ROM_INT(ST_PIN(1, 6)) },
+ { MP_ROM_QSTR(MP_QSTR_B7), MP_ROM_INT(ST_PIN(1, 7)) },
+ { MP_ROM_QSTR(MP_QSTR_B8), MP_ROM_INT(ST_PIN(1, 8)) },
+ { MP_ROM_QSTR(MP_QSTR_B9), MP_ROM_INT(ST_PIN(1, 9)) },
+ { MP_ROM_QSTR(MP_QSTR_B10), MP_ROM_INT(ST_PIN(1, 10)) },
+ { MP_ROM_QSTR(MP_QSTR_B11), MP_ROM_INT(ST_PIN(1, 11)) },
+ { MP_ROM_QSTR(MP_QSTR_B12), MP_ROM_INT(ST_PIN(1, 12)) },
+ { MP_ROM_QSTR(MP_QSTR_B13), MP_ROM_INT(ST_PIN(1, 13)) },
+ { MP_ROM_QSTR(MP_QSTR_B14), MP_ROM_INT(ST_PIN(1, 14)) },
+ { MP_ROM_QSTR(MP_QSTR_B15), MP_ROM_INT(ST_PIN(1, 15)) },
+
+ { MP_ROM_QSTR(MP_QSTR_C0), MP_ROM_INT(ST_PIN(2, 0)) },
+ { MP_ROM_QSTR(MP_QSTR_C1), MP_ROM_INT(ST_PIN(2, 1)) },
+ { MP_ROM_QSTR(MP_QSTR_C2), MP_ROM_INT(ST_PIN(2, 2)) },
+ { MP_ROM_QSTR(MP_QSTR_C3), MP_ROM_INT(ST_PIN(2, 3)) },
+ { MP_ROM_QSTR(MP_QSTR_C4), MP_ROM_INT(ST_PIN(2, 4)) },
+ { MP_ROM_QSTR(MP_QSTR_C5), MP_ROM_INT(ST_PIN(2, 5)) },
+ { MP_ROM_QSTR(MP_QSTR_C6), MP_ROM_INT(ST_PIN(2, 6)) },
+ { MP_ROM_QSTR(MP_QSTR_C7), MP_ROM_INT(ST_PIN(2, 7)) },
+ { MP_ROM_QSTR(MP_QSTR_C8), MP_ROM_INT(ST_PIN(2, 8)) },
+ { MP_ROM_QSTR(MP_QSTR_C9), MP_ROM_INT(ST_PIN(2, 9)) },
+ { MP_ROM_QSTR(MP_QSTR_C10), MP_ROM_INT(ST_PIN(2, 10)) },
+ { MP_ROM_QSTR(MP_QSTR_C11), MP_ROM_INT(ST_PIN(2, 11)) },
+ { MP_ROM_QSTR(MP_QSTR_C12), MP_ROM_INT(ST_PIN(2, 12)) },
+ { MP_ROM_QSTR(MP_QSTR_C13), MP_ROM_INT(ST_PIN(2, 13)) },
+ { MP_ROM_QSTR(MP_QSTR_C14), MP_ROM_INT(ST_PIN(2, 14)) },
+ { MP_ROM_QSTR(MP_QSTR_C15), MP_ROM_INT(ST_PIN(2, 15)) },
+
+ { MP_ROM_QSTR(MP_QSTR_D2), MP_ROM_INT(ST_PIN(3, 2)) },
+
+ { MP_ROM_QSTR(MP_QSTR_LED), MP_ROM_INT(ST_PIN(2, 13)) }, // C13
+ { MP_ROM_QSTR(MP_QSTR_KEY1), MP_ROM_INT(ST_PIN(1, 2)) }, // B2
+ { MP_ROM_QSTR(MP_QSTR_KEY2), MP_ROM_INT(ST_PIN(1, 3)) }, // B3
+
+};
+MP_DEFINE_CONST_DICT(machine_pins_locals_dict, machine_pins_locals_dict_table);
+
+
diff --git a/board/BearPi_STM32L431RC/KEIL/micropython_basic_demo/board/mphalboard.h b/board/BearPi_STM32L431RC/KEIL/micropython_basic_demo/board/mphalboard.h
new file mode 100644
index 00000000..bebb5f6d
--- /dev/null
+++ b/board/BearPi_STM32L431RC/KEIL/micropython_basic_demo/board/mphalboard.h
@@ -0,0 +1,11 @@
+#ifndef _MPHALBOARD_H_
+#define _MPHALBOARD_H_
+
+#include "py/obj.h"
+
+extern mp_uint_t mp_hal_ticks_us(void);
+extern void mp_hal_delay_us(mp_uint_t usec);
+
+extern const mp_obj_dict_t machine_pins_locals_dict;
+
+#endif /* _MPHALBOARD_H_ */
diff --git a/board/BearPi_STM32L431RC/KEIL/micropython_basic_demo/genhdr/moduledefs.h b/board/BearPi_STM32L431RC/KEIL/micropython_basic_demo/genhdr/moduledefs.h
new file mode 100644
index 00000000..b8a66465
--- /dev/null
+++ b/board/BearPi_STM32L431RC/KEIL/micropython_basic_demo/genhdr/moduledefs.h
@@ -0,0 +1,65 @@
+// Automatically generated by makemoduledefs.py.
+
+extern const struct _mp_obj_module_t mp_module___main__;
+#undef MODULE_DEF_MP_QSTR___MAIN__
+#define MODULE_DEF_MP_QSTR___MAIN__ { MP_ROM_QSTR(MP_QSTR___main__), MP_ROM_PTR(&mp_module___main__) },
+
+extern const struct _mp_obj_module_t mp_module_thread;
+#undef MODULE_DEF_MP_QSTR__THREAD
+#define MODULE_DEF_MP_QSTR__THREAD { MP_ROM_QSTR(MP_QSTR__thread), MP_ROM_PTR(&mp_module_thread) },
+
+extern const struct _mp_obj_module_t mp_module_builtins;
+#undef MODULE_DEF_MP_QSTR_BUILTINS
+#define MODULE_DEF_MP_QSTR_BUILTINS { MP_ROM_QSTR(MP_QSTR_builtins), MP_ROM_PTR(&mp_module_builtins) },
+
+extern const struct _mp_obj_module_t mp_module_gc;
+#undef MODULE_DEF_MP_QSTR_GC
+#define MODULE_DEF_MP_QSTR_GC { MP_ROM_QSTR(MP_QSTR_gc), MP_ROM_PTR(&mp_module_gc) },
+
+extern const struct _mp_obj_module_t mp_module_math;
+#undef MODULE_DEF_MP_QSTR_MATH
+#define MODULE_DEF_MP_QSTR_MATH { MP_ROM_QSTR(MP_QSTR_math), MP_ROM_PTR(&mp_module_math) },
+
+extern const struct _mp_obj_module_t mp_module_micropython;
+#undef MODULE_DEF_MP_QSTR_MICROPYTHON
+#define MODULE_DEF_MP_QSTR_MICROPYTHON { MP_ROM_QSTR(MP_QSTR_micropython), MP_ROM_PTR(&mp_module_micropython) },
+
+extern const struct _mp_obj_module_t mp_module_uarray;
+#undef MODULE_DEF_MP_QSTR_UARRAY
+#define MODULE_DEF_MP_QSTR_UARRAY { MP_ROM_QSTR(MP_QSTR_uarray), MP_ROM_PTR(&mp_module_uarray) },
+
+extern const struct _mp_obj_module_t mp_module_collections;
+#undef MODULE_DEF_MP_QSTR_UCOLLECTIONS
+#define MODULE_DEF_MP_QSTR_UCOLLECTIONS { MP_ROM_QSTR(MP_QSTR_ucollections), MP_ROM_PTR(&mp_module_collections) },
+
+extern const struct _mp_obj_module_t mp_module_machine;
+#undef MODULE_DEF_MP_QSTR_UMACHINE
+#define MODULE_DEF_MP_QSTR_UMACHINE { MP_ROM_QSTR(MP_QSTR_umachine), MP_ROM_PTR(&mp_module_machine) },
+
+extern const struct _mp_obj_module_t mp_module_ustruct;
+#undef MODULE_DEF_MP_QSTR_USTRUCT
+#define MODULE_DEF_MP_QSTR_USTRUCT { MP_ROM_QSTR(MP_QSTR_ustruct), MP_ROM_PTR(&mp_module_ustruct) },
+
+extern const struct _mp_obj_module_t mp_module_sys;
+#undef MODULE_DEF_MP_QSTR_USYS
+#define MODULE_DEF_MP_QSTR_USYS { MP_ROM_QSTR(MP_QSTR_usys), MP_ROM_PTR(&mp_module_sys) },
+
+extern const struct _mp_obj_module_t mp_module_utime;
+#undef MODULE_DEF_MP_QSTR_UTIME
+#define MODULE_DEF_MP_QSTR_UTIME { MP_ROM_QSTR(MP_QSTR_utime), MP_ROM_PTR(&mp_module_utime) },
+
+
+#define MICROPY_REGISTERED_MODULES \
+ MODULE_DEF_MP_QSTR_BUILTINS \
+ MODULE_DEF_MP_QSTR_GC \
+ MODULE_DEF_MP_QSTR_MATH \
+ MODULE_DEF_MP_QSTR_MICROPYTHON \
+ MODULE_DEF_MP_QSTR_UARRAY \
+ MODULE_DEF_MP_QSTR_UCOLLECTIONS \
+ MODULE_DEF_MP_QSTR_UMACHINE \
+ MODULE_DEF_MP_QSTR_USTRUCT \
+ MODULE_DEF_MP_QSTR_USYS \
+ MODULE_DEF_MP_QSTR_UTIME \
+ MODULE_DEF_MP_QSTR__THREAD \
+ MODULE_DEF_MP_QSTR___MAIN__ \
+// MICROPY_REGISTERED_MODULES
diff --git a/board/BearPi_STM32L431RC/KEIL/micropython_basic_demo/genhdr/mpversion.h b/board/BearPi_STM32L431RC/KEIL/micropython_basic_demo/genhdr/mpversion.h
new file mode 100644
index 00000000..22f31f30
--- /dev/null
+++ b/board/BearPi_STM32L431RC/KEIL/micropython_basic_demo/genhdr/mpversion.h
@@ -0,0 +1,4 @@
+// This file was generated by py/makeversionhdr.py
+#define MICROPY_GIT_TAG "v2.5.0-74-g467a6d7d-dirty"
+#define MICROPY_GIT_HASH "467a6d7d-dirty"
+#define MICROPY_BUILD_DATE "2022-09-28"
diff --git a/board/BearPi_STM32L431RC/KEIL/micropython_basic_demo/genhdr/qstrdefs.generated.h b/board/BearPi_STM32L431RC/KEIL/micropython_basic_demo/genhdr/qstrdefs.generated.h
new file mode 100644
index 00000000..18249bac
--- /dev/null
+++ b/board/BearPi_STM32L431RC/KEIL/micropython_basic_demo/genhdr/qstrdefs.generated.h
@@ -0,0 +1,436 @@
+// This file was automatically generated by makeqstrdata.py
+
+QDEF(MP_QSTRnull, 0, 0, "")
+QDEF(MP_QSTR_, 5381, 0, "")
+QDEF(MP_QSTR___dir__, 36730, 7, "__dir__")
+QDEF(MP_QSTR__0x0a_, 46511, 1, "\x0a")
+QDEF(MP_QSTR__space_, 46469, 1, " ")
+QDEF(MP_QSTR__star_, 46479, 1, "*")
+QDEF(MP_QSTR__slash_, 46474, 1, "/")
+QDEF(MP_QSTR__lt_module_gt_, 38077, 8, "")
+QDEF(MP_QSTR__, 46586, 1, "_")
+QDEF(MP_QSTR___call__, 63911, 8, "__call__")
+QDEF(MP_QSTR___class__, 50475, 9, "__class__")
+QDEF(MP_QSTR___delitem__, 13821, 11, "__delitem__")
+QDEF(MP_QSTR___enter__, 47725, 9, "__enter__")
+QDEF(MP_QSTR___exit__, 63557, 8, "__exit__")
+QDEF(MP_QSTR___getattr__, 63552, 11, "__getattr__")
+QDEF(MP_QSTR___getitem__, 14630, 11, "__getitem__")
+QDEF(MP_QSTR___hash__, 51447, 8, "__hash__")
+QDEF(MP_QSTR___init__, 42335, 8, "__init__")
+QDEF(MP_QSTR___int__, 6934, 7, "__int__")
+QDEF(MP_QSTR___iter__, 13007, 8, "__iter__")
+QDEF(MP_QSTR___len__, 45282, 7, "__len__")
+QDEF(MP_QSTR___main__, 5006, 8, "__main__")
+QDEF(MP_QSTR___module__, 12543, 10, "__module__")
+QDEF(MP_QSTR___name__, 14562, 8, "__name__")
+QDEF(MP_QSTR___new__, 5497, 7, "__new__")
+QDEF(MP_QSTR___next__, 29442, 8, "__next__")
+QDEF(MP_QSTR___qualname__, 107, 12, "__qualname__")
+QDEF(MP_QSTR___repr__, 2832, 8, "__repr__")
+QDEF(MP_QSTR___setitem__, 15922, 11, "__setitem__")
+QDEF(MP_QSTR___str__, 52688, 7, "__str__")
+QDEF(MP_QSTR_ArithmeticError, 35885, 15, "ArithmeticError")
+QDEF(MP_QSTR_AssertionError, 23191, 14, "AssertionError")
+QDEF(MP_QSTR_AttributeError, 56865, 14, "AttributeError")
+QDEF(MP_QSTR_BaseException, 37383, 13, "BaseException")
+QDEF(MP_QSTR_EOFError, 49041, 8, "EOFError")
+QDEF(MP_QSTR_Ellipsis, 57584, 8, "Ellipsis")
+QDEF(MP_QSTR_Exception, 10738, 9, "Exception")
+QDEF(MP_QSTR_GeneratorExit, 25110, 13, "GeneratorExit")
+QDEF(MP_QSTR_ImportError, 39968, 11, "ImportError")
+QDEF(MP_QSTR_IndentationError, 8284, 16, "IndentationError")
+QDEF(MP_QSTR_IndexError, 44419, 10, "IndexError")
+QDEF(MP_QSTR_KeyError, 234, 8, "KeyError")
+QDEF(MP_QSTR_KeyboardInterrupt, 58031, 17, "KeyboardInterrupt")
+QDEF(MP_QSTR_LookupError, 27135, 11, "LookupError")
+QDEF(MP_QSTR_MemoryError, 33756, 11, "MemoryError")
+QDEF(MP_QSTR_NameError, 11706, 9, "NameError")
+QDEF(MP_QSTR_NoneType, 26647, 8, "NoneType")
+QDEF(MP_QSTR_NotImplementedError, 39110, 19, "NotImplementedError")
+QDEF(MP_QSTR_OSError, 26017, 7, "OSError")
+QDEF(MP_QSTR_OverflowError, 57729, 13, "OverflowError")
+QDEF(MP_QSTR_RuntimeError, 61793, 12, "RuntimeError")
+QDEF(MP_QSTR_StopIteration, 7402, 13, "StopIteration")
+QDEF(MP_QSTR_SyntaxError, 36756, 11, "SyntaxError")
+QDEF(MP_QSTR_SystemExit, 65312, 10, "SystemExit")
+QDEF(MP_QSTR_TypeError, 38437, 9, "TypeError")
+QDEF(MP_QSTR_ValueError, 34710, 10, "ValueError")
+QDEF(MP_QSTR_ZeroDivisionError, 10166, 17, "ZeroDivisionError")
+QDEF(MP_QSTR_abs, 12949, 3, "abs")
+QDEF(MP_QSTR_all, 13124, 3, "all")
+QDEF(MP_QSTR_any, 13075, 3, "any")
+QDEF(MP_QSTR_append, 38763, 6, "append")
+QDEF(MP_QSTR_args, 50882, 4, "args")
+QDEF(MP_QSTR_bool, 15595, 4, "bool")
+QDEF(MP_QSTR_builtins, 12791, 8, "builtins")
+QDEF(MP_QSTR_bytearray, 41846, 9, "bytearray")
+QDEF(MP_QSTR_bytecode, 32034, 8, "bytecode")
+QDEF(MP_QSTR_bytes, 45660, 5, "bytes")
+QDEF(MP_QSTR_callable, 28685, 8, "callable")
+QDEF(MP_QSTR_chr, 19676, 3, "chr")
+QDEF(MP_QSTR_classmethod, 36020, 11, "classmethod")
+QDEF(MP_QSTR_clear, 41084, 5, "clear")
+QDEF(MP_QSTR_close, 26419, 5, "close")
+QDEF(MP_QSTR_const, 65472, 5, "const")
+QDEF(MP_QSTR_copy, 56288, 4, "copy")
+QDEF(MP_QSTR_count, 19878, 5, "count")
+QDEF(MP_QSTR_dict, 64575, 4, "dict")
+QDEF(MP_QSTR_dir, 7930, 3, "dir")
+QDEF(MP_QSTR_divmod, 1208, 6, "divmod")
+QDEF(MP_QSTR_end, 8970, 3, "end")
+QDEF(MP_QSTR_endswith, 41755, 8, "endswith")
+QDEF(MP_QSTR_eval, 42651, 4, "eval")
+QDEF(MP_QSTR_exec, 49182, 4, "exec")
+QDEF(MP_QSTR_extend, 59491, 6, "extend")
+QDEF(MP_QSTR_find, 13312, 4, "find")
+QDEF(MP_QSTR_format, 13094, 6, "format")
+QDEF(MP_QSTR_from_bytes, 29749, 10, "from_bytes")
+QDEF(MP_QSTR_get, 15155, 3, "get")
+QDEF(MP_QSTR_getattr, 6080, 7, "getattr")
+QDEF(MP_QSTR_globals, 18845, 7, "globals")
+QDEF(MP_QSTR_hasattr, 45196, 7, "hasattr")
+QDEF(MP_QSTR_hash, 28855, 4, "hash")
+QDEF(MP_QSTR_id, 28456, 2, "id")
+QDEF(MP_QSTR_index, 10363, 5, "index")
+QDEF(MP_QSTR_insert, 21522, 6, "insert")
+QDEF(MP_QSTR_int, 21270, 3, "int")
+QDEF(MP_QSTR_isalpha, 14315, 7, "isalpha")
+QDEF(MP_QSTR_isdigit, 39592, 7, "isdigit")
+QDEF(MP_QSTR_isinstance, 48822, 10, "isinstance")
+QDEF(MP_QSTR_islower, 33020, 7, "islower")
+QDEF(MP_QSTR_isspace, 63579, 7, "isspace")
+QDEF(MP_QSTR_issubclass, 32693, 10, "issubclass")
+QDEF(MP_QSTR_isupper, 42973, 7, "isupper")
+QDEF(MP_QSTR_items, 21475, 5, "items")
+QDEF(MP_QSTR_iter, 8591, 4, "iter")
+QDEF(MP_QSTR_join, 23719, 4, "join")
+QDEF(MP_QSTR_key, 27954, 3, "key")
+QDEF(MP_QSTR_keys, 4865, 4, "keys")
+QDEF(MP_QSTR_len, 16482, 3, "len")
+QDEF(MP_QSTR_list, 7463, 4, "list")
+QDEF(MP_QSTR_little, 27273, 6, "little")
+QDEF(MP_QSTR_locals, 41275, 6, "locals")
+QDEF(MP_QSTR_lower, 52166, 5, "lower")
+QDEF(MP_QSTR_lstrip, 47589, 6, "lstrip")
+QDEF(MP_QSTR_main, 47054, 4, "main")
+QDEF(MP_QSTR_map, 17337, 3, "map")
+QDEF(MP_QSTR_micropython, 31755, 11, "micropython")
+QDEF(MP_QSTR_next, 34882, 4, "next")
+QDEF(MP_QSTR_object, 36240, 6, "object")
+QDEF(MP_QSTR_open, 15057, 4, "open")
+QDEF(MP_QSTR_ord, 24092, 3, "ord")
+QDEF(MP_QSTR_pop, 29482, 3, "pop")
+QDEF(MP_QSTR_popitem, 11455, 7, "popitem")
+QDEF(MP_QSTR_pow, 29485, 3, "pow")
+QDEF(MP_QSTR_print, 50772, 5, "print")
+QDEF(MP_QSTR_range, 24090, 5, "range")
+QDEF(MP_QSTR_read, 63927, 4, "read")
+QDEF(MP_QSTR_readinto, 48971, 8, "readinto")
+QDEF(MP_QSTR_readline, 6649, 8, "readline")
+QDEF(MP_QSTR_remove, 35427, 6, "remove")
+QDEF(MP_QSTR_replace, 9545, 7, "replace")
+QDEF(MP_QSTR_repr, 63440, 4, "repr")
+QDEF(MP_QSTR_reverse, 10789, 7, "reverse")
+QDEF(MP_QSTR_rfind, 40146, 5, "rfind")
+QDEF(MP_QSTR_rindex, 11241, 6, "rindex")
+QDEF(MP_QSTR_round, 9703, 5, "round")
+QDEF(MP_QSTR_rsplit, 165, 6, "rsplit")
+QDEF(MP_QSTR_rstrip, 38203, 6, "rstrip")
+QDEF(MP_QSTR_self, 30585, 4, "self")
+QDEF(MP_QSTR_send, 30393, 4, "send")
+QDEF(MP_QSTR_sep, 36643, 3, "sep")
+QDEF(MP_QSTR_set, 36647, 3, "set")
+QDEF(MP_QSTR_setattr, 43220, 7, "setattr")
+QDEF(MP_QSTR_setdefault, 41836, 10, "setdefault")
+QDEF(MP_QSTR_sort, 40383, 4, "sort")
+QDEF(MP_QSTR_sorted, 5470, 6, "sorted")
+QDEF(MP_QSTR_split, 13239, 5, "split")
+QDEF(MP_QSTR_start, 61317, 5, "start")
+QDEF(MP_QSTR_startswith, 59508, 10, "startswith")
+QDEF(MP_QSTR_staticmethod, 44898, 12, "staticmethod")
+QDEF(MP_QSTR_step, 13911, 4, "step")
+QDEF(MP_QSTR_stop, 13981, 4, "stop")
+QDEF(MP_QSTR_str, 36176, 3, "str")
+QDEF(MP_QSTR_strip, 7721, 5, "strip")
+QDEF(MP_QSTR_sum, 36142, 3, "sum")
+QDEF(MP_QSTR_super, 45764, 5, "super")
+QDEF(MP_QSTR_throw, 17587, 5, "throw")
+QDEF(MP_QSTR_to_bytes, 16088, 8, "to_bytes")
+QDEF(MP_QSTR_tuple, 16893, 5, "tuple")
+QDEF(MP_QSTR_type, 32669, 4, "type")
+QDEF(MP_QSTR_update, 30388, 6, "update")
+QDEF(MP_QSTR_upper, 37927, 5, "upper")
+QDEF(MP_QSTR_utf_hyphen_8, 33463, 5, "utf-8")
+QDEF(MP_QSTR_value, 13390, 5, "value")
+QDEF(MP_QSTR_values, 48765, 6, "values")
+QDEF(MP_QSTR_write, 43160, 5, "write")
+QDEF(MP_QSTR_zip, 44262, 3, "zip")
+QDEF(MP_QSTR___add__, 33476, 7, "__add__")
+QDEF(MP_QSTR___aenter__, 33868, 10, "__aenter__")
+QDEF(MP_QSTR___aexit__, 53188, 9, "__aexit__")
+QDEF(MP_QSTR___aiter__, 11086, 9, "__aiter__")
+QDEF(MP_QSTR___anext__, 46211, 9, "__anext__")
+QDEF(MP_QSTR___bases__, 12291, 9, "__bases__")
+QDEF(MP_QSTR___bool__, 25899, 8, "__bool__")
+QDEF(MP_QSTR___build_class__, 34882, 15, "__build_class__")
+QDEF(MP_QSTR___contains__, 24518, 12, "__contains__")
+QDEF(MP_QSTR___del__, 14184, 7, "__del__")
+QDEF(MP_QSTR___dict__, 21631, 8, "__dict__")
+QDEF(MP_QSTR___eq__, 15985, 6, "__eq__")
+QDEF(MP_QSTR___file__, 21507, 8, "__file__")
+QDEF(MP_QSTR___ge__, 18087, 6, "__ge__")
+QDEF(MP_QSTR___gt__, 33462, 6, "__gt__")
+QDEF(MP_QSTR___iadd__, 19053, 8, "__iadd__")
+QDEF(MP_QSTR___iand__, 8615, 8, "__iand__")
+QDEF(MP_QSTR___ifloordiv__, 3919, 13, "__ifloordiv__")
+QDEF(MP_QSTR___ilshift__, 41600, 11, "__ilshift__")
+QDEF(MP_QSTR___imatmul__, 28352, 11, "__imatmul__")
+QDEF(MP_QSTR___imod__, 34378, 8, "__imod__")
+QDEF(MP_QSTR___import__, 15928, 10, "__import__")
+QDEF(MP_QSTR___imul__, 52760, 8, "__imul__")
+QDEF(MP_QSTR___ior__, 36849, 7, "__ior__")
+QDEF(MP_QSTR___ipow__, 54660, 8, "__ipow__")
+QDEF(MP_QSTR___irshift__, 63710, 11, "__irshift__")
+QDEF(MP_QSTR___isub__, 30728, 8, "__isub__")
+QDEF(MP_QSTR___itruediv__, 545, 12, "__itruediv__")
+QDEF(MP_QSTR___ixor__, 47369, 8, "__ixor__")
+QDEF(MP_QSTR___le__, 5068, 6, "__le__")
+QDEF(MP_QSTR___lt__, 26717, 6, "__lt__")
+QDEF(MP_QSTR___ne__, 2830, 6, "__ne__")
+QDEF(MP_QSTR___path__, 9160, 8, "__path__")
+QDEF(MP_QSTR___repl_print__, 47872, 14, "__repl_print__")
+QDEF(MP_QSTR___reversed__, 65377, 12, "__reversed__")
+QDEF(MP_QSTR___sub__, 2337, 7, "__sub__")
+QDEF(MP_QSTR___traceback__, 53071, 13, "__traceback__")
+QDEF(MP_QSTR__percent__hash_o, 6764, 3, "%#o")
+QDEF(MP_QSTR__percent__hash_x, 6779, 3, "%#x")
+QDEF(MP_QSTR__brace_open__colon__hash_b_brace_close_, 14168, 5, "{:#b}")
+QDEF(MP_QSTR_maximum_space_recursion_space_depth_space_exceeded, 7795, 32, "maximum recursion depth exceeded")
+QDEF(MP_QSTR__lt_lambda_gt_, 35968, 8, "")
+QDEF(MP_QSTR__lt_listcomp_gt_, 5588, 10, "")
+QDEF(MP_QSTR__lt_dictcomp_gt_, 36300, 10, "")
+QDEF(MP_QSTR__lt_setcomp_gt_, 20820, 9, "")
+QDEF(MP_QSTR__lt_genexpr_gt_, 27188, 9, "")
+QDEF(MP_QSTR__lt_string_gt_, 21330, 8, "")
+QDEF(MP_QSTR__lt_stdin_gt_, 25571, 7, "")
+QDEF(MP_QSTR_A0, 29268, 2, "A0")
+QDEF(MP_QSTR_A1, 29269, 2, "A1")
+QDEF(MP_QSTR_A10, 48325, 3, "A10")
+QDEF(MP_QSTR_A11, 48324, 3, "A11")
+QDEF(MP_QSTR_A12, 48327, 3, "A12")
+QDEF(MP_QSTR_A13, 48326, 3, "A13")
+QDEF(MP_QSTR_A14, 48321, 3, "A14")
+QDEF(MP_QSTR_A15, 48320, 3, "A15")
+QDEF(MP_QSTR_A2, 29270, 2, "A2")
+QDEF(MP_QSTR_A3, 29271, 2, "A3")
+QDEF(MP_QSTR_A4, 29264, 2, "A4")
+QDEF(MP_QSTR_A5, 29265, 2, "A5")
+QDEF(MP_QSTR_A6, 29266, 2, "A6")
+QDEF(MP_QSTR_A7, 29267, 2, "A7")
+QDEF(MP_QSTR_A8, 29276, 2, "A8")
+QDEF(MP_QSTR_A9, 29277, 2, "A9")
+QDEF(MP_QSTR_B0, 29431, 2, "B0")
+QDEF(MP_QSTR_B1, 29430, 2, "B1")
+QDEF(MP_QSTR_B10, 53638, 3, "B10")
+QDEF(MP_QSTR_B11, 53639, 3, "B11")
+QDEF(MP_QSTR_B12, 53636, 3, "B12")
+QDEF(MP_QSTR_B13, 53637, 3, "B13")
+QDEF(MP_QSTR_B14, 53634, 3, "B14")
+QDEF(MP_QSTR_B15, 53635, 3, "B15")
+QDEF(MP_QSTR_B2, 29429, 2, "B2")
+QDEF(MP_QSTR_B3, 29428, 2, "B3")
+QDEF(MP_QSTR_B4, 29427, 2, "B4")
+QDEF(MP_QSTR_B5, 29426, 2, "B5")
+QDEF(MP_QSTR_B6, 29425, 2, "B6")
+QDEF(MP_QSTR_B7, 29424, 2, "B7")
+QDEF(MP_QSTR_B8, 29439, 2, "B8")
+QDEF(MP_QSTR_B9, 29438, 2, "B9")
+QDEF(MP_QSTR_C0, 29334, 2, "C0")
+QDEF(MP_QSTR_C1, 29335, 2, "C1")
+QDEF(MP_QSTR_C10, 50503, 3, "C10")
+QDEF(MP_QSTR_C11, 50502, 3, "C11")
+QDEF(MP_QSTR_C12, 50501, 3, "C12")
+QDEF(MP_QSTR_C13, 50500, 3, "C13")
+QDEF(MP_QSTR_C14, 50499, 3, "C14")
+QDEF(MP_QSTR_C15, 50498, 3, "C15")
+QDEF(MP_QSTR_C2, 29332, 2, "C2")
+QDEF(MP_QSTR_C3, 29333, 2, "C3")
+QDEF(MP_QSTR_C4, 29330, 2, "C4")
+QDEF(MP_QSTR_C5, 29331, 2, "C5")
+QDEF(MP_QSTR_C6, 29328, 2, "C6")
+QDEF(MP_QSTR_C7, 29329, 2, "C7")
+QDEF(MP_QSTR_C8, 29342, 2, "C8")
+QDEF(MP_QSTR_C9, 29343, 2, "C9")
+QDEF(MP_QSTR_D2, 29235, 2, "D2")
+QDEF(MP_QSTR_FileIO, 5573, 6, "FileIO")
+QDEF(MP_QSTR_IN, 29474, 2, "IN")
+QDEF(MP_QSTR_IN_PULLDOWN, 47946, 11, "IN_PULLDOWN")
+QDEF(MP_QSTR_IN_PULLUP, 55837, 9, "IN_PULLUP")
+QDEF(MP_QSTR_IRQ_FALLING, 49207, 11, "IRQ_FALLING")
+QDEF(MP_QSTR_IRQ_RISING, 60792, 10, "IRQ_RISING")
+QDEF(MP_QSTR_KEY1, 4963, 4, "KEY1")
+QDEF(MP_QSTR_KEY2, 4960, 4, "KEY2")
+QDEF(MP_QSTR_LED, 56456, 3, "LED")
+QDEF(MP_QSTR_LockType, 8246, 8, "LockType")
+QDEF(MP_QSTR_ONE_SHOT, 65374, 8, "ONE_SHOT")
+QDEF(MP_QSTR_OPEN_DRAIN, 18526, 10, "OPEN_DRAIN")
+QDEF(MP_QSTR_OUT, 58123, 3, "OUT")
+QDEF(MP_QSTR_PERIODIC, 13578, 8, "PERIODIC")
+QDEF(MP_QSTR_Pin, 5138, 3, "Pin")
+QDEF(MP_QSTR_PinBase, 17223, 7, "PinBase")
+QDEF(MP_QSTR_Signal, 58523, 6, "Signal")
+QDEF(MP_QSTR_StopAsyncIteration, 61676, 18, "StopAsyncIteration")
+QDEF(MP_QSTR_Timer, 8098, 5, "Timer")
+QDEF(MP_QSTR_UART, 6583, 4, "UART")
+QDEF(MP_QSTR__machine, 19391, 8, "_machine")
+QDEF(MP_QSTR__thread, 724, 7, "_thread")
+QDEF(MP_QSTR_acos, 40987, 4, "acos")
+QDEF(MP_QSTR_acquire, 54045, 7, "acquire")
+QDEF(MP_QSTR_add, 12868, 3, "add")
+QDEF(MP_QSTR_alloc_emergency_exception_buf, 10872, 29, "alloc_emergency_exception_buf")
+QDEF(MP_QSTR_allocate_lock, 60908, 13, "allocate_lock")
+QDEF(MP_QSTR_argv, 50887, 4, "argv")
+QDEF(MP_QSTR_array, 29308, 5, "array")
+QDEF(MP_QSTR_asin, 58704, 4, "asin")
+QDEF(MP_QSTR_atan, 48671, 4, "atan")
+QDEF(MP_QSTR_atan2, 33229, 5, "atan2")
+QDEF(MP_QSTR_bin, 18656, 3, "bin")
+QDEF(MP_QSTR_bound_method, 41623, 12, "bound_method")
+QDEF(MP_QSTR_buffer, 41189, 6, "buffer")
+QDEF(MP_QSTR_byteorder, 39265, 9, "byteorder")
+QDEF(MP_QSTR_calcsize, 14413, 8, "calcsize")
+QDEF(MP_QSTR_callback, 61516, 8, "callback")
+QDEF(MP_QSTR_ceil, 45062, 4, "ceil")
+QDEF(MP_QSTR_closure, 51828, 7, "closure")
+QDEF(MP_QSTR_collect, 26011, 7, "collect")
+QDEF(MP_QSTR_complex, 40389, 7, "complex")
+QDEF(MP_QSTR_copysign, 5171, 8, "copysign")
+QDEF(MP_QSTR_cos, 19578, 3, "cos")
+QDEF(MP_QSTR_decode, 22953, 6, "decode")
+QDEF(MP_QSTR_default, 32206, 7, "default")
+QDEF(MP_QSTR_degrees, 16642, 7, "degrees")
+QDEF(MP_QSTR_deinit, 36254, 6, "deinit")
+QDEF(MP_QSTR_delattr, 51419, 7, "delattr")
+QDEF(MP_QSTR_deleter, 56174, 7, "deleter")
+QDEF(MP_QSTR_dict_view, 43309, 9, "dict_view")
+QDEF(MP_QSTR_difference, 9330, 10, "difference")
+QDEF(MP_QSTR_difference_update, 64156, 17, "difference_update")
+QDEF(MP_QSTR_disable, 30353, 7, "disable")
+QDEF(MP_QSTR_discard, 28943, 7, "discard")
+QDEF(MP_QSTR_doc, 7981, 3, "doc")
+QDEF(MP_QSTR_e, 46528, 1, "e")
+QDEF(MP_QSTR_enable, 56836, 6, "enable")
+QDEF(MP_QSTR_encode, 51779, 6, "encode")
+QDEF(MP_QSTR_enumerate, 47729, 9, "enumerate")
+QDEF(MP_QSTR_errno, 4545, 5, "errno")
+QDEF(MP_QSTR_exit, 48773, 4, "exit")
+QDEF(MP_QSTR_exp, 9416, 3, "exp")
+QDEF(MP_QSTR_fabs, 4755, 4, "fabs")
+QDEF(MP_QSTR_filter, 48677, 6, "filter")
+QDEF(MP_QSTR_float, 17461, 5, "float")
+QDEF(MP_QSTR_floor, 18045, 5, "floor")
+QDEF(MP_QSTR_fmod, 17637, 4, "fmod")
+QDEF(MP_QSTR_freq, 15077, 4, "freq")
+QDEF(MP_QSTR_frexp, 38940, 5, "frexp")
+QDEF(MP_QSTR_fromkeys, 48439, 8, "fromkeys")
+QDEF(MP_QSTR_function, 551, 8, "function")
+QDEF(MP_QSTR_gc, 28257, 2, "gc")
+QDEF(MP_QSTR_generator, 50070, 9, "generator")
+QDEF(MP_QSTR_get_ident, 45566, 9, "get_ident")
+QDEF(MP_QSTR_getter, 45712, 6, "getter")
+QDEF(MP_QSTR_handler, 24029, 7, "handler")
+QDEF(MP_QSTR_heap_lock, 36013, 9, "heap_lock")
+QDEF(MP_QSTR_heap_unlock, 11606, 11, "heap_unlock")
+QDEF(MP_QSTR_help, 23700, 4, "help")
+QDEF(MP_QSTR_hex, 20592, 3, "hex")
+QDEF(MP_QSTR_imag, 46919, 4, "imag")
+QDEF(MP_QSTR_implementation, 11543, 14, "implementation")
+QDEF(MP_QSTR_init, 46111, 4, "init")
+QDEF(MP_QSTR_intersection, 10792, 12, "intersection")
+QDEF(MP_QSTR_intersection_update, 56582, 19, "intersection_update")
+QDEF(MP_QSTR_invert, 183, 6, "invert")
+QDEF(MP_QSTR_irq, 22159, 3, "irq")
+QDEF(MP_QSTR_isdisjoint, 26871, 10, "isdisjoint")
+QDEF(MP_QSTR_isenabled, 58778, 9, "isenabled")
+QDEF(MP_QSTR_isfinite, 43942, 8, "isfinite")
+QDEF(MP_QSTR_isinf, 4414, 5, "isinf")
+QDEF(MP_QSTR_isnan, 926, 5, "isnan")
+QDEF(MP_QSTR_issubset, 49593, 8, "issubset")
+QDEF(MP_QSTR_issuperset, 60668, 10, "issuperset")
+QDEF(MP_QSTR_iterable, 37413, 8, "iterable")
+QDEF(MP_QSTR_iterator, 48711, 8, "iterator")
+QDEF(MP_QSTR_kbd_intr, 5110, 8, "kbd_intr")
+QDEF(MP_QSTR_ldexp, 28480, 5, "ldexp")
+QDEF(MP_QSTR_lock, 9134, 4, "lock")
+QDEF(MP_QSTR_locked, 47631, 6, "locked")
+QDEF(MP_QSTR_log, 16161, 3, "log")
+QDEF(MP_QSTR_math, 47925, 4, "math")
+QDEF(MP_QSTR_max, 17329, 3, "max")
+QDEF(MP_QSTR_mem, 17440, 3, "mem")
+QDEF(MP_QSTR_mem16, 51719, 5, "mem16")
+QDEF(MP_QSTR_mem32, 51777, 5, "mem32")
+QDEF(MP_QSTR_mem8, 51224, 4, "mem8")
+QDEF(MP_QSTR_mem_alloc, 11090, 9, "mem_alloc")
+QDEF(MP_QSTR_mem_free, 25291, 8, "mem_free")
+QDEF(MP_QSTR_min, 17071, 3, "min")
+QDEF(MP_QSTR_mode, 49190, 4, "mode")
+QDEF(MP_QSTR_modf, 49189, 4, "modf")
+QDEF(MP_QSTR_module, 39359, 6, "module")
+QDEF(MP_QSTR_modules, 53740, 7, "modules")
+QDEF(MP_QSTR_name, 30114, 4, "name")
+QDEF(MP_QSTR_namedtuple, 5662, 10, "namedtuple")
+QDEF(MP_QSTR_oct, 23805, 3, "oct")
+QDEF(MP_QSTR_off, 23690, 3, "off")
+QDEF(MP_QSTR_on, 28516, 2, "on")
+QDEF(MP_QSTR_opt_level, 26503, 9, "opt_level")
+QDEF(MP_QSTR_pack, 53692, 4, "pack")
+QDEF(MP_QSTR_pack_into, 43295, 9, "pack_into")
+QDEF(MP_QSTR_path, 52872, 4, "path")
+QDEF(MP_QSTR_pend_throw, 29939, 10, "pend_throw")
+QDEF(MP_QSTR_period, 41120, 6, "period")
+QDEF(MP_QSTR_pi, 28700, 2, "pi")
+QDEF(MP_QSTR_platform, 6458, 8, "platform")
+QDEF(MP_QSTR_print_exception, 8732, 15, "print_exception")
+QDEF(MP_QSTR_property, 10690, 8, "property")
+QDEF(MP_QSTR_radians, 16263, 7, "radians")
+QDEF(MP_QSTR_readlines, 22890, 9, "readlines")
+QDEF(MP_QSTR_real, 63935, 4, "real")
+QDEF(MP_QSTR_release, 36844, 7, "release")
+QDEF(MP_QSTR_reversed, 28321, 8, "reversed")
+QDEF(MP_QSTR_rxbuf, 26494, 5, "rxbuf")
+QDEF(MP_QSTR_schedule, 44256, 8, "schedule")
+QDEF(MP_QSTR_setter, 22788, 6, "setter")
+QDEF(MP_QSTR_sin, 37041, 3, "sin")
+QDEF(MP_QSTR_sleep, 10218, 5, "sleep")
+QDEF(MP_QSTR_sleep_ms, 25355, 8, "sleep_ms")
+QDEF(MP_QSTR_slice, 62645, 5, "slice")
+QDEF(MP_QSTR_soft_reset, 26081, 10, "soft_reset")
+QDEF(MP_QSTR_sqrt, 17441, 4, "sqrt")
+QDEF(MP_QSTR_stack_size, 15153, 10, "stack_size")
+QDEF(MP_QSTR_start_new_thread, 9687, 16, "start_new_thread")
+QDEF(MP_QSTR_symmetric_difference, 26574, 20, "symmetric_difference")
+QDEF(MP_QSTR_symmetric_difference_update, 63584, 27, "symmetric_difference_update")
+QDEF(MP_QSTR_sys, 36540, 3, "sys")
+QDEF(MP_QSTR_tan, 25086, 3, "tan")
+QDEF(MP_QSTR_threshold, 12274, 9, "threshold")
+QDEF(MP_QSTR_tick_hz, 56189, 7, "tick_hz")
+QDEF(MP_QSTR_ticks_add, 44701, 9, "ticks_add")
+QDEF(MP_QSTR_ticks_cpu, 42266, 9, "ticks_cpu")
+QDEF(MP_QSTR_ticks_diff, 57521, 10, "ticks_diff")
+QDEF(MP_QSTR_ticks_ms, 12866, 8, "ticks_ms")
+QDEF(MP_QSTR_timeout, 21566, 7, "timeout")
+QDEF(MP_QSTR_timeout_char, 19065, 12, "timeout_char")
+QDEF(MP_QSTR_trigger, 35997, 7, "trigger")
+QDEF(MP_QSTR_trunc, 39259, 5, "trunc")
+QDEF(MP_QSTR_uarray, 34441, 6, "uarray")
+QDEF(MP_QSTR_ucollections, 39445, 12, "ucollections")
+QDEF(MP_QSTR_umachine, 32661, 8, "umachine")
+QDEF(MP_QSTR_union, 31990, 5, "union")
+QDEF(MP_QSTR_unpack, 15367, 6, "unpack")
+QDEF(MP_QSTR_unpack_from, 27918, 11, "unpack_from")
+QDEF(MP_QSTR_ustruct, 2119, 7, "ustruct")
+QDEF(MP_QSTR_usys, 62409, 4, "usys")
+QDEF(MP_QSTR_utime, 40421, 5, "utime")
+QDEF(MP_QSTR_version, 54207, 7, "version")
+QDEF(MP_QSTR_version_info, 2670, 12, "version_info")
diff --git a/board/BearPi_STM32L431RC/KEIL/micropython_basic_demo/startup_stm32l431xx.s b/board/BearPi_STM32L431RC/KEIL/micropython_basic_demo/startup_stm32l431xx.s
new file mode 100644
index 00000000..6a5c15a5
--- /dev/null
+++ b/board/BearPi_STM32L431RC/KEIL/micropython_basic_demo/startup_stm32l431xx.s
@@ -0,0 +1,404 @@
+;********************** COPYRIGHT(c) 2017 STMicroelectronics ******************
+;* File Name : startup_stm32l431xx.s
+;* Author : MCD Application Team
+;* Description : STM32L431xx Ultra Low Power devices vector table for MDK-ARM toolchain.
+;* This module performs:
+;* - Set the initial SP
+;* - Set the initial PC == Reset_Handler
+;* - Set the vector table entries with the exceptions ISR address
+;* - Branches to __main in the C library (which eventually
+;* calls main()).
+;* After Reset the Cortex-M4 processor is in Thread mode,
+;* priority is Privileged, and the Stack is set to Main.
+;* <<< Use Configuration Wizard in Context Menu >>>
+;*******************************************************************************
+;*
+;* Redistribution and use in source and binary forms, with or without modification,
+;* are permitted provided that the following conditions are met:
+;* 1. Redistributions of source code must retain the above copyright notice,
+;* this list of conditions and the following disclaimer.
+;* 2. Redistributions in binary form must reproduce the above copyright notice,
+;* this list of conditions and the following disclaimer in the documentation
+;* and/or other materials provided with the distribution.
+;* 3. Neither the name of STMicroelectronics nor the names of its contributors
+;* may be used to endorse or promote products derived from this software
+;* without specific prior written permission.
+;*
+;* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+;* AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+;* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+;* DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
+;* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+;* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
+;* SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
+;* CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
+;* OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+;* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+;*
+;*******************************************************************************
+;
+; Amount of memory (in bytes) allocated for Stack
+; Tailor this value to your application needs
+; Stack Configuration
+; Stack Size (in Bytes) <0x0-0xFFFFFFFF:8>
+;
+
+Stack_Size EQU 0x100
+
+ AREA STACK, NOINIT, READWRITE, ALIGN=3
+Stack_Mem SPACE Stack_Size
+__initial_sp
+
+
+; Heap Configuration
+; Heap Size (in Bytes) <0x0-0xFFFFFFFF:8>
+;
+
+Heap_Size EQU 0x100
+
+ AREA HEAP, NOINIT, READWRITE, ALIGN=3
+__heap_base
+Heap_Mem SPACE Heap_Size
+__heap_limit
+
+ PRESERVE8
+ THUMB
+
+
+; Vector Table Mapped to Address 0 at Reset
+ AREA RESET, DATA, READONLY
+ EXPORT __Vectors
+ EXPORT __Vectors_End
+ EXPORT __Vectors_Size
+
+__Vectors DCD __initial_sp ; Top of Stack
+ DCD Reset_Handler ; Reset Handler
+ DCD NMI_Handler ; NMI Handler
+ DCD HardFault_Handler ; Hard Fault Handler
+ DCD MemManage_Handler ; MPU Fault Handler
+ DCD BusFault_Handler ; Bus Fault Handler
+ DCD UsageFault_Handler ; Usage Fault Handler
+ DCD 0 ; Reserved
+ DCD 0 ; Reserved
+ DCD 0 ; Reserved
+ DCD 0 ; Reserved
+ DCD SVC_Handler ; SVCall Handler
+ DCD DebugMon_Handler ; Debug Monitor Handler
+ DCD 0 ; Reserved
+ DCD PendSV_Handler ; PendSV Handler
+ DCD SysTick_Handler ; SysTick Handler
+
+ ; External Interrupts
+ DCD WWDG_IRQHandler ; Window WatchDog
+ DCD PVD_PVM_IRQHandler ; PVD/PVM1/PVM2/PVM3/PVM4 through EXTI Line detection
+ DCD TAMP_STAMP_IRQHandler ; Tamper and TimeStamps through the EXTI line
+ DCD RTC_WKUP_IRQHandler ; RTC Wakeup through the EXTI line
+ DCD FLASH_IRQHandler ; FLASH
+ DCD RCC_IRQHandler ; RCC
+ DCD EXTI0_IRQHandler ; EXTI Line0
+ DCD EXTI1_IRQHandler ; EXTI Line1
+ DCD EXTI2_IRQHandler ; EXTI Line2
+ DCD EXTI3_IRQHandler ; EXTI Line3
+ DCD EXTI4_IRQHandler ; EXTI Line4
+ DCD DMA1_Channel1_IRQHandler ; DMA1 Channel 1
+ DCD DMA1_Channel2_IRQHandler ; DMA1 Channel 2
+ DCD DMA1_Channel3_IRQHandler ; DMA1 Channel 3
+ DCD DMA1_Channel4_IRQHandler ; DMA1 Channel 4
+ DCD DMA1_Channel5_IRQHandler ; DMA1 Channel 5
+ DCD DMA1_Channel6_IRQHandler ; DMA1 Channel 6
+ DCD DMA1_Channel7_IRQHandler ; DMA1 Channel 7
+ DCD ADC1_IRQHandler ; ADC1
+ DCD CAN1_TX_IRQHandler ; CAN1 TX
+ DCD CAN1_RX0_IRQHandler ; CAN1 RX0
+ DCD CAN1_RX1_IRQHandler ; CAN1 RX1
+ DCD CAN1_SCE_IRQHandler ; CAN1 SCE
+ DCD EXTI9_5_IRQHandler ; External Line[9:5]s
+ DCD TIM1_BRK_TIM15_IRQHandler ; TIM1 Break and TIM15
+ DCD TIM1_UP_TIM16_IRQHandler ; TIM1 Update and TIM16
+ DCD TIM1_TRG_COM_IRQHandler ; TIM1 Trigger and Commutation
+ DCD TIM1_CC_IRQHandler ; TIM1 Capture Compare
+ DCD TIM2_IRQHandler ; TIM2
+ DCD 0 ; Reserved
+ DCD 0 ; Reserved
+ DCD I2C1_EV_IRQHandler ; I2C1 Event
+ DCD I2C1_ER_IRQHandler ; I2C1 Error
+ DCD I2C2_EV_IRQHandler ; I2C2 Event
+ DCD I2C2_ER_IRQHandler ; I2C2 Error
+ DCD SPI1_IRQHandler ; SPI1
+ DCD SPI2_IRQHandler ; SPI2
+ DCD USART1_IRQHandler ; USART1
+ DCD USART2_IRQHandler ; USART2
+ DCD USART3_IRQHandler ; USART3
+ DCD EXTI15_10_IRQHandler ; External Line[15:10]
+ DCD RTC_Alarm_IRQHandler ; RTC Alarm (A and B) through EXTI Line
+ DCD 0 ; Reserved
+ DCD 0 ; Reserved
+ DCD 0 ; Reserved
+ DCD 0 ; Reserved
+ DCD 0 ; Reserved
+ DCD 0 ; Reserved
+ DCD 0 ; Reserved
+ DCD SDMMC1_IRQHandler ; SDMMC1
+ DCD 0 ; Reserved
+ DCD SPI3_IRQHandler ; SPI3
+ DCD 0 ; Reserved
+ DCD 0 ; Reserved
+ DCD TIM6_DAC_IRQHandler ; TIM6 and DAC1&2 underrun errors
+ DCD TIM7_IRQHandler ; TIM7
+ DCD DMA2_Channel1_IRQHandler ; DMA2 Channel 1
+ DCD DMA2_Channel2_IRQHandler ; DMA2 Channel 2
+ DCD DMA2_Channel3_IRQHandler ; DMA2 Channel 3
+ DCD DMA2_Channel4_IRQHandler ; DMA2 Channel 4
+ DCD DMA2_Channel5_IRQHandler ; DMA2 Channel 5
+ DCD 0 ; Reserved
+ DCD 0 ; Reserved
+ DCD 0 ; Reserved
+ DCD COMP_IRQHandler ; COMP Interrupt
+ DCD LPTIM1_IRQHandler ; LP TIM1 interrupt
+ DCD LPTIM2_IRQHandler ; LP TIM2 interrupt
+ DCD 0 ; Reserved
+ DCD DMA2_Channel6_IRQHandler ; DMA2 Channel 6
+ DCD DMA2_Channel7_IRQHandler ; DMA2 Channel 7
+ DCD LPUART1_IRQHandler ; LP UART1 interrupt
+ DCD QUADSPI_IRQHandler ; Quad SPI global interrupt
+ DCD I2C3_EV_IRQHandler ; I2C3 event
+ DCD I2C3_ER_IRQHandler ; I2C3 error
+ DCD SAI1_IRQHandler ; Serial Audio Interface 1 global interrupt
+ DCD 0 ; Reserved
+ DCD SWPMI1_IRQHandler ; Serial Wire Interface 1 global interrupt
+ DCD TSC_IRQHandler ; Touch Sense Controller global interrupt
+ DCD 0 ; Reserved
+ DCD 0 ; Reserved
+ DCD RNG_IRQHandler ; RNG global interrupt
+ DCD FPU_IRQHandler ; FPU
+ DCD CRS_IRQHandler ; CRS interrupt
+
+__Vectors_End
+
+__Vectors_Size EQU __Vectors_End - __Vectors
+
+ AREA |.text|, CODE, READONLY
+
+; Reset handler
+Reset_Handler PROC
+ EXPORT Reset_Handler [WEAK]
+ IMPORT SystemInit
+ IMPORT __main
+
+ LDR R0, =SystemInit
+ BLX R0
+ LDR R0, =__main
+ BX R0
+ ENDP
+
+; Dummy Exception Handlers (infinite loops which can be modified)
+
+NMI_Handler PROC
+ EXPORT NMI_Handler [WEAK]
+ B .
+ ENDP
+HardFault_Handler\
+ PROC
+ EXPORT HardFault_Handler [WEAK]
+ B .
+ ENDP
+MemManage_Handler\
+ PROC
+ EXPORT MemManage_Handler [WEAK]
+ B .
+ ENDP
+BusFault_Handler\
+ PROC
+ EXPORT BusFault_Handler [WEAK]
+ B .
+ ENDP
+UsageFault_Handler\
+ PROC
+ EXPORT UsageFault_Handler [WEAK]
+ B .
+ ENDP
+SVC_Handler PROC
+ EXPORT SVC_Handler [WEAK]
+ B .
+ ENDP
+DebugMon_Handler\
+ PROC
+ EXPORT DebugMon_Handler [WEAK]
+ B .
+ ENDP
+PendSV_Handler PROC
+ EXPORT PendSV_Handler [WEAK]
+ B .
+ ENDP
+SysTick_Handler PROC
+ EXPORT SysTick_Handler [WEAK]
+ B .
+ ENDP
+
+Default_Handler PROC
+
+ EXPORT WWDG_IRQHandler [WEAK]
+ EXPORT PVD_PVM_IRQHandler [WEAK]
+ EXPORT TAMP_STAMP_IRQHandler [WEAK]
+ EXPORT RTC_WKUP_IRQHandler [WEAK]
+ EXPORT FLASH_IRQHandler [WEAK]
+ EXPORT RCC_IRQHandler [WEAK]
+ EXPORT EXTI0_IRQHandler [WEAK]
+ EXPORT EXTI1_IRQHandler [WEAK]
+ EXPORT EXTI2_IRQHandler [WEAK]
+ EXPORT EXTI3_IRQHandler [WEAK]
+ EXPORT EXTI4_IRQHandler [WEAK]
+ EXPORT DMA1_Channel1_IRQHandler [WEAK]
+ EXPORT DMA1_Channel2_IRQHandler [WEAK]
+ EXPORT DMA1_Channel3_IRQHandler [WEAK]
+ EXPORT DMA1_Channel4_IRQHandler [WEAK]
+ EXPORT DMA1_Channel5_IRQHandler [WEAK]
+ EXPORT DMA1_Channel6_IRQHandler [WEAK]
+ EXPORT DMA1_Channel7_IRQHandler [WEAK]
+ EXPORT ADC1_IRQHandler [WEAK]
+ EXPORT CAN1_TX_IRQHandler [WEAK]
+ EXPORT CAN1_RX0_IRQHandler [WEAK]
+ EXPORT CAN1_RX1_IRQHandler [WEAK]
+ EXPORT CAN1_SCE_IRQHandler [WEAK]
+ EXPORT EXTI9_5_IRQHandler [WEAK]
+ EXPORT TIM1_BRK_TIM15_IRQHandler [WEAK]
+ EXPORT TIM1_UP_TIM16_IRQHandler [WEAK]
+ EXPORT TIM1_TRG_COM_IRQHandler [WEAK]
+ EXPORT TIM1_CC_IRQHandler [WEAK]
+ EXPORT TIM2_IRQHandler [WEAK]
+ EXPORT I2C1_EV_IRQHandler [WEAK]
+ EXPORT I2C1_ER_IRQHandler [WEAK]
+ EXPORT I2C2_EV_IRQHandler [WEAK]
+ EXPORT I2C2_ER_IRQHandler [WEAK]
+ EXPORT SPI1_IRQHandler [WEAK]
+ EXPORT SPI2_IRQHandler [WEAK]
+ EXPORT USART1_IRQHandler [WEAK]
+ EXPORT USART2_IRQHandler [WEAK]
+ EXPORT USART3_IRQHandler [WEAK]
+ EXPORT EXTI15_10_IRQHandler [WEAK]
+ EXPORT RTC_Alarm_IRQHandler [WEAK]
+ EXPORT SDMMC1_IRQHandler [WEAK]
+ EXPORT SPI3_IRQHandler [WEAK]
+ EXPORT TIM6_DAC_IRQHandler [WEAK]
+ EXPORT TIM7_IRQHandler [WEAK]
+ EXPORT DMA2_Channel1_IRQHandler [WEAK]
+ EXPORT DMA2_Channel2_IRQHandler [WEAK]
+ EXPORT DMA2_Channel3_IRQHandler [WEAK]
+ EXPORT DMA2_Channel4_IRQHandler [WEAK]
+ EXPORT DMA2_Channel5_IRQHandler [WEAK]
+ EXPORT COMP_IRQHandler [WEAK]
+ EXPORT LPTIM1_IRQHandler [WEAK]
+ EXPORT LPTIM2_IRQHandler [WEAK]
+ EXPORT DMA2_Channel6_IRQHandler [WEAK]
+ EXPORT DMA2_Channel7_IRQHandler [WEAK]
+ EXPORT LPUART1_IRQHandler [WEAK]
+ EXPORT QUADSPI_IRQHandler [WEAK]
+ EXPORT I2C3_EV_IRQHandler [WEAK]
+ EXPORT I2C3_ER_IRQHandler [WEAK]
+ EXPORT SAI1_IRQHandler [WEAK]
+ EXPORT SWPMI1_IRQHandler [WEAK]
+ EXPORT TSC_IRQHandler [WEAK]
+ EXPORT RNG_IRQHandler [WEAK]
+ EXPORT FPU_IRQHandler [WEAK]
+ EXPORT CRS_IRQHandler [WEAK]
+
+WWDG_IRQHandler
+PVD_PVM_IRQHandler
+TAMP_STAMP_IRQHandler
+RTC_WKUP_IRQHandler
+FLASH_IRQHandler
+RCC_IRQHandler
+EXTI0_IRQHandler
+EXTI1_IRQHandler
+EXTI2_IRQHandler
+EXTI3_IRQHandler
+EXTI4_IRQHandler
+DMA1_Channel1_IRQHandler
+DMA1_Channel2_IRQHandler
+DMA1_Channel3_IRQHandler
+DMA1_Channel4_IRQHandler
+DMA1_Channel5_IRQHandler
+DMA1_Channel6_IRQHandler
+DMA1_Channel7_IRQHandler
+ADC1_IRQHandler
+CAN1_TX_IRQHandler
+CAN1_RX0_IRQHandler
+CAN1_RX1_IRQHandler
+CAN1_SCE_IRQHandler
+EXTI9_5_IRQHandler
+TIM1_BRK_TIM15_IRQHandler
+TIM1_UP_TIM16_IRQHandler
+TIM1_TRG_COM_IRQHandler
+TIM1_CC_IRQHandler
+TIM2_IRQHandler
+I2C1_EV_IRQHandler
+I2C1_ER_IRQHandler
+I2C2_EV_IRQHandler
+I2C2_ER_IRQHandler
+SPI1_IRQHandler
+SPI2_IRQHandler
+USART1_IRQHandler
+USART2_IRQHandler
+USART3_IRQHandler
+EXTI15_10_IRQHandler
+RTC_Alarm_IRQHandler
+SDMMC1_IRQHandler
+SPI3_IRQHandler
+TIM6_DAC_IRQHandler
+TIM7_IRQHandler
+DMA2_Channel1_IRQHandler
+DMA2_Channel2_IRQHandler
+DMA2_Channel3_IRQHandler
+DMA2_Channel4_IRQHandler
+DMA2_Channel5_IRQHandler
+COMP_IRQHandler
+LPTIM1_IRQHandler
+LPTIM2_IRQHandler
+DMA2_Channel6_IRQHandler
+DMA2_Channel7_IRQHandler
+LPUART1_IRQHandler
+QUADSPI_IRQHandler
+I2C3_EV_IRQHandler
+I2C3_ER_IRQHandler
+SAI1_IRQHandler
+SWPMI1_IRQHandler
+TSC_IRQHandler
+RNG_IRQHandler
+FPU_IRQHandler
+CRS_IRQHandler
+
+ B .
+
+ ENDP
+
+ ALIGN
+
+;*******************************************************************************
+; User Stack and Heap initialization
+;*******************************************************************************
+ IF :DEF:__MICROLIB
+
+ EXPORT __initial_sp
+ EXPORT __heap_base
+ EXPORT __heap_limit
+
+ ELSE
+
+ IMPORT __use_two_region_memory
+ EXPORT __user_initial_stackheap
+
+__user_initial_stackheap
+
+ LDR R0, = Heap_Mem
+ LDR R1, =(Stack_Mem + Stack_Size)
+ LDR R2, = (Heap_Mem + Heap_Size)
+ LDR R3, = Stack_Mem
+ BX LR
+
+ ALIGN
+
+ ENDIF
+
+ END
+
+;************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE*****
diff --git a/board/BearPi_STM32L431RC/KEIL/micropython_extra_demo/BearPi_STM32L31RC.uvoptx b/board/BearPi_STM32L431RC/KEIL/micropython_extra_demo/BearPi_STM32L31RC.uvoptx
new file mode 100644
index 00000000..6c457c36
--- /dev/null
+++ b/board/BearPi_STM32L431RC/KEIL/micropython_extra_demo/BearPi_STM32L31RC.uvoptx
@@ -0,0 +1,3519 @@
+
+
+
+ 1.0
+
+ ### uVision Project, (C) Keil Software
+
+
+ *.c
+ *.s*; *.src; *.a*
+ *.obj; *.o
+ *.lib
+ *.txt; *.h; *.inc
+ *.plm
+ *.cpp
+ 0
+
+
+
+ 0
+ 0
+
+
+
+ TencentOS_tiny
+ 0x4
+ ARM-ADS
+
+ 80000000
+
+ 1
+ 1
+ 0
+ 1
+ 0
+
+
+ 1
+ 65535
+ 0
+ 0
+ 0
+
+
+ 79
+ 66
+ 8
+ .\list\
+
+
+ 1
+ 1
+ 1
+ 0
+ 1
+ 1
+ 0
+ 1
+ 0
+ 0
+ 0
+ 0
+
+
+ 1
+ 1
+ 1
+ 1
+ 1
+ 1
+ 1
+ 0
+ 0
+
+
+ 1
+ 0
+ 1
+
+ 18
+
+ 0
+ 1
+ 1
+ 1
+ 1
+ 1
+ 1
+ 1
+ 1
+ 1
+ 1
+ 1
+ 1
+ 1
+ 1
+ 1
+ 1
+ 1
+ 1
+ 0
+ 0
+ 1
+ 0
+ 0
+ 6
+
+
+
+
+
+
+
+
+
+
+ STLink\ST-LINKIII-KEIL_SWO.dll
+
+
+
+ 0
+ ARMRTXEVENTFLAGS
+ -L70 -Z18 -C0 -M0 -T1
+
+
+ 0
+ DLGTARM
+ (1010=75,104,525,661,0)(1007=-1,-1,-1,-1,0)(1008=-1,-1,-1,-1,0)(1009=120,153,378,741,0)(1012=-1,-1,-1,-1,0)
+
+
+ 0
+ ARMDBGFLAGS
+
+
+
+ 0
+ DLGUARM
+ (105=-1,-1,-1,-1,0)
+
+
+ 0
+ UL2CM3
+ UL2CM3(-S0 -C0 -P0 -FD20000000 -FC1000 -FN1 -FF0STM32L4xx_256 -FS08000000 -FL040000 -FP0($$Device:STM32L431RCTx$CMSIS\Flash\STM32L4xx_256.FLM))
+
+
+ 0
+ ST-LINKIII-KEIL_SWO
+ -U066EFF3035344E5043163106 -O10446 -SF10000 -C0 -A0 -I0 -HNlocalhost -HP7184 -P1 -N00("ARM CoreSight SW-DP (ARM Core") -D00(2BA01477) -L00(0) -TO131090 -TC10000000 -TT10000000 -TP21 -TDS8007 -TDT0 -TDC1F -TIEFFFFFFFF -TIP8 -FO15 -FD20000000 -FC8000 -FN2 -FF0STM32L4xx_256.FLM -FS08000000 -FL040000 -FP0($$Device:STM32L431RCTx$CMSIS\Flash\STM32L4xx_256.FLM) -FF1BearPi_W25Q64JV -FS190000000 -FL1800000
+
+
+
+
+
+ 0
+ 1
+ tos_next_task
+
+
+ 1
+ 1
+ tos_rdyq.highest_prio
+
+
+ 2
+ 1
+ task_list
+
+
+ 3
+ 1
+ 0x20000280,0x10
+
+
+ 4
+ 1
+ tos_rdyq.highest_prio
+
+
+ 5
+ 1
+ owner
+
+
+ 6
+ 1
+ tos_curr_task
+
+
+ 7
+ 1
+ highest_pending_prio
+
+
+ 8
+ 1
+ task
+
+
+
+ 0
+
+
+ 0
+ 1
+ 1
+ 0
+ 0
+ 0
+ 0
+ 1
+ 0
+ 0
+ 0
+ 0
+ 0
+ 0
+ 0
+ 0
+ 0
+ 0
+ 0
+ 0
+ 0
+ 0
+ 0
+ 0
+
+
+
+ 0
+ 0
+ 0
+
+
+
+
+
+
+
+
+
+ 1
+ 0
+ 0
+ 2
+ 10000000
+
+
+
+
+
+ Application/MDK-ARM
+ 0
+ 0
+ 0
+ 0
+
+ 1
+ 1
+ 2
+ 0
+ 0
+ 0
+ startup_stm32l431xx.s
+ startup_stm32l431xx.s
+ 0
+ 0
+
+
+
+
+ Application/User
+ 0
+ 0
+ 0
+ 0
+
+ 2
+ 2
+ 1
+ 0
+ 0
+ 0
+ ..\..\BSP\Src\gpio.c
+ gpio.c
+ 0
+ 0
+
+
+ 2
+ 3
+ 1
+ 0
+ 0
+ 0
+ ..\..\BSP\Src\main.c
+ main.c
+ 0
+ 0
+
+
+ 2
+ 4
+ 1
+ 0
+ 0
+ 0
+ ..\..\BSP\Src\mcu_init.c
+ mcu_init.c
+ 0
+ 0
+
+
+ 2
+ 5
+ 1
+ 0
+ 0
+ 0
+ ..\..\BSP\Src\stm32l4xx_hal_msp.c
+ stm32l4xx_hal_msp.c
+ 0
+ 0
+
+
+ 2
+ 6
+ 1
+ 0
+ 0
+ 0
+ ..\..\BSP\Src\stm32l4xx_it_mpy.c
+ stm32l4xx_it_mpy.c
+ 0
+ 0
+
+
+ 2
+ 7
+ 1
+ 0
+ 0
+ 0
+ ..\..\BSP\Src\usart.c
+ usart.c
+ 0
+ 0
+
+
+ 2
+ 8
+ 1
+ 0
+ 0
+ 0
+ ..\..\BSP\Src\adc.c
+ adc.c
+ 0
+ 0
+
+
+ 2
+ 9
+ 1
+ 0
+ 0
+ 0
+ ..\..\BSP\Src\i2c.c
+ i2c.c
+ 0
+ 0
+
+
+ 2
+ 10
+ 1
+ 0
+ 0
+ 0
+ ..\..\BSP\Src\spi.c
+ spi.c
+ 0
+ 0
+
+
+ 2
+ 11
+ 1
+ 0
+ 0
+ 0
+ ..\..\BSP\Src\sdmmc.c
+ sdmmc.c
+ 0
+ 0
+
+
+ 2
+ 12
+ 1
+ 0
+ 0
+ 0
+ ..\..\BSP\Src\quadspi.c
+ quadspi.c
+ 0
+ 0
+
+
+
+
+ examples
+ 0
+ 0
+ 0
+ 0
+
+ 3
+ 13
+ 1
+ 0
+ 0
+ 0
+ ..\..\..\..\examples\micropython_demo\micropython_demo.c
+ micropython_demo.c
+ 0
+ 0
+
+
+
+
+ Drivers/STM32L4xx_HAL_Driver
+ 0
+ 0
+ 0
+ 0
+
+ 4
+ 14
+ 1
+ 0
+ 0
+ 0
+ ..\..\..\..\platform\vendor_bsp\st\STM32L4xx_HAL_Driver\Src\stm32l4xx_hal_tim.c
+ stm32l4xx_hal_tim.c
+ 0
+ 0
+
+
+ 4
+ 15
+ 1
+ 0
+ 0
+ 0
+ ..\..\..\..\platform\vendor_bsp\st\STM32L4xx_HAL_Driver\Src\stm32l4xx_hal_tim_ex.c
+ stm32l4xx_hal_tim_ex.c
+ 0
+ 0
+
+
+ 4
+ 16
+ 1
+ 0
+ 0
+ 0
+ ..\..\..\..\platform\vendor_bsp\st\STM32L4xx_HAL_Driver\Src\stm32l4xx_hal_uart.c
+ stm32l4xx_hal_uart.c
+ 0
+ 0
+
+
+ 4
+ 17
+ 1
+ 0
+ 0
+ 0
+ ..\..\..\..\platform\vendor_bsp\st\STM32L4xx_HAL_Driver\Src\stm32l4xx_hal_uart_ex.c
+ stm32l4xx_hal_uart_ex.c
+ 0
+ 0
+
+
+ 4
+ 18
+ 1
+ 0
+ 0
+ 0
+ ..\..\..\..\platform\vendor_bsp\st\STM32L4xx_HAL_Driver\Src\stm32l4xx_hal.c
+ stm32l4xx_hal.c
+ 0
+ 0
+
+
+ 4
+ 19
+ 1
+ 0
+ 0
+ 0
+ ..\..\..\..\platform\vendor_bsp\st\STM32L4xx_HAL_Driver\Src\stm32l4xx_hal_i2c.c
+ stm32l4xx_hal_i2c.c
+ 0
+ 0
+
+
+ 4
+ 20
+ 1
+ 0
+ 0
+ 0
+ ..\..\..\..\platform\vendor_bsp\st\STM32L4xx_HAL_Driver\Src\stm32l4xx_hal_i2c_ex.c
+ stm32l4xx_hal_i2c_ex.c
+ 0
+ 0
+
+
+ 4
+ 21
+ 1
+ 0
+ 0
+ 0
+ ..\..\..\..\platform\vendor_bsp\st\STM32L4xx_HAL_Driver\Src\stm32l4xx_hal_rcc.c
+ stm32l4xx_hal_rcc.c
+ 0
+ 0
+
+
+ 4
+ 22
+ 1
+ 0
+ 0
+ 0
+ ..\..\..\..\platform\vendor_bsp\st\STM32L4xx_HAL_Driver\Src\stm32l4xx_hal_rcc_ex.c
+ stm32l4xx_hal_rcc_ex.c
+ 0
+ 0
+
+
+ 4
+ 23
+ 1
+ 0
+ 0
+ 0
+ ..\..\..\..\platform\vendor_bsp\st\STM32L4xx_HAL_Driver\Src\stm32l4xx_hal_flash.c
+ stm32l4xx_hal_flash.c
+ 0
+ 0
+
+
+ 4
+ 24
+ 1
+ 0
+ 0
+ 0
+ ..\..\..\..\platform\vendor_bsp\st\STM32L4xx_HAL_Driver\Src\stm32l4xx_hal_flash_ex.c
+ stm32l4xx_hal_flash_ex.c
+ 0
+ 0
+
+
+ 4
+ 25
+ 1
+ 0
+ 0
+ 0
+ ..\..\..\..\platform\vendor_bsp\st\STM32L4xx_HAL_Driver\Src\stm32l4xx_hal_flash_ramfunc.c
+ stm32l4xx_hal_flash_ramfunc.c
+ 0
+ 0
+
+
+ 4
+ 26
+ 1
+ 0
+ 0
+ 0
+ ..\..\..\..\platform\vendor_bsp\st\STM32L4xx_HAL_Driver\Src\stm32l4xx_hal_gpio.c
+ stm32l4xx_hal_gpio.c
+ 0
+ 0
+
+
+ 4
+ 27
+ 1
+ 0
+ 0
+ 0
+ ..\..\..\..\platform\vendor_bsp\st\STM32L4xx_HAL_Driver\Src\stm32l4xx_hal_dma.c
+ stm32l4xx_hal_dma.c
+ 0
+ 0
+
+
+ 4
+ 28
+ 1
+ 0
+ 0
+ 0
+ ..\..\..\..\platform\vendor_bsp\st\STM32L4xx_HAL_Driver\Src\stm32l4xx_hal_dma_ex.c
+ stm32l4xx_hal_dma_ex.c
+ 0
+ 0
+
+
+ 4
+ 29
+ 1
+ 0
+ 0
+ 0
+ ..\..\..\..\platform\vendor_bsp\st\STM32L4xx_HAL_Driver\Src\stm32l4xx_hal_pwr.c
+ stm32l4xx_hal_pwr.c
+ 0
+ 0
+
+
+ 4
+ 30
+ 1
+ 0
+ 0
+ 0
+ ..\..\..\..\platform\vendor_bsp\st\STM32L4xx_HAL_Driver\Src\stm32l4xx_hal_pwr_ex.c
+ stm32l4xx_hal_pwr_ex.c
+ 0
+ 0
+
+
+ 4
+ 31
+ 1
+ 0
+ 0
+ 0
+ ..\..\..\..\platform\vendor_bsp\st\STM32L4xx_HAL_Driver\Src\stm32l4xx_hal_cortex.c
+ stm32l4xx_hal_cortex.c
+ 0
+ 0
+
+
+ 4
+ 32
+ 1
+ 0
+ 0
+ 0
+ ..\..\..\..\platform\vendor_bsp\st\STM32L4xx_HAL_Driver\Src\stm32l4xx_hal_adc_ex.c
+ stm32l4xx_hal_adc_ex.c
+ 0
+ 0
+
+
+ 4
+ 33
+ 1
+ 0
+ 0
+ 0
+ ..\..\..\..\platform\vendor_bsp\st\STM32L4xx_HAL_Driver\Src\stm32l4xx_hal_adc.c
+ stm32l4xx_hal_adc.c
+ 0
+ 0
+
+
+ 4
+ 34
+ 1
+ 0
+ 0
+ 0
+ ..\..\..\..\platform\vendor_bsp\st\STM32L4xx_HAL_Driver\Src\stm32l4xx_hal_dac.c
+ stm32l4xx_hal_dac.c
+ 0
+ 0
+
+
+ 4
+ 35
+ 1
+ 0
+ 0
+ 0
+ ..\..\..\..\platform\vendor_bsp\st\STM32L4xx_HAL_Driver\Src\stm32l4xx_hal_dac_ex.c
+ stm32l4xx_hal_dac_ex.c
+ 0
+ 0
+
+
+ 4
+ 36
+ 1
+ 0
+ 0
+ 0
+ ..\..\..\..\platform\vendor_bsp\st\STM32L4xx_HAL_Driver\Src\stm32l4xx_hal_spi.c
+ stm32l4xx_hal_spi.c
+ 0
+ 0
+
+
+ 4
+ 37
+ 1
+ 0
+ 0
+ 0
+ ..\..\..\..\platform\vendor_bsp\st\STM32L4xx_HAL_Driver\Src\stm32l4xx_hal_spi_ex.c
+ stm32l4xx_hal_spi_ex.c
+ 0
+ 0
+
+
+ 4
+ 38
+ 1
+ 0
+ 0
+ 0
+ ..\..\..\..\platform\vendor_bsp\st\STM32L4xx_HAL_Driver\Src\stm32l4xx_hal_sd.c
+ stm32l4xx_hal_sd.c
+ 0
+ 0
+
+
+ 4
+ 39
+ 1
+ 0
+ 0
+ 0
+ ..\..\..\..\platform\vendor_bsp\st\STM32L4xx_HAL_Driver\Src\stm32l4xx_hal_sd_ex.c
+ stm32l4xx_hal_sd_ex.c
+ 0
+ 0
+
+
+ 4
+ 40
+ 1
+ 0
+ 0
+ 0
+ ..\..\..\..\platform\vendor_bsp\st\STM32L4xx_HAL_Driver\Src\stm32l4xx_ll_sdmmc.c
+ stm32l4xx_ll_sdmmc.c
+ 0
+ 0
+
+
+ 4
+ 41
+ 1
+ 0
+ 0
+ 0
+ ..\..\..\..\platform\vendor_bsp\st\STM32L4xx_HAL_Driver\Src\stm32l4xx_hal_qspi.c
+ stm32l4xx_hal_qspi.c
+ 0
+ 0
+
+
+
+
+ Drivers/CMSIS
+ 0
+ 0
+ 0
+ 0
+
+ 5
+ 42
+ 1
+ 0
+ 0
+ 0
+ ..\..\BSP\Src\system_stm32l4xx.c
+ system_stm32l4xx.c
+ 0
+ 0
+
+
+
+
+ Hardware
+ 0
+ 0
+ 0
+ 0
+
+ 6
+ 43
+ 1
+ 0
+ 0
+ 0
+ ..\..\BSP\Hardware\BH1750\BH1750.c
+ BH1750.c
+ 0
+ 0
+
+
+ 6
+ 44
+ 1
+ 0
+ 0
+ 0
+ ..\..\BSP\Hardware\LCD_ST7789\lcd_spi2_drv.c
+ lcd_spi2_drv.c
+ 0
+ 0
+
+
+ 6
+ 45
+ 1
+ 0
+ 0
+ 0
+ ..\..\BSP\Hardware\W25QXX-QSPI\w25qxx.c
+ w25qxx.c
+ 0
+ 0
+
+
+
+
+ kernel
+ 0
+ 0
+ 0
+ 0
+
+ 7
+ 46
+ 1
+ 0
+ 0
+ 0
+ ..\..\..\..\kernel\core\tos_mmblk.c
+ tos_mmblk.c
+ 0
+ 0
+
+
+ 7
+ 47
+ 1
+ 0
+ 0
+ 0
+ ..\..\..\..\kernel\core\tos_mmheap.c
+ tos_mmheap.c
+ 0
+ 0
+
+
+ 7
+ 48
+ 1
+ 0
+ 0
+ 0
+ ..\..\..\..\kernel\core\tos_mutex.c
+ tos_mutex.c
+ 0
+ 0
+
+
+ 7
+ 49
+ 1
+ 0
+ 0
+ 0
+ ..\..\..\..\kernel\core\tos_sched.c
+ tos_sched.c
+ 0
+ 0
+
+
+ 7
+ 50
+ 1
+ 0
+ 0
+ 0
+ ..\..\..\..\kernel\core\tos_sem.c
+ tos_sem.c
+ 0
+ 0
+
+
+ 7
+ 51
+ 1
+ 0
+ 0
+ 0
+ ..\..\..\..\kernel\core\tos_sys.c
+ tos_sys.c
+ 0
+ 0
+
+
+ 7
+ 52
+ 1
+ 0
+ 0
+ 0
+ ..\..\..\..\kernel\core\tos_task.c
+ tos_task.c
+ 0
+ 0
+
+
+ 7
+ 53
+ 1
+ 0
+ 0
+ 0
+ ..\..\..\..\kernel\core\tos_tick.c
+ tos_tick.c
+ 0
+ 0
+
+
+ 7
+ 54
+ 1
+ 0
+ 0
+ 0
+ ..\..\..\..\kernel\core\tos_time.c
+ tos_time.c
+ 0
+ 0
+
+
+ 7
+ 55
+ 1
+ 0
+ 0
+ 0
+ ..\..\..\..\kernel\core\tos_timer.c
+ tos_timer.c
+ 0
+ 0
+
+
+ 7
+ 56
+ 1
+ 0
+ 0
+ 0
+ ..\..\..\..\kernel\core\tos_event.c
+ tos_event.c
+ 0
+ 0
+
+
+ 7
+ 57
+ 1
+ 0
+ 0
+ 0
+ ..\..\..\..\kernel\core\tos_global.c
+ tos_global.c
+ 0
+ 0
+
+
+ 7
+ 58
+ 1
+ 0
+ 0
+ 0
+ ..\..\..\..\kernel\core\tos_pend.c
+ tos_pend.c
+ 0
+ 0
+
+
+ 7
+ 59
+ 1
+ 0
+ 0
+ 0
+ ..\..\..\..\kernel\core\tos_robin.c
+ tos_robin.c
+ 0
+ 0
+
+
+ 7
+ 60
+ 1
+ 0
+ 0
+ 0
+ ..\..\..\..\kernel\core\tos_binary_heap.c
+ tos_binary_heap.c
+ 0
+ 0
+
+
+ 7
+ 61
+ 1
+ 0
+ 0
+ 0
+ ..\..\..\..\kernel\core\tos_char_fifo.c
+ tos_char_fifo.c
+ 0
+ 0
+
+
+ 7
+ 62
+ 1
+ 0
+ 0
+ 0
+ ..\..\..\..\kernel\core\tos_completion.c
+ tos_completion.c
+ 0
+ 0
+
+
+ 7
+ 63
+ 1
+ 0
+ 0
+ 0
+ ..\..\..\..\kernel\core\tos_countdownlatch.c
+ tos_countdownlatch.c
+ 0
+ 0
+
+
+ 7
+ 64
+ 1
+ 0
+ 0
+ 0
+ ..\..\..\..\kernel\core\tos_mail_queue.c
+ tos_mail_queue.c
+ 0
+ 0
+
+
+ 7
+ 65
+ 1
+ 0
+ 0
+ 0
+ ..\..\..\..\kernel\core\tos_message_queue.c
+ tos_message_queue.c
+ 0
+ 0
+
+
+ 7
+ 66
+ 1
+ 0
+ 0
+ 0
+ ..\..\..\..\kernel\core\tos_priority_mail_queue.c
+ tos_priority_mail_queue.c
+ 0
+ 0
+
+
+ 7
+ 67
+ 1
+ 0
+ 0
+ 0
+ ..\..\..\..\kernel\core\tos_priority_message_queue.c
+ tos_priority_message_queue.c
+ 0
+ 0
+
+
+ 7
+ 68
+ 1
+ 0
+ 0
+ 0
+ ..\..\..\..\kernel\core\tos_priority_queue.c
+ tos_priority_queue.c
+ 0
+ 0
+
+
+ 7
+ 69
+ 1
+ 0
+ 0
+ 0
+ ..\..\..\..\kernel\core\tos_ring_queue.c
+ tos_ring_queue.c
+ 0
+ 0
+
+
+ 7
+ 70
+ 1
+ 0
+ 0
+ 0
+ ..\..\..\..\kernel\core\tos_stopwatch.c
+ tos_stopwatch.c
+ 0
+ 0
+
+
+
+
+ cpu
+ 0
+ 0
+ 0
+ 0
+
+ 8
+ 71
+ 2
+ 0
+ 0
+ 0
+ ..\..\..\..\arch\arm\arm-v7m\cortex-m4\armcc\port_s.S
+ port_s.S
+ 0
+ 0
+
+
+ 8
+ 72
+ 1
+ 0
+ 0
+ 0
+ ..\..\..\..\arch\arm\arm-v7m\common\tos_cpu.c
+ tos_cpu.c
+ 0
+ 0
+
+
+ 8
+ 73
+ 1
+ 0
+ 0
+ 0
+ ..\..\..\..\arch\arm\arm-v7m\cortex-m4\armcc\port_c.c
+ port_c.c
+ 0
+ 0
+
+
+
+
+ config
+ 0
+ 0
+ 0
+ 0
+
+ 9
+ 74
+ 5
+ 0
+ 0
+ 0
+ ..\..\TOS-CONFIG\tos_config.h
+ tos_config.h
+ 0
+ 0
+
+
+
+
+ hal
+ 0
+ 0
+ 0
+ 0
+
+ 10
+ 75
+ 1
+ 0
+ 0
+ 0
+ ..\..\..\..\platform\hal\st\stm32l4xx\src\tos_hal_uart.c
+ tos_hal_uart.c
+ 0
+ 0
+
+
+ 10
+ 76
+ 1
+ 0
+ 0
+ 0
+ ..\..\..\..\platform\hal\st\stm32l4xx\src\tos_hal_sd.c
+ tos_hal_sd.c
+ 0
+ 0
+
+
+ 10
+ 77
+ 1
+ 0
+ 0
+ 0
+ ..\micropython_basic_demo\board\hal\mp_tos_hal_pin.c
+ mp_tos_hal_pin.c
+ 0
+ 0
+
+
+ 10
+ 78
+ 1
+ 0
+ 0
+ 0
+ ..\micropython_basic_demo\board\hal\mp_tos_hal_spi.c
+ mp_tos_hal_spi.c
+ 0
+ 0
+
+
+ 10
+ 79
+ 1
+ 0
+ 0
+ 0
+ ..\micropython_basic_demo\board\hal\mp_tos_hal_uart.c
+ mp_tos_hal_uart.c
+ 0
+ 0
+
+
+
+
+ net
+ 0
+ 0
+ 0
+ 0
+
+ 11
+ 80
+ 1
+ 0
+ 0
+ 0
+ ..\..\..\..\net\at\src\tos_at.c
+ tos_at.c
+ 0
+ 0
+
+
+ 11
+ 81
+ 1
+ 0
+ 0
+ 0
+ ..\..\..\..\net\sal_module_wrapper\sal_module_wrapper.c
+ sal_module_wrapper.c
+ 0
+ 0
+
+
+ 11
+ 82
+ 1
+ 0
+ 0
+ 0
+ ..\..\..\..\net\socket_wrapper\tos_at_socket.c
+ tos_at_socket.c
+ 0
+ 0
+
+
+ 11
+ 83
+ 1
+ 0
+ 0
+ 0
+ ..\..\..\..\net\socket_wrapper\tos_at_socket_lib.c
+ tos_at_socket_lib.c
+ 0
+ 0
+
+
+ 11
+ 84
+ 1
+ 0
+ 0
+ 0
+ ..\..\..\..\net\socket_wrapper\tos_at_socket_prv.c
+ tos_at_socket_prv.c
+ 0
+ 0
+
+
+
+
+ devices
+ 0
+ 0
+ 0
+ 0
+
+ 12
+ 85
+ 1
+ 0
+ 0
+ 0
+ ..\..\..\..\devices\esp8266\esp8266.c
+ esp8266.c
+ 0
+ 0
+
+
+
+
+ vfs
+ 0
+ 0
+ 0
+ 0
+
+ 13
+ 86
+ 1
+ 0
+ 0
+ 0
+ ..\..\..\..\components\fs\vfs\tos_vfs.c
+ tos_vfs.c
+ 0
+ 0
+
+
+ 13
+ 87
+ 1
+ 0
+ 0
+ 0
+ ..\..\..\..\components\fs\vfs\tos_vfs_device.c
+ tos_vfs_device.c
+ 0
+ 0
+
+
+ 13
+ 88
+ 1
+ 0
+ 0
+ 0
+ ..\..\..\..\components\fs\vfs\tos_vfs_file.c
+ tos_vfs_file.c
+ 0
+ 0
+
+
+ 13
+ 89
+ 1
+ 0
+ 0
+ 0
+ ..\..\..\..\components\fs\vfs\tos_vfs_fs.c
+ tos_vfs_fs.c
+ 0
+ 0
+
+
+ 13
+ 90
+ 1
+ 0
+ 0
+ 0
+ ..\..\..\..\components\fs\vfs\tos_vfs_inode.c
+ tos_vfs_inode.c
+ 0
+ 0
+
+
+
+
+ fatfs
+ 0
+ 0
+ 0
+ 0
+
+ 14
+ 91
+ 1
+ 0
+ 0
+ 0
+ ..\..\..\..\components\fs\fatfs\wrapper\tos_diskio.c
+ tos_diskio.c
+ 0
+ 0
+
+
+ 14
+ 92
+ 1
+ 0
+ 0
+ 0
+ ..\..\..\..\components\fs\fatfs\wrapper\tos_fatfs_drv.c
+ tos_fatfs_drv.c
+ 0
+ 0
+
+
+ 14
+ 93
+ 1
+ 0
+ 0
+ 0
+ ..\..\..\..\components\fs\fatfs\wrapper\tos_fatfs_vfs.c
+ tos_fatfs_vfs.c
+ 0
+ 0
+
+
+ 14
+ 94
+ 1
+ 0
+ 0
+ 0
+ ..\..\..\..\components\fs\fatfs\wrapper\tos_ff.c
+ tos_ff.c
+ 0
+ 0
+
+
+ 14
+ 95
+ 1
+ 0
+ 0
+ 0
+ ..\..\..\..\components\fs\fatfs\wrapper\tos_ffsystem.c
+ tos_ffsystem.c
+ 0
+ 0
+
+
+ 14
+ 96
+ 1
+ 0
+ 0
+ 0
+ ..\..\..\..\components\fs\fatfs\wrapper\tos_ffunicode.c
+ tos_ffunicode.c
+ 0
+ 0
+
+
+
+
+ micropython/py
+ 0
+ 0
+ 0
+ 0
+
+ 15
+ 97
+ 1
+ 0
+ 0
+ 0
+ ..\..\..\..\components\language\micropython\py\argcheck.c
+ argcheck.c
+ 0
+ 0
+
+
+ 15
+ 98
+ 1
+ 0
+ 0
+ 0
+ ..\..\..\..\components\language\micropython\py\asmarm.c
+ asmarm.c
+ 0
+ 0
+
+
+ 15
+ 99
+ 1
+ 0
+ 0
+ 0
+ ..\..\..\..\components\language\micropython\py\asmbase.c
+ asmbase.c
+ 0
+ 0
+
+
+ 15
+ 100
+ 1
+ 0
+ 0
+ 0
+ ..\..\..\..\components\language\micropython\py\asmthumb.c
+ asmthumb.c
+ 0
+ 0
+
+
+ 15
+ 101
+ 1
+ 0
+ 0
+ 0
+ ..\..\..\..\components\language\micropython\py\asmx64.c
+ asmx64.c
+ 0
+ 0
+
+
+ 15
+ 102
+ 1
+ 0
+ 0
+ 0
+ ..\..\..\..\components\language\micropython\py\asmx86.c
+ asmx86.c
+ 0
+ 0
+
+
+ 15
+ 103
+ 1
+ 0
+ 0
+ 0
+ ..\..\..\..\components\language\micropython\py\asmxtensa.c
+ asmxtensa.c
+ 0
+ 0
+
+
+ 15
+ 104
+ 1
+ 0
+ 0
+ 0
+ ..\..\..\..\components\language\micropython\py\bc.c
+ bc.c
+ 0
+ 0
+
+
+ 15
+ 105
+ 1
+ 0
+ 0
+ 0
+ ..\..\..\..\components\language\micropython\py\binary.c
+ binary.c
+ 0
+ 0
+
+
+ 15
+ 106
+ 1
+ 0
+ 0
+ 0
+ ..\..\..\..\components\language\micropython\py\builtinevex.c
+ builtinevex.c
+ 0
+ 0
+
+
+ 15
+ 107
+ 1
+ 0
+ 0
+ 0
+ ..\..\..\..\components\language\micropython\py\builtinhelp.c
+ builtinhelp.c
+ 0
+ 0
+
+
+ 15
+ 108
+ 1
+ 0
+ 0
+ 0
+ ..\..\..\..\components\language\micropython\py\builtinimport.c
+ builtinimport.c
+ 0
+ 0
+
+
+ 15
+ 109
+ 1
+ 0
+ 0
+ 0
+ ..\..\..\..\components\language\micropython\py\compile.c
+ compile.c
+ 0
+ 0
+
+
+ 15
+ 110
+ 1
+ 0
+ 0
+ 0
+ ..\..\..\..\components\language\micropython\py\emitbc.c
+ emitbc.c
+ 0
+ 0
+
+
+ 15
+ 111
+ 1
+ 0
+ 0
+ 0
+ ..\..\..\..\components\language\micropython\py\emitcommon.c
+ emitcommon.c
+ 0
+ 0
+
+
+ 15
+ 112
+ 1
+ 0
+ 0
+ 0
+ ..\..\..\..\components\language\micropython\py\emitglue.c
+ emitglue.c
+ 0
+ 0
+
+
+ 15
+ 113
+ 1
+ 0
+ 0
+ 0
+ ..\..\..\..\components\language\micropython\py\emitinlinethumb.c
+ emitinlinethumb.c
+ 0
+ 0
+
+
+ 15
+ 114
+ 1
+ 0
+ 0
+ 0
+ ..\..\..\..\components\language\micropython\py\emitinlinextensa.c
+ emitinlinextensa.c
+ 0
+ 0
+
+
+ 15
+ 115
+ 1
+ 0
+ 0
+ 0
+ ..\..\..\..\components\language\micropython\py\emitnarm.c
+ emitnarm.c
+ 0
+ 0
+
+
+ 15
+ 116
+ 1
+ 0
+ 0
+ 0
+ ..\..\..\..\components\language\micropython\py\emitnative.c
+ emitnative.c
+ 0
+ 0
+
+
+ 15
+ 117
+ 1
+ 0
+ 0
+ 0
+ ..\..\..\..\components\language\micropython\py\emitnthumb.c
+ emitnthumb.c
+ 0
+ 0
+
+
+ 15
+ 118
+ 1
+ 0
+ 0
+ 0
+ ..\..\..\..\components\language\micropython\py\emitnx64.c
+ emitnx64.c
+ 0
+ 0
+
+
+ 15
+ 119
+ 1
+ 0
+ 0
+ 0
+ ..\..\..\..\components\language\micropython\py\emitnx86.c
+ emitnx86.c
+ 0
+ 0
+
+
+ 15
+ 120
+ 1
+ 0
+ 0
+ 0
+ ..\..\..\..\components\language\micropython\py\emitnxtensa.c
+ emitnxtensa.c
+ 0
+ 0
+
+
+ 15
+ 121
+ 1
+ 0
+ 0
+ 0
+ ..\..\..\..\components\language\micropython\py\emitnxtensawin.c
+ emitnxtensawin.c
+ 0
+ 0
+
+
+ 15
+ 122
+ 1
+ 0
+ 0
+ 0
+ ..\..\..\..\components\language\micropython\py\formatfloat.c
+ formatfloat.c
+ 0
+ 0
+
+
+ 15
+ 123
+ 1
+ 0
+ 0
+ 0
+ ..\..\..\..\components\language\micropython\py\frozenmod.c
+ frozenmod.c
+ 0
+ 0
+
+
+ 15
+ 124
+ 1
+ 0
+ 0
+ 0
+ ..\..\..\..\components\language\micropython\py\gc.c
+ gc.c
+ 0
+ 0
+
+
+ 15
+ 125
+ 1
+ 0
+ 0
+ 0
+ ..\..\..\..\components\language\micropython\py\lexer.c
+ lexer.c
+ 0
+ 0
+
+
+ 15
+ 126
+ 1
+ 0
+ 0
+ 0
+ ..\..\..\..\components\language\micropython\py\malloc.c
+ malloc.c
+ 0
+ 0
+
+
+ 15
+ 127
+ 1
+ 0
+ 0
+ 0
+ ..\..\..\..\components\language\micropython\py\map.c
+ map.c
+ 0
+ 0
+
+
+ 15
+ 128
+ 1
+ 0
+ 0
+ 0
+ ..\..\..\..\components\language\micropython\py\modarray.c
+ modarray.c
+ 0
+ 0
+
+
+ 15
+ 129
+ 1
+ 0
+ 0
+ 0
+ ..\..\..\..\components\language\micropython\py\modbuiltins.c
+ modbuiltins.c
+ 0
+ 0
+
+
+ 15
+ 130
+ 1
+ 0
+ 0
+ 0
+ ..\..\..\..\components\language\micropython\py\modcmath.c
+ modcmath.c
+ 0
+ 0
+
+
+ 15
+ 131
+ 1
+ 0
+ 0
+ 0
+ ..\..\..\..\components\language\micropython\py\modcollections.c
+ modcollections.c
+ 0
+ 0
+
+
+ 15
+ 132
+ 1
+ 0
+ 0
+ 0
+ ..\..\..\..\components\language\micropython\py\modgc.c
+ modgc.c
+ 0
+ 0
+
+
+ 15
+ 133
+ 1
+ 0
+ 0
+ 0
+ ..\..\..\..\components\language\micropython\py\modio.c
+ modio.c
+ 0
+ 0
+
+
+ 15
+ 134
+ 1
+ 0
+ 0
+ 0
+ ..\..\..\..\components\language\micropython\py\modmath.c
+ modmath.c
+ 0
+ 0
+
+
+ 15
+ 135
+ 1
+ 0
+ 0
+ 0
+ ..\..\..\..\components\language\micropython\py\modmicropython.c
+ modmicropython.c
+ 0
+ 0
+
+
+ 15
+ 136
+ 1
+ 0
+ 0
+ 0
+ ..\..\..\..\components\language\micropython\py\modstruct.c
+ modstruct.c
+ 0
+ 0
+
+
+ 15
+ 137
+ 1
+ 0
+ 0
+ 0
+ ..\..\..\..\components\language\micropython\py\modsys.c
+ modsys.c
+ 0
+ 0
+
+
+ 15
+ 138
+ 1
+ 0
+ 0
+ 0
+ ..\..\..\..\components\language\micropython\py\modthread.c
+ modthread.c
+ 0
+ 0
+
+
+ 15
+ 139
+ 1
+ 0
+ 0
+ 0
+ ..\..\..\..\components\language\micropython\py\moduerrno.c
+ moduerrno.c
+ 0
+ 0
+
+
+ 15
+ 140
+ 1
+ 0
+ 0
+ 0
+ ..\..\..\..\components\language\micropython\py\mpprint.c
+ mpprint.c
+ 0
+ 0
+
+
+ 15
+ 141
+ 1
+ 0
+ 0
+ 0
+ ..\..\..\..\components\language\micropython\py\mpstate.c
+ mpstate.c
+ 0
+ 0
+
+
+ 15
+ 142
+ 1
+ 0
+ 0
+ 0
+ ..\..\..\..\components\language\micropython\py\mpz.c
+ mpz.c
+ 0
+ 0
+
+
+ 15
+ 143
+ 1
+ 0
+ 0
+ 0
+ ..\..\..\..\components\language\micropython\py\nativeglue.c
+ nativeglue.c
+ 0
+ 0
+
+
+ 15
+ 144
+ 1
+ 0
+ 0
+ 0
+ ..\..\..\..\components\language\micropython\py\nlr.c
+ nlr.c
+ 0
+ 0
+
+
+ 15
+ 145
+ 1
+ 0
+ 0
+ 0
+ ..\..\..\..\components\language\micropython\py\nlraarch64.c
+ nlraarch64.c
+ 0
+ 0
+
+
+ 15
+ 146
+ 1
+ 0
+ 0
+ 0
+ ..\..\..\..\components\language\micropython\py\nlrpowerpc.c
+ nlrpowerpc.c
+ 0
+ 0
+
+
+ 15
+ 147
+ 1
+ 0
+ 0
+ 0
+ ..\..\..\..\components\language\micropython\py\nlrsetjmp.c
+ nlrsetjmp.c
+ 0
+ 0
+
+
+ 15
+ 148
+ 1
+ 0
+ 0
+ 0
+ ..\..\..\..\components\language\micropython\py\nlrthumb.c
+ nlrthumb.c
+ 0
+ 0
+
+
+ 15
+ 149
+ 1
+ 0
+ 0
+ 0
+ ..\..\..\..\components\language\micropython\py\nlrx64.c
+ nlrx64.c
+ 0
+ 0
+
+
+ 15
+ 150
+ 1
+ 0
+ 0
+ 0
+ ..\..\..\..\components\language\micropython\py\nlrx86.c
+ nlrx86.c
+ 0
+ 0
+
+
+ 15
+ 151
+ 1
+ 0
+ 0
+ 0
+ ..\..\..\..\components\language\micropython\py\nlrxtensa.c
+ nlrxtensa.c
+ 0
+ 0
+
+
+ 15
+ 152
+ 1
+ 0
+ 0
+ 0
+ ..\..\..\..\components\language\micropython\py\obj.c
+ obj.c
+ 0
+ 0
+
+
+ 15
+ 153
+ 1
+ 0
+ 0
+ 0
+ ..\..\..\..\components\language\micropython\py\objarray.c
+ objarray.c
+ 0
+ 0
+
+
+ 15
+ 154
+ 1
+ 0
+ 0
+ 0
+ ..\..\..\..\components\language\micropython\py\objattrtuple.c
+ objattrtuple.c
+ 0
+ 0
+
+
+ 15
+ 155
+ 1
+ 0
+ 0
+ 0
+ ..\..\..\..\components\language\micropython\py\objbool.c
+ objbool.c
+ 0
+ 0
+
+
+ 15
+ 156
+ 1
+ 0
+ 0
+ 0
+ ..\..\..\..\components\language\micropython\py\objboundmeth.c
+ objboundmeth.c
+ 0
+ 0
+
+
+ 15
+ 157
+ 1
+ 0
+ 0
+ 0
+ ..\..\..\..\components\language\micropython\py\objcell.c
+ objcell.c
+ 0
+ 0
+
+
+ 15
+ 158
+ 1
+ 0
+ 0
+ 0
+ ..\..\..\..\components\language\micropython\py\objclosure.c
+ objclosure.c
+ 0
+ 0
+
+
+ 15
+ 159
+ 1
+ 0
+ 0
+ 0
+ ..\..\..\..\components\language\micropython\py\objcomplex.c
+ objcomplex.c
+ 0
+ 0
+
+
+ 15
+ 160
+ 1
+ 0
+ 0
+ 0
+ ..\..\..\..\components\language\micropython\py\objdeque.c
+ objdeque.c
+ 0
+ 0
+
+
+ 15
+ 161
+ 1
+ 0
+ 0
+ 0
+ ..\..\..\..\components\language\micropython\py\objdict.c
+ objdict.c
+ 0
+ 0
+
+
+ 15
+ 162
+ 1
+ 0
+ 0
+ 0
+ ..\..\..\..\components\language\micropython\py\objenumerate.c
+ objenumerate.c
+ 0
+ 0
+
+
+ 15
+ 163
+ 1
+ 0
+ 0
+ 0
+ ..\..\..\..\components\language\micropython\py\objexcept.c
+ objexcept.c
+ 0
+ 0
+
+
+ 15
+ 164
+ 1
+ 0
+ 0
+ 0
+ ..\..\..\..\components\language\micropython\py\objfilter.c
+ objfilter.c
+ 0
+ 0
+
+
+ 15
+ 165
+ 1
+ 0
+ 0
+ 0
+ ..\..\..\..\components\language\micropython\py\objfloat.c
+ objfloat.c
+ 0
+ 0
+
+
+ 15
+ 166
+ 1
+ 0
+ 0
+ 0
+ ..\..\..\..\components\language\micropython\py\objfun.c
+ objfun.c
+ 0
+ 0
+
+
+ 15
+ 167
+ 1
+ 0
+ 0
+ 0
+ ..\..\..\..\components\language\micropython\py\objgenerator.c
+ objgenerator.c
+ 0
+ 0
+
+
+ 15
+ 168
+ 1
+ 0
+ 0
+ 0
+ ..\..\..\..\components\language\micropython\py\objgetitemiter.c
+ objgetitemiter.c
+ 0
+ 0
+
+
+ 15
+ 169
+ 1
+ 0
+ 0
+ 0
+ ..\..\..\..\components\language\micropython\py\objint.c
+ objint.c
+ 0
+ 0
+
+
+ 15
+ 170
+ 1
+ 0
+ 0
+ 0
+ ..\..\..\..\components\language\micropython\py\objint_longlong.c
+ objint_longlong.c
+ 0
+ 0
+
+
+ 15
+ 171
+ 1
+ 0
+ 0
+ 0
+ ..\..\..\..\components\language\micropython\py\objint_mpz.c
+ objint_mpz.c
+ 0
+ 0
+
+
+ 15
+ 172
+ 1
+ 0
+ 0
+ 0
+ ..\..\..\..\components\language\micropython\py\objlist.c
+ objlist.c
+ 0
+ 0
+
+
+ 15
+ 173
+ 1
+ 0
+ 0
+ 0
+ ..\..\..\..\components\language\micropython\py\objmap.c
+ objmap.c
+ 0
+ 0
+
+
+ 15
+ 174
+ 1
+ 0
+ 0
+ 0
+ ..\..\..\..\components\language\micropython\py\objmodule.c
+ objmodule.c
+ 0
+ 0
+
+
+ 15
+ 175
+ 1
+ 0
+ 0
+ 0
+ ..\..\..\..\components\language\micropython\py\objnamedtuple.c
+ objnamedtuple.c
+ 0
+ 0
+
+
+ 15
+ 176
+ 1
+ 0
+ 0
+ 0
+ ..\..\..\..\components\language\micropython\py\objnone.c
+ objnone.c
+ 0
+ 0
+
+
+ 15
+ 177
+ 1
+ 0
+ 0
+ 0
+ ..\..\..\..\components\language\micropython\py\objobject.c
+ objobject.c
+ 0
+ 0
+
+
+ 15
+ 178
+ 1
+ 0
+ 0
+ 0
+ ..\..\..\..\components\language\micropython\py\objpolyiter.c
+ objpolyiter.c
+ 0
+ 0
+
+
+ 15
+ 179
+ 1
+ 0
+ 0
+ 0
+ ..\..\..\..\components\language\micropython\py\objproperty.c
+ objproperty.c
+ 0
+ 0
+
+
+ 15
+ 180
+ 1
+ 0
+ 0
+ 0
+ ..\..\..\..\components\language\micropython\py\objrange.c
+ objrange.c
+ 0
+ 0
+
+
+ 15
+ 181
+ 1
+ 0
+ 0
+ 0
+ ..\..\..\..\components\language\micropython\py\objreversed.c
+ objreversed.c
+ 0
+ 0
+
+
+ 15
+ 182
+ 1
+ 0
+ 0
+ 0
+ ..\..\..\..\components\language\micropython\py\objset.c
+ objset.c
+ 0
+ 0
+
+
+ 15
+ 183
+ 1
+ 0
+ 0
+ 0
+ ..\..\..\..\components\language\micropython\py\objsingleton.c
+ objsingleton.c
+ 0
+ 0
+
+
+ 15
+ 184
+ 1
+ 0
+ 0
+ 0
+ ..\..\..\..\components\language\micropython\py\objslice.c
+ objslice.c
+ 0
+ 0
+
+
+ 15
+ 185
+ 1
+ 0
+ 0
+ 0
+ ..\..\..\..\components\language\micropython\py\objstr.c
+ objstr.c
+ 0
+ 0
+
+
+ 15
+ 186
+ 1
+ 0
+ 0
+ 0
+ ..\..\..\..\components\language\micropython\py\objstringio.c
+ objstringio.c
+ 0
+ 0
+
+
+ 15
+ 187
+ 1
+ 0
+ 0
+ 0
+ ..\..\..\..\components\language\micropython\py\objstrunicode.c
+ objstrunicode.c
+ 0
+ 0
+
+
+ 15
+ 188
+ 1
+ 0
+ 0
+ 0
+ ..\..\..\..\components\language\micropython\py\objtuple.c
+ objtuple.c
+ 0
+ 0
+
+
+ 15
+ 189
+ 1
+ 0
+ 0
+ 0
+ ..\..\..\..\components\language\micropython\py\objtype.c
+ objtype.c
+ 0
+ 0
+
+
+ 15
+ 190
+ 1
+ 0
+ 0
+ 0
+ ..\..\..\..\components\language\micropython\py\objzip.c
+ objzip.c
+ 0
+ 0
+
+
+ 15
+ 191
+ 1
+ 0
+ 0
+ 0
+ ..\..\..\..\components\language\micropython\py\opmethods.c
+ opmethods.c
+ 0
+ 0
+
+
+ 15
+ 192
+ 1
+ 0
+ 0
+ 0
+ ..\..\..\..\components\language\micropython\py\pairheap.c
+ pairheap.c
+ 0
+ 0
+
+
+ 15
+ 193
+ 1
+ 0
+ 0
+ 0
+ ..\..\..\..\components\language\micropython\py\parse.c
+ parse.c
+ 0
+ 0
+
+
+ 15
+ 194
+ 1
+ 0
+ 0
+ 0
+ ..\..\..\..\components\language\micropython\py\parsenum.c
+ parsenum.c
+ 0
+ 0
+
+
+ 15
+ 195
+ 1
+ 0
+ 0
+ 0
+ ..\..\..\..\components\language\micropython\py\parsenumbase.c
+ parsenumbase.c
+ 0
+ 0
+
+
+ 15
+ 196
+ 1
+ 0
+ 0
+ 0
+ ..\..\..\..\components\language\micropython\py\persistentcode.c
+ persistentcode.c
+ 0
+ 0
+
+
+ 15
+ 197
+ 1
+ 0
+ 0
+ 0
+ ..\..\..\..\components\language\micropython\py\profile.c
+ profile.c
+ 0
+ 0
+
+
+ 15
+ 198
+ 1
+ 0
+ 0
+ 0
+ ..\..\..\..\components\language\micropython\py\pystack.c
+ pystack.c
+ 0
+ 0
+
+
+ 15
+ 199
+ 1
+ 0
+ 0
+ 0
+ ..\..\..\..\components\language\micropython\py\qstr.c
+ qstr.c
+ 0
+ 0
+
+
+ 15
+ 200
+ 1
+ 0
+ 0
+ 0
+ ..\..\..\..\components\language\micropython\py\reader.c
+ reader.c
+ 0
+ 0
+
+
+ 15
+ 201
+ 1
+ 0
+ 0
+ 0
+ ..\..\..\..\components\language\micropython\py\repl.c
+ repl.c
+ 0
+ 0
+
+
+ 15
+ 202
+ 1
+ 0
+ 0
+ 0
+ ..\..\..\..\components\language\micropython\py\ringbuf.c
+ ringbuf.c
+ 0
+ 0
+
+
+ 15
+ 203
+ 1
+ 0
+ 0
+ 0
+ ..\..\..\..\components\language\micropython\py\runtime.c
+ runtime.c
+ 0
+ 0
+
+
+ 15
+ 204
+ 1
+ 0
+ 0
+ 0
+ ..\..\..\..\components\language\micropython\py\runtime_utils.c
+ runtime_utils.c
+ 0
+ 0
+
+
+ 15
+ 205
+ 1
+ 0
+ 0
+ 0
+ ..\..\..\..\components\language\micropython\py\scheduler.c
+ scheduler.c
+ 0
+ 0
+
+
+ 15
+ 206
+ 1
+ 0
+ 0
+ 0
+ ..\..\..\..\components\language\micropython\py\scope.c
+ scope.c
+ 0
+ 0
+
+
+ 15
+ 207
+ 1
+ 0
+ 0
+ 0
+ ..\..\..\..\components\language\micropython\py\sequence.c
+ sequence.c
+ 0
+ 0
+
+
+ 15
+ 208
+ 1
+ 0
+ 0
+ 0
+ ..\..\..\..\components\language\micropython\py\showbc.c
+ showbc.c
+ 0
+ 0
+
+
+ 15
+ 209
+ 1
+ 0
+ 0
+ 0
+ ..\..\..\..\components\language\micropython\py\smallint.c
+ smallint.c
+ 0
+ 0
+
+
+ 15
+ 210
+ 1
+ 0
+ 0
+ 0
+ ..\..\..\..\components\language\micropython\py\stackctrl.c
+ stackctrl.c
+ 0
+ 0
+
+
+ 15
+ 211
+ 1
+ 0
+ 0
+ 0
+ ..\..\..\..\components\language\micropython\py\stream.c
+ stream.c
+ 0
+ 0
+
+
+ 15
+ 212
+ 1
+ 0
+ 0
+ 0
+ ..\..\..\..\components\language\micropython\py\unicode.c
+ unicode.c
+ 0
+ 0
+
+
+ 15
+ 213
+ 1
+ 0
+ 0
+ 0
+ ..\..\..\..\components\language\micropython\py\vm.c
+ vm.c
+ 0
+ 0
+
+
+ 15
+ 214
+ 1
+ 0
+ 0
+ 0
+ ..\..\..\..\components\language\micropython\py\vstr.c
+ vstr.c
+ 0
+ 0
+
+
+ 15
+ 215
+ 1
+ 0
+ 0
+ 0
+ ..\..\..\..\components\language\micropython\py\warning.c
+ warning.c
+ 0
+ 0
+
+
+
+
+ micropython/shared
+ 0
+ 0
+ 0
+ 0
+
+ 16
+ 216
+ 1
+ 0
+ 0
+ 0
+ ..\..\..\..\components\language\micropython\shared\readline\readline.c
+ readline.c
+ 0
+ 0
+
+
+ 16
+ 217
+ 1
+ 0
+ 0
+ 0
+ ..\..\..\..\components\language\micropython\shared\runtime\pyexec.c
+ pyexec.c
+ 0
+ 0
+
+
+ 16
+ 218
+ 1
+ 0
+ 0
+ 0
+ ..\..\..\..\components\language\micropython\shared\runtime\stdout_helpers.c
+ stdout_helpers.c
+ 0
+ 0
+
+
+ 16
+ 219
+ 1
+ 0
+ 0
+ 0
+ ..\..\..\..\components\language\micropython\shared\runtime\sys_stdio_mphal.c
+ sys_stdio_mphal.c
+ 0
+ 0
+
+
+ 16
+ 220
+ 1
+ 0
+ 0
+ 0
+ ..\..\..\..\components\language\micropython\shared\runtime\interrupt_char.c
+ interrupt_char.c
+ 0
+ 0
+
+
+ 16
+ 221
+ 1
+ 0
+ 0
+ 0
+ ..\..\..\..\components\language\micropython\shared\netutils\netutils.c
+ netutils.c
+ 0
+ 0
+
+
+
+
+ micropython/extmod
+ 0
+ 0
+ 0
+ 0
+
+ 17
+ 222
+ 1
+ 0
+ 0
+ 0
+ ..\..\..\..\components\language\micropython\extmod\modframebuf.c
+ modframebuf.c
+ 0
+ 0
+
+
+ 17
+ 223
+ 1
+ 0
+ 0
+ 0
+ ..\..\..\..\components\language\micropython\extmod\moduasyncio.c
+ moduasyncio.c
+ 0
+ 0
+
+
+ 17
+ 224
+ 1
+ 0
+ 0
+ 0
+ ..\..\..\..\components\language\micropython\extmod\modubinascii.c
+ modubinascii.c
+ 0
+ 0
+
+
+ 17
+ 225
+ 1
+ 0
+ 0
+ 0
+ ..\..\..\..\components\language\micropython\extmod\moductypes.c
+ moductypes.c
+ 0
+ 0
+
+
+ 17
+ 226
+ 1
+ 0
+ 0
+ 0
+ ..\..\..\..\components\language\micropython\extmod\moduhashlib.c
+ moduhashlib.c
+ 0
+ 0
+
+
+ 17
+ 227
+ 1
+ 0
+ 0
+ 0
+ ..\..\..\..\components\language\micropython\extmod\moduheapq.c
+ moduheapq.c
+ 0
+ 0
+
+
+ 17
+ 228
+ 1
+ 0
+ 0
+ 0
+ ..\..\..\..\components\language\micropython\extmod\modujson.c
+ modujson.c
+ 0
+ 0
+
+
+ 17
+ 229
+ 1
+ 0
+ 0
+ 0
+ ..\..\..\..\components\language\micropython\extmod\moduos.c
+ moduos.c
+ 0
+ 0
+
+
+ 17
+ 230
+ 1
+ 0
+ 0
+ 0
+ ..\..\..\..\components\language\micropython\extmod\modurandom.c
+ modurandom.c
+ 0
+ 0
+
+
+ 17
+ 231
+ 1
+ 0
+ 0
+ 0
+ ..\..\..\..\components\language\micropython\extmod\modure.c
+ modure.c
+ 0
+ 0
+
+
+ 17
+ 232
+ 1
+ 0
+ 0
+ 0
+ ..\..\..\..\components\language\micropython\extmod\moduselect.c
+ moduselect.c
+ 0
+ 0
+
+
+ 17
+ 233
+ 1
+ 0
+ 0
+ 0
+ ..\..\..\..\components\language\micropython\extmod\moduzlib.c
+ moduzlib.c
+ 0
+ 0
+
+
+ 17
+ 234
+ 1
+ 0
+ 0
+ 0
+ ..\..\..\..\components\language\micropython\extmod\vfs.c
+ vfs.c
+ 0
+ 0
+
+
+ 17
+ 235
+ 1
+ 0
+ 0
+ 0
+ ..\..\..\..\components\language\micropython\extmod\vfs_reader.c
+ vfs_reader.c
+ 0
+ 0
+
+
+ 17
+ 236
+ 1
+ 0
+ 0
+ 0
+ ..\..\..\..\components\language\micropython\extmod\uos_dupterm.c
+ uos_dupterm.c
+ 0
+ 0
+
+
+ 17
+ 237
+ 1
+ 0
+ 0
+ 0
+ ..\..\..\..\components\language\micropython\extmod\utime_mphal.c
+ utime_mphal.c
+ 0
+ 0
+
+
+ 17
+ 238
+ 1
+ 0
+ 0
+ 0
+ ..\..\..\..\components\language\micropython\extmod\machine_signal.c
+ machine_signal.c
+ 0
+ 0
+
+
+ 17
+ 239
+ 1
+ 0
+ 0
+ 0
+ ..\..\..\..\components\language\micropython\extmod\virtpin.c
+ virtpin.c
+ 0
+ 0
+
+
+ 17
+ 240
+ 1
+ 0
+ 0
+ 0
+ ..\..\..\..\components\language\micropython\extmod\machine_mem.c
+ machine_mem.c
+ 0
+ 0
+
+
+ 17
+ 241
+ 1
+ 0
+ 0
+ 0
+ ..\..\..\..\components\language\micropython\extmod\machine_spi.c
+ machine_spi.c
+ 0
+ 0
+
+
+ 17
+ 242
+ 1
+ 0
+ 0
+ 0
+ ..\..\..\..\components\language\micropython\extmod\machine_i2c.c
+ machine_i2c.c
+ 0
+ 0
+
+
+ 17
+ 243
+ 1
+ 0
+ 0
+ 0
+ ..\..\..\..\components\language\micropython\extmod\modnetwork.c
+ modnetwork.c
+ 0
+ 0
+
+
+ 17
+ 244
+ 1
+ 0
+ 0
+ 0
+ ..\..\..\..\components\language\micropython\extmod\modusocket.c
+ modusocket.c
+ 0
+ 0
+
+
+
+
+ micropython/drivers
+ 0
+ 0
+ 0
+ 0
+
+ 18
+ 245
+ 1
+ 0
+ 0
+ 0
+ ..\..\..\..\components\language\micropython\drivers\bus\softspi.c
+ softspi.c
+ 0
+ 0
+
+
+
+
+ micropython/port
+ 0
+ 0
+ 0
+ 0
+
+ 19
+ 246
+ 1
+ 0
+ 0
+ 0
+ ..\..\..\..\components\language\micropython\port\help.c
+ help.c
+ 0
+ 0
+
+
+ 19
+ 247
+ 1
+ 0
+ 0
+ 0
+ ..\..\..\..\components\language\micropython\port\mphalport.c
+ mphalport.c
+ 0
+ 0
+
+
+ 19
+ 248
+ 1
+ 0
+ 0
+ 0
+ ..\..\..\..\components\language\micropython\port\mpmain.c
+ mpmain.c
+ 0
+ 0
+
+
+ 19
+ 249
+ 1
+ 0
+ 0
+ 0
+ ..\..\..\..\components\language\micropython\port\mpthreadport.c
+ mpthreadport.c
+ 0
+ 0
+
+
+ 19
+ 250
+ 1
+ 0
+ 0
+ 0
+ ..\..\..\..\components\language\micropython\port\modules\machine_hw_spi.c
+ machine_hw_spi.c
+ 0
+ 0
+
+
+ 19
+ 251
+ 1
+ 0
+ 0
+ 0
+ ..\..\..\..\components\language\micropython\port\modules\machine_pin.c
+ machine_pin.c
+ 0
+ 0
+
+
+ 19
+ 252
+ 1
+ 0
+ 0
+ 0
+ ..\..\..\..\components\language\micropython\port\modules\machine_timer.c
+ machine_timer.c
+ 0
+ 0
+
+
+ 19
+ 253
+ 1
+ 0
+ 0
+ 0
+ ..\..\..\..\components\language\micropython\port\modules\machine_uart.c
+ machine_uart.c
+ 0
+ 0
+
+
+ 19
+ 254
+ 1
+ 0
+ 0
+ 0
+ ..\..\..\..\components\language\micropython\port\modules\modesp8266.c
+ modesp8266.c
+ 0
+ 0
+
+
+ 19
+ 255
+ 1
+ 0
+ 0
+ 0
+ ..\..\..\..\components\language\micropython\port\modules\modmachine.c
+ modmachine.c
+ 0
+ 0
+
+
+ 19
+ 256
+ 1
+ 0
+ 0
+ 0
+ ..\..\..\..\components\language\micropython\port\modules\modutime.c
+ modutime.c
+ 0
+ 0
+
+
+ 19
+ 257
+ 1
+ 0
+ 0
+ 0
+ ..\..\..\..\components\language\micropython\port\modules\vfs_tos.c
+ vfs_tos.c
+ 0
+ 0
+
+
+ 19
+ 258
+ 1
+ 0
+ 0
+ 0
+ ..\..\..\..\components\language\micropython\port\modules\vfs_tos_file.c
+ vfs_tos_file.c
+ 0
+ 0
+
+
+ 19
+ 259
+ 1
+ 0
+ 0
+ 0
+ ..\micropython_basic_demo\board\mphalboard.c
+ mphalboard.c
+ 0
+ 0
+
+
+
+
+ ::CMSIS
+ 0
+ 0
+ 0
+ 1
+
+
+
diff --git a/board/BearPi_STM32L431RC/KEIL/micropython_extra_demo/BearPi_STM32L31RC.uvprojx b/board/BearPi_STM32L431RC/KEIL/micropython_extra_demo/BearPi_STM32L31RC.uvprojx
new file mode 100644
index 00000000..a53dc0a3
--- /dev/null
+++ b/board/BearPi_STM32L431RC/KEIL/micropython_extra_demo/BearPi_STM32L31RC.uvprojx
@@ -0,0 +1,2137 @@
+
+
+
+ 2.1
+
+ ### uVision Project, (C) Keil Software
+
+
+
+ TencentOS_tiny
+ 0x4
+ ARM-ADS
+ 5060750::V5.06 update 6 (build 750)::ARMCC
+ 0
+
+
+ STM32L431RCTx
+ STMicroelectronics
+ Keil.STM32L4xx_DFP.2.2.0
+ http://www.keil.com/pack
+ IRAM(0x20000000-0x2000FFFF) IROM(0x8000000-0x803FFFF) CLOCK(8000000) FPU2 CPUTYPE("Cortex-M4")
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ $$Device:STM32L431RCTx$CMSIS\SVD\STM32L4x1.svd
+ 0
+ 0
+
+
+
+
+
+
+ 0
+ 0
+ 0
+ 0
+ 1
+
+ .\obj\
+ TencentOS_tiny
+ 1
+ 0
+ 1
+ 1
+ 0
+ .\list\
+ 1
+ 0
+ 0
+
+ 0
+ 0
+
+
+ 0
+ 0
+ 0
+ 0
+
+
+ 0
+ 0
+ cmd.exe /C cd $P..\..\..\..\components\language\micropython\port & make clean-build V=1
+ cmd.exe /C cd $P..\..\..\..\components\language\micropython\port & make genhdr V=1 PYTHON=python PORT_BOARD_DIR=$Pboard TARGET_GENHDR_DIR=$Pgenhdr
+ 0
+ 0
+ 0
+ 0
+
+
+ 0
+ 0
+
+
+ 0
+ 0
+ 0
+ 0
+
+ 0
+
+
+
+ 0
+ 0
+ 0
+ 0
+ 0
+ 1
+ 0
+ 0
+ 0
+ 0
+ 3
+
+
+ 0
+
+
+ SARMCM3.DLL
+ -REMAP -MPU
+ DCM.DLL
+ -pCM4
+ SARMCM3.DLL
+ -MPU
+ TCM.DLL
+ -pCM4
+
+
+
+ 1
+ 0
+ 0
+ 0
+ 16
+
+
+
+
+ 1
+ 0
+ 0
+ 1
+ 1
+ 4096
+
+ 1
+ BIN\UL2CM3.DLL
+ "" ()
+
+
+
+
+ 0
+
+
+
+ 0
+ 1
+ 1
+ 1
+ 1
+ 1
+ 1
+ 1
+ 0
+ 1
+ 1
+ 0
+ 1
+ 1
+ 0
+ 0
+ 1
+ 1
+ 1
+ 1
+ 1
+ 1
+ 1
+ 1
+ 1
+ 0
+ 0
+ "Cortex-M4"
+
+ 0
+ 0
+ 0
+ 1
+ 1
+ 0
+ 0
+ 2
+ 0
+ 0
+ 0
+ 8
+ 1
+ 0
+ 0
+ 0
+ 3
+ 3
+ 0
+ 0
+ 0
+ 0
+ 0
+ 0
+ 0
+ 0
+ 0
+ 0
+ 1
+ 0
+ 0
+ 0
+ 0
+ 1
+ 0
+
+
+ 0
+ 0x0
+ 0x0
+
+
+ 0
+ 0x0
+ 0x0
+
+
+ 0
+ 0x0
+ 0x0
+
+
+ 0
+ 0x0
+ 0x0
+
+
+ 0
+ 0x0
+ 0x0
+
+
+ 0
+ 0x0
+ 0x0
+
+
+ 0
+ 0x20000000
+ 0x10000
+
+
+ 1
+ 0x8000000
+ 0x40000
+
+
+ 0
+ 0x0
+ 0x0
+
+
+ 1
+ 0x90000000
+ 0x800000
+
+
+ 1
+ 0x0
+ 0x0
+
+
+ 1
+ 0x0
+ 0x0
+
+
+ 1
+ 0x8000000
+ 0x40000
+
+
+ 1
+ 0x0
+ 0x0
+
+
+ 0
+ 0x0
+ 0x0
+
+
+ 0
+ 0x0
+ 0x0
+
+
+ 0
+ 0x0
+ 0x0
+
+
+ 0
+ 0x20000000
+ 0x10000
+
+
+ 0
+ 0x0
+ 0x0
+
+
+
+
+
+ 1
+ 1
+ 0
+ 0
+ 1
+ 0
+ 0
+ 0
+ 0
+ 0
+ 2
+ 0
+ 0
+ 1
+ 1
+ 0
+ 1
+ 1
+ 1
+ 1
+ 0
+ 0
+ 0
+
+
+ USE_HAL_DRIVER,STM32L431xx,WITH_TOS_NET_ADAPTER,USE_ESP8266,USE_MICROPYTHON
+
+ ..\..\BSP\Inc;..\..\..\..\platform\vendor_bsp\st\STM32L4xx_HAL_Driver\Inc;..\..\..\..\platform\vendor_bsp\st\STM32L4xx_HAL_Driver\Legacy;..\..\..\..\platform\vendor_bsp\st\CMSIS\Device\ST\STM32L4xx\Include;..\..\..\..\platform\vendor_bsp\st\CMSIS\Include;..\..\..\..\kernel\core\include;..\..\TOS-CONFIG;..\..\..\..\platform\arch\arm\cortex-m4\keil;..\..\..\..\kernel\pm\include;..\..\..\..\osal\cmsis_os;..\..\..\..\arch\arm\arm-v7m\common\include;..\..\..\..\arch\arm\arm-v7m\cortex-m4\armcc;..\..\..\..\net\at\include;..\..\..\..\kernel\hal\include;..\..\..\..\devices\esp8266;..\..\..\..\net\at\include;..\..\..\..\net\sal_module_wrapper;..\..\..\..\net\socket_wrapper\include;..\..\BSP\Hardware\LCD_ST7789;..\..\BSP\Hardware\BH1750;..\..\BSP\Hardware\W25QXX-QSPI;..\..\..\..\examples\micropython_demo;..\..\..\..\components\fs\vfs\include;..\..\..\..\components\fs\fatfs\wrapper\include;..\..\..\..\components\fs\fatfs\3rdparty;..\..\..\..\components\language\micropython;..\..\..\..\components\language\micropython\port;..\..\..\..\components\language\micropython\port\modules;..\micropython_extra_demo;.\board;.\board\hal
+
+
+
+ 1
+ 0
+ 0
+ 0
+ 0
+ 0
+ 0
+ 0
+ 0
+ 0
+
+
+
+
+
+
+
+
+ 1
+ 0
+ 0
+ 0
+ 1
+ 0
+ 0x08000000
+ 0x20000000
+
+
+
+
+
+
+
+
+
+
+
+
+ Application/MDK-ARM
+
+
+ startup_stm32l431xx.s
+ 2
+ startup_stm32l431xx.s
+
+
+
+
+ Application/User
+
+
+ gpio.c
+ 1
+ ..\..\BSP\Src\gpio.c
+
+
+ main.c
+ 1
+ ..\..\BSP\Src\main.c
+
+
+ mcu_init.c
+ 1
+ ..\..\BSP\Src\mcu_init.c
+
+
+ stm32l4xx_hal_msp.c
+ 1
+ ..\..\BSP\Src\stm32l4xx_hal_msp.c
+
+
+ stm32l4xx_it_mpy.c
+ 1
+ ..\..\BSP\Src\stm32l4xx_it_mpy.c
+
+
+ usart.c
+ 1
+ ..\..\BSP\Src\usart.c
+
+
+ adc.c
+ 1
+ ..\..\BSP\Src\adc.c
+
+
+ i2c.c
+ 1
+ ..\..\BSP\Src\i2c.c
+
+
+ spi.c
+ 1
+ ..\..\BSP\Src\spi.c
+
+
+ sdmmc.c
+ 1
+ ..\..\BSP\Src\sdmmc.c
+
+
+ quadspi.c
+ 1
+ ..\..\BSP\Src\quadspi.c
+
+
+
+
+ examples
+
+
+ micropython_demo.c
+ 1
+ ..\..\..\..\examples\micropython_demo\micropython_demo.c
+
+
+
+
+ Drivers/STM32L4xx_HAL_Driver
+
+
+ stm32l4xx_hal_tim.c
+ 1
+ ..\..\..\..\platform\vendor_bsp\st\STM32L4xx_HAL_Driver\Src\stm32l4xx_hal_tim.c
+
+
+ stm32l4xx_hal_tim_ex.c
+ 1
+ ..\..\..\..\platform\vendor_bsp\st\STM32L4xx_HAL_Driver\Src\stm32l4xx_hal_tim_ex.c
+
+
+ stm32l4xx_hal_uart.c
+ 1
+ ..\..\..\..\platform\vendor_bsp\st\STM32L4xx_HAL_Driver\Src\stm32l4xx_hal_uart.c
+
+
+ stm32l4xx_hal_uart_ex.c
+ 1
+ ..\..\..\..\platform\vendor_bsp\st\STM32L4xx_HAL_Driver\Src\stm32l4xx_hal_uart_ex.c
+
+
+ stm32l4xx_hal.c
+ 1
+ ..\..\..\..\platform\vendor_bsp\st\STM32L4xx_HAL_Driver\Src\stm32l4xx_hal.c
+
+
+ stm32l4xx_hal_i2c.c
+ 1
+ ..\..\..\..\platform\vendor_bsp\st\STM32L4xx_HAL_Driver\Src\stm32l4xx_hal_i2c.c
+
+
+ stm32l4xx_hal_i2c_ex.c
+ 1
+ ..\..\..\..\platform\vendor_bsp\st\STM32L4xx_HAL_Driver\Src\stm32l4xx_hal_i2c_ex.c
+
+
+ stm32l4xx_hal_rcc.c
+ 1
+ ..\..\..\..\platform\vendor_bsp\st\STM32L4xx_HAL_Driver\Src\stm32l4xx_hal_rcc.c
+
+
+ stm32l4xx_hal_rcc_ex.c
+ 1
+ ..\..\..\..\platform\vendor_bsp\st\STM32L4xx_HAL_Driver\Src\stm32l4xx_hal_rcc_ex.c
+
+
+ stm32l4xx_hal_flash.c
+ 1
+ ..\..\..\..\platform\vendor_bsp\st\STM32L4xx_HAL_Driver\Src\stm32l4xx_hal_flash.c
+
+
+ stm32l4xx_hal_flash_ex.c
+ 1
+ ..\..\..\..\platform\vendor_bsp\st\STM32L4xx_HAL_Driver\Src\stm32l4xx_hal_flash_ex.c
+
+
+ stm32l4xx_hal_flash_ramfunc.c
+ 1
+ ..\..\..\..\platform\vendor_bsp\st\STM32L4xx_HAL_Driver\Src\stm32l4xx_hal_flash_ramfunc.c
+
+
+ stm32l4xx_hal_gpio.c
+ 1
+ ..\..\..\..\platform\vendor_bsp\st\STM32L4xx_HAL_Driver\Src\stm32l4xx_hal_gpio.c
+
+
+ stm32l4xx_hal_dma.c
+ 1
+ ..\..\..\..\platform\vendor_bsp\st\STM32L4xx_HAL_Driver\Src\stm32l4xx_hal_dma.c
+
+
+ stm32l4xx_hal_dma_ex.c
+ 1
+ ..\..\..\..\platform\vendor_bsp\st\STM32L4xx_HAL_Driver\Src\stm32l4xx_hal_dma_ex.c
+
+
+ stm32l4xx_hal_pwr.c
+ 1
+ ..\..\..\..\platform\vendor_bsp\st\STM32L4xx_HAL_Driver\Src\stm32l4xx_hal_pwr.c
+
+
+ stm32l4xx_hal_pwr_ex.c
+ 1
+ ..\..\..\..\platform\vendor_bsp\st\STM32L4xx_HAL_Driver\Src\stm32l4xx_hal_pwr_ex.c
+
+
+ stm32l4xx_hal_cortex.c
+ 1
+ ..\..\..\..\platform\vendor_bsp\st\STM32L4xx_HAL_Driver\Src\stm32l4xx_hal_cortex.c
+
+
+ stm32l4xx_hal_adc_ex.c
+ 1
+ ..\..\..\..\platform\vendor_bsp\st\STM32L4xx_HAL_Driver\Src\stm32l4xx_hal_adc_ex.c
+
+
+ stm32l4xx_hal_adc.c
+ 1
+ ..\..\..\..\platform\vendor_bsp\st\STM32L4xx_HAL_Driver\Src\stm32l4xx_hal_adc.c
+
+
+ stm32l4xx_hal_dac.c
+ 1
+ ..\..\..\..\platform\vendor_bsp\st\STM32L4xx_HAL_Driver\Src\stm32l4xx_hal_dac.c
+
+
+ stm32l4xx_hal_dac_ex.c
+ 1
+ ..\..\..\..\platform\vendor_bsp\st\STM32L4xx_HAL_Driver\Src\stm32l4xx_hal_dac_ex.c
+
+
+ stm32l4xx_hal_spi.c
+ 1
+ ..\..\..\..\platform\vendor_bsp\st\STM32L4xx_HAL_Driver\Src\stm32l4xx_hal_spi.c
+
+
+ stm32l4xx_hal_spi_ex.c
+ 1
+ ..\..\..\..\platform\vendor_bsp\st\STM32L4xx_HAL_Driver\Src\stm32l4xx_hal_spi_ex.c
+
+
+ stm32l4xx_hal_sd.c
+ 1
+ ..\..\..\..\platform\vendor_bsp\st\STM32L4xx_HAL_Driver\Src\stm32l4xx_hal_sd.c
+
+
+ stm32l4xx_hal_sd_ex.c
+ 1
+ ..\..\..\..\platform\vendor_bsp\st\STM32L4xx_HAL_Driver\Src\stm32l4xx_hal_sd_ex.c
+
+
+ stm32l4xx_ll_sdmmc.c
+ 1
+ ..\..\..\..\platform\vendor_bsp\st\STM32L4xx_HAL_Driver\Src\stm32l4xx_ll_sdmmc.c
+
+
+ stm32l4xx_hal_qspi.c
+ 1
+ ..\..\..\..\platform\vendor_bsp\st\STM32L4xx_HAL_Driver\Src\stm32l4xx_hal_qspi.c
+
+
+
+
+ Drivers/CMSIS
+
+
+ system_stm32l4xx.c
+ 1
+ ..\..\BSP\Src\system_stm32l4xx.c
+
+
+
+
+ Hardware
+
+
+ BH1750.c
+ 1
+ ..\..\BSP\Hardware\BH1750\BH1750.c
+
+
+ lcd_spi2_drv.c
+ 1
+ ..\..\BSP\Hardware\LCD_ST7789\lcd_spi2_drv.c
+
+
+ w25qxx.c
+ 1
+ ..\..\BSP\Hardware\W25QXX-QSPI\w25qxx.c
+
+
+
+
+ kernel
+
+
+ tos_mmblk.c
+ 1
+ ..\..\..\..\kernel\core\tos_mmblk.c
+
+
+ tos_mmheap.c
+ 1
+ ..\..\..\..\kernel\core\tos_mmheap.c
+
+
+ tos_mutex.c
+ 1
+ ..\..\..\..\kernel\core\tos_mutex.c
+
+
+ tos_sched.c
+ 1
+ ..\..\..\..\kernel\core\tos_sched.c
+
+
+ tos_sem.c
+ 1
+ ..\..\..\..\kernel\core\tos_sem.c
+
+
+ tos_sys.c
+ 1
+ ..\..\..\..\kernel\core\tos_sys.c
+
+
+ tos_task.c
+ 1
+ ..\..\..\..\kernel\core\tos_task.c
+
+
+ tos_tick.c
+ 1
+ ..\..\..\..\kernel\core\tos_tick.c
+
+
+ tos_time.c
+ 1
+ ..\..\..\..\kernel\core\tos_time.c
+
+
+ tos_timer.c
+ 1
+ ..\..\..\..\kernel\core\tos_timer.c
+
+
+ tos_event.c
+ 1
+ ..\..\..\..\kernel\core\tos_event.c
+
+
+ tos_global.c
+ 1
+ ..\..\..\..\kernel\core\tos_global.c
+
+
+ tos_pend.c
+ 1
+ ..\..\..\..\kernel\core\tos_pend.c
+
+
+ tos_robin.c
+ 1
+ ..\..\..\..\kernel\core\tos_robin.c
+
+
+ tos_binary_heap.c
+ 1
+ ..\..\..\..\kernel\core\tos_binary_heap.c
+
+
+ tos_char_fifo.c
+ 1
+ ..\..\..\..\kernel\core\tos_char_fifo.c
+
+
+ tos_completion.c
+ 1
+ ..\..\..\..\kernel\core\tos_completion.c
+
+
+ tos_countdownlatch.c
+ 1
+ ..\..\..\..\kernel\core\tos_countdownlatch.c
+
+
+ tos_mail_queue.c
+ 1
+ ..\..\..\..\kernel\core\tos_mail_queue.c
+
+
+ tos_message_queue.c
+ 1
+ ..\..\..\..\kernel\core\tos_message_queue.c
+
+
+ tos_priority_mail_queue.c
+ 1
+ ..\..\..\..\kernel\core\tos_priority_mail_queue.c
+
+
+ tos_priority_message_queue.c
+ 1
+ ..\..\..\..\kernel\core\tos_priority_message_queue.c
+
+
+ tos_priority_queue.c
+ 1
+ ..\..\..\..\kernel\core\tos_priority_queue.c
+
+
+ tos_ring_queue.c
+ 1
+ ..\..\..\..\kernel\core\tos_ring_queue.c
+
+
+ tos_stopwatch.c
+ 1
+ ..\..\..\..\kernel\core\tos_stopwatch.c
+
+
+
+
+ cpu
+
+
+ port_s.S
+ 2
+ ..\..\..\..\arch\arm\arm-v7m\cortex-m4\armcc\port_s.S
+
+
+ tos_cpu.c
+ 1
+ ..\..\..\..\arch\arm\arm-v7m\common\tos_cpu.c
+
+
+ port_c.c
+ 1
+ ..\..\..\..\arch\arm\arm-v7m\cortex-m4\armcc\port_c.c
+
+
+
+
+ config
+
+
+ tos_config.h
+ 5
+ ..\..\TOS-CONFIG\tos_config.h
+
+
+
+
+ hal
+
+
+ tos_hal_uart.c
+ 1
+ ..\..\..\..\platform\hal\st\stm32l4xx\src\tos_hal_uart.c
+
+
+ tos_hal_sd.c
+ 1
+ ..\..\..\..\platform\hal\st\stm32l4xx\src\tos_hal_sd.c
+
+
+ mp_tos_hal_pin.c
+ 1
+ ..\micropython_basic_demo\board\hal\mp_tos_hal_pin.c
+
+
+ mp_tos_hal_spi.c
+ 1
+ ..\micropython_basic_demo\board\hal\mp_tos_hal_spi.c
+
+
+ mp_tos_hal_uart.c
+ 1
+ ..\micropython_basic_demo\board\hal\mp_tos_hal_uart.c
+
+
+
+
+ net
+
+
+ tos_at.c
+ 1
+ ..\..\..\..\net\at\src\tos_at.c
+
+
+ sal_module_wrapper.c
+ 1
+ ..\..\..\..\net\sal_module_wrapper\sal_module_wrapper.c
+
+
+ tos_at_socket.c
+ 1
+ ..\..\..\..\net\socket_wrapper\tos_at_socket.c
+
+
+ tos_at_socket_lib.c
+ 1
+ ..\..\..\..\net\socket_wrapper\tos_at_socket_lib.c
+
+
+ tos_at_socket_prv.c
+ 1
+ ..\..\..\..\net\socket_wrapper\tos_at_socket_prv.c
+
+
+
+
+ devices
+
+
+ esp8266.c
+ 1
+ ..\..\..\..\devices\esp8266\esp8266.c
+
+
+
+
+ vfs
+
+
+ tos_vfs.c
+ 1
+ ..\..\..\..\components\fs\vfs\tos_vfs.c
+
+
+ tos_vfs_device.c
+ 1
+ ..\..\..\..\components\fs\vfs\tos_vfs_device.c
+
+
+ tos_vfs_file.c
+ 1
+ ..\..\..\..\components\fs\vfs\tos_vfs_file.c
+
+
+ tos_vfs_fs.c
+ 1
+ ..\..\..\..\components\fs\vfs\tos_vfs_fs.c
+
+
+ tos_vfs_inode.c
+ 1
+ ..\..\..\..\components\fs\vfs\tos_vfs_inode.c
+
+
+
+
+ fatfs
+
+
+ 0
+ 1
+ 0
+ 0
+ 0
+ 2
+ 2
+ 2
+ 2
+ 2
+ 11
+
+
+ 1
+
+
+
+ 2
+ 0
+ 2
+ 2
+ 2
+ 2
+ 2
+ 2
+ 2
+ 2
+ 0
+ 2
+ 2
+ 2
+ 2
+ 2
+ 0
+ 0
+ 2
+ 2
+ 2
+ 2
+ 2
+
+
+
+
+
+
+
+
+ 2
+ 2
+ 2
+ 2
+ 2
+ 2
+ 2
+ 2
+ 2
+ 2
+
+
+
+
+
+
+
+
+
+
+
+ tos_diskio.c
+ 1
+ ..\..\..\..\components\fs\fatfs\wrapper\tos_diskio.c
+
+
+ tos_fatfs_drv.c
+ 1
+ ..\..\..\..\components\fs\fatfs\wrapper\tos_fatfs_drv.c
+
+
+ tos_fatfs_vfs.c
+ 1
+ ..\..\..\..\components\fs\fatfs\wrapper\tos_fatfs_vfs.c
+
+
+ tos_ff.c
+ 1
+ ..\..\..\..\components\fs\fatfs\wrapper\tos_ff.c
+
+
+ tos_ffsystem.c
+ 1
+ ..\..\..\..\components\fs\fatfs\wrapper\tos_ffsystem.c
+
+
+ tos_ffunicode.c
+ 1
+ ..\..\..\..\components\fs\fatfs\wrapper\tos_ffunicode.c
+
+
+
+
+ micropython/py
+
+
+ 0
+ 1
+ 0
+ 0
+ 0
+ 2
+ 2
+ 2
+ 2
+ 2
+ 11
+
+
+ 1
+
+
+
+ 2
+ 0
+ 2
+ 2
+ 2
+ 2
+ 2
+ 2
+ 2
+ 2
+ 0
+ 2
+ 2
+ 2
+ 2
+ 2
+ 0
+ 0
+ 2
+ 2
+ 2
+ 2
+ 2
+
+
+
+
+
+
+
+
+ 2
+ 2
+ 2
+ 2
+ 2
+ 2
+ 2
+ 2
+ 2
+ 2
+
+
+
+
+
+
+
+
+
+
+
+ argcheck.c
+ 1
+ ..\..\..\..\components\language\micropython\py\argcheck.c
+
+
+ asmarm.c
+ 1
+ ..\..\..\..\components\language\micropython\py\asmarm.c
+
+
+ asmbase.c
+ 1
+ ..\..\..\..\components\language\micropython\py\asmbase.c
+
+
+ asmthumb.c
+ 1
+ ..\..\..\..\components\language\micropython\py\asmthumb.c
+
+
+ asmx64.c
+ 1
+ ..\..\..\..\components\language\micropython\py\asmx64.c
+
+
+ asmx86.c
+ 1
+ ..\..\..\..\components\language\micropython\py\asmx86.c
+
+
+ asmxtensa.c
+ 1
+ ..\..\..\..\components\language\micropython\py\asmxtensa.c
+
+
+ bc.c
+ 1
+ ..\..\..\..\components\language\micropython\py\bc.c
+
+
+ binary.c
+ 1
+ ..\..\..\..\components\language\micropython\py\binary.c
+
+
+ builtinevex.c
+ 1
+ ..\..\..\..\components\language\micropython\py\builtinevex.c
+
+
+ builtinhelp.c
+ 1
+ ..\..\..\..\components\language\micropython\py\builtinhelp.c
+
+
+ builtinimport.c
+ 1
+ ..\..\..\..\components\language\micropython\py\builtinimport.c
+
+
+ compile.c
+ 1
+ ..\..\..\..\components\language\micropython\py\compile.c
+
+
+ emitbc.c
+ 1
+ ..\..\..\..\components\language\micropython\py\emitbc.c
+
+
+ emitcommon.c
+ 1
+ ..\..\..\..\components\language\micropython\py\emitcommon.c
+
+
+ emitglue.c
+ 1
+ ..\..\..\..\components\language\micropython\py\emitglue.c
+
+
+ emitinlinethumb.c
+ 1
+ ..\..\..\..\components\language\micropython\py\emitinlinethumb.c
+
+
+ emitinlinextensa.c
+ 1
+ ..\..\..\..\components\language\micropython\py\emitinlinextensa.c
+
+
+ emitnarm.c
+ 1
+ ..\..\..\..\components\language\micropython\py\emitnarm.c
+
+
+ emitnative.c
+ 1
+ ..\..\..\..\components\language\micropython\py\emitnative.c
+
+
+ emitnthumb.c
+ 1
+ ..\..\..\..\components\language\micropython\py\emitnthumb.c
+
+
+ emitnx64.c
+ 1
+ ..\..\..\..\components\language\micropython\py\emitnx64.c
+
+
+ emitnx86.c
+ 1
+ ..\..\..\..\components\language\micropython\py\emitnx86.c
+
+
+ emitnxtensa.c
+ 1
+ ..\..\..\..\components\language\micropython\py\emitnxtensa.c
+
+
+ emitnxtensawin.c
+ 1
+ ..\..\..\..\components\language\micropython\py\emitnxtensawin.c
+
+
+ formatfloat.c
+ 1
+ ..\..\..\..\components\language\micropython\py\formatfloat.c
+
+
+ frozenmod.c
+ 1
+ ..\..\..\..\components\language\micropython\py\frozenmod.c
+
+
+ gc.c
+ 1
+ ..\..\..\..\components\language\micropython\py\gc.c
+
+
+ lexer.c
+ 1
+ ..\..\..\..\components\language\micropython\py\lexer.c
+
+
+ malloc.c
+ 1
+ ..\..\..\..\components\language\micropython\py\malloc.c
+
+
+ map.c
+ 1
+ ..\..\..\..\components\language\micropython\py\map.c
+
+
+ modarray.c
+ 1
+ ..\..\..\..\components\language\micropython\py\modarray.c
+
+
+ modbuiltins.c
+ 1
+ ..\..\..\..\components\language\micropython\py\modbuiltins.c
+
+
+ modcmath.c
+ 1
+ ..\..\..\..\components\language\micropython\py\modcmath.c
+
+
+ modcollections.c
+ 1
+ ..\..\..\..\components\language\micropython\py\modcollections.c
+
+
+ modgc.c
+ 1
+ ..\..\..\..\components\language\micropython\py\modgc.c
+
+
+ modio.c
+ 1
+ ..\..\..\..\components\language\micropython\py\modio.c
+
+
+ modmath.c
+ 1
+ ..\..\..\..\components\language\micropython\py\modmath.c
+
+
+ modmicropython.c
+ 1
+ ..\..\..\..\components\language\micropython\py\modmicropython.c
+
+
+ modstruct.c
+ 1
+ ..\..\..\..\components\language\micropython\py\modstruct.c
+
+
+ modsys.c
+ 1
+ ..\..\..\..\components\language\micropython\py\modsys.c
+
+
+ modthread.c
+ 1
+ ..\..\..\..\components\language\micropython\py\modthread.c
+
+
+ moduerrno.c
+ 1
+ ..\..\..\..\components\language\micropython\py\moduerrno.c
+
+
+ mpprint.c
+ 1
+ ..\..\..\..\components\language\micropython\py\mpprint.c
+
+
+ mpstate.c
+ 1
+ ..\..\..\..\components\language\micropython\py\mpstate.c
+
+
+ mpz.c
+ 1
+ ..\..\..\..\components\language\micropython\py\mpz.c
+
+
+ nativeglue.c
+ 1
+ ..\..\..\..\components\language\micropython\py\nativeglue.c
+
+
+ nlr.c
+ 1
+ ..\..\..\..\components\language\micropython\py\nlr.c
+
+
+ nlraarch64.c
+ 1
+ ..\..\..\..\components\language\micropython\py\nlraarch64.c
+
+
+ nlrpowerpc.c
+ 1
+ ..\..\..\..\components\language\micropython\py\nlrpowerpc.c
+
+
+ nlrsetjmp.c
+ 1
+ ..\..\..\..\components\language\micropython\py\nlrsetjmp.c
+
+
+ nlrthumb.c
+ 1
+ ..\..\..\..\components\language\micropython\py\nlrthumb.c
+
+
+ nlrx64.c
+ 1
+ ..\..\..\..\components\language\micropython\py\nlrx64.c
+
+
+ nlrx86.c
+ 1
+ ..\..\..\..\components\language\micropython\py\nlrx86.c
+
+
+ nlrxtensa.c
+ 1
+ ..\..\..\..\components\language\micropython\py\nlrxtensa.c
+
+
+ obj.c
+ 1
+ ..\..\..\..\components\language\micropython\py\obj.c
+
+
+ objarray.c
+ 1
+ ..\..\..\..\components\language\micropython\py\objarray.c
+
+
+ objattrtuple.c
+ 1
+ ..\..\..\..\components\language\micropython\py\objattrtuple.c
+
+
+ objbool.c
+ 1
+ ..\..\..\..\components\language\micropython\py\objbool.c
+
+
+ objboundmeth.c
+ 1
+ ..\..\..\..\components\language\micropython\py\objboundmeth.c
+
+
+ objcell.c
+ 1
+ ..\..\..\..\components\language\micropython\py\objcell.c
+
+
+ objclosure.c
+ 1
+ ..\..\..\..\components\language\micropython\py\objclosure.c
+
+
+ objcomplex.c
+ 1
+ ..\..\..\..\components\language\micropython\py\objcomplex.c
+
+
+ objdeque.c
+ 1
+ ..\..\..\..\components\language\micropython\py\objdeque.c
+
+
+ objdict.c
+ 1
+ ..\..\..\..\components\language\micropython\py\objdict.c
+
+
+ objenumerate.c
+ 1
+ ..\..\..\..\components\language\micropython\py\objenumerate.c
+
+
+ objexcept.c
+ 1
+ ..\..\..\..\components\language\micropython\py\objexcept.c
+
+
+ objfilter.c
+ 1
+ ..\..\..\..\components\language\micropython\py\objfilter.c
+
+
+ objfloat.c
+ 1
+ ..\..\..\..\components\language\micropython\py\objfloat.c
+
+
+ objfun.c
+ 1
+ ..\..\..\..\components\language\micropython\py\objfun.c
+
+
+ objgenerator.c
+ 1
+ ..\..\..\..\components\language\micropython\py\objgenerator.c
+
+
+ objgetitemiter.c
+ 1
+ ..\..\..\..\components\language\micropython\py\objgetitemiter.c
+
+
+ objint.c
+ 1
+ ..\..\..\..\components\language\micropython\py\objint.c
+
+
+ objint_longlong.c
+ 1
+ ..\..\..\..\components\language\micropython\py\objint_longlong.c
+
+
+ objint_mpz.c
+ 1
+ ..\..\..\..\components\language\micropython\py\objint_mpz.c
+
+
+ objlist.c
+ 1
+ ..\..\..\..\components\language\micropython\py\objlist.c
+
+
+ objmap.c
+ 1
+ ..\..\..\..\components\language\micropython\py\objmap.c
+
+
+ objmodule.c
+ 1
+ ..\..\..\..\components\language\micropython\py\objmodule.c
+
+
+ objnamedtuple.c
+ 1
+ ..\..\..\..\components\language\micropython\py\objnamedtuple.c
+
+
+ objnone.c
+ 1
+ ..\..\..\..\components\language\micropython\py\objnone.c
+
+
+ objobject.c
+ 1
+ ..\..\..\..\components\language\micropython\py\objobject.c
+
+
+ objpolyiter.c
+ 1
+ ..\..\..\..\components\language\micropython\py\objpolyiter.c
+
+
+ objproperty.c
+ 1
+ ..\..\..\..\components\language\micropython\py\objproperty.c
+
+
+ objrange.c
+ 1
+ ..\..\..\..\components\language\micropython\py\objrange.c
+
+
+ objreversed.c
+ 1
+ ..\..\..\..\components\language\micropython\py\objreversed.c
+
+
+ objset.c
+ 1
+ ..\..\..\..\components\language\micropython\py\objset.c
+
+
+ objsingleton.c
+ 1
+ ..\..\..\..\components\language\micropython\py\objsingleton.c
+
+
+ objslice.c
+ 1
+ ..\..\..\..\components\language\micropython\py\objslice.c
+
+
+ objstr.c
+ 1
+ ..\..\..\..\components\language\micropython\py\objstr.c
+
+
+ objstringio.c
+ 1
+ ..\..\..\..\components\language\micropython\py\objstringio.c
+
+
+ objstrunicode.c
+ 1
+ ..\..\..\..\components\language\micropython\py\objstrunicode.c
+
+
+ objtuple.c
+ 1
+ ..\..\..\..\components\language\micropython\py\objtuple.c
+
+
+ objtype.c
+ 1
+ ..\..\..\..\components\language\micropython\py\objtype.c
+
+
+ objzip.c
+ 1
+ ..\..\..\..\components\language\micropython\py\objzip.c
+
+
+ opmethods.c
+ 1
+ ..\..\..\..\components\language\micropython\py\opmethods.c
+
+
+ pairheap.c
+ 1
+ ..\..\..\..\components\language\micropython\py\pairheap.c
+
+
+ parse.c
+ 1
+ ..\..\..\..\components\language\micropython\py\parse.c
+
+
+ parsenum.c
+ 1
+ ..\..\..\..\components\language\micropython\py\parsenum.c
+
+
+ parsenumbase.c
+ 1
+ ..\..\..\..\components\language\micropython\py\parsenumbase.c
+
+
+ persistentcode.c
+ 1
+ ..\..\..\..\components\language\micropython\py\persistentcode.c
+
+
+ profile.c
+ 1
+ ..\..\..\..\components\language\micropython\py\profile.c
+
+
+ pystack.c
+ 1
+ ..\..\..\..\components\language\micropython\py\pystack.c
+
+
+ qstr.c
+ 1
+ ..\..\..\..\components\language\micropython\py\qstr.c
+
+
+ reader.c
+ 1
+ ..\..\..\..\components\language\micropython\py\reader.c
+
+
+ repl.c
+ 1
+ ..\..\..\..\components\language\micropython\py\repl.c
+
+
+ ringbuf.c
+ 1
+ ..\..\..\..\components\language\micropython\py\ringbuf.c
+
+
+ runtime.c
+ 1
+ ..\..\..\..\components\language\micropython\py\runtime.c
+
+
+ runtime_utils.c
+ 1
+ ..\..\..\..\components\language\micropython\py\runtime_utils.c
+
+
+ scheduler.c
+ 1
+ ..\..\..\..\components\language\micropython\py\scheduler.c
+
+
+ scope.c
+ 1
+ ..\..\..\..\components\language\micropython\py\scope.c
+
+
+ sequence.c
+ 1
+ ..\..\..\..\components\language\micropython\py\sequence.c
+
+
+ showbc.c
+ 1
+ ..\..\..\..\components\language\micropython\py\showbc.c
+
+
+ smallint.c
+ 1
+ ..\..\..\..\components\language\micropython\py\smallint.c
+
+
+ stackctrl.c
+ 1
+ ..\..\..\..\components\language\micropython\py\stackctrl.c
+
+
+ stream.c
+ 1
+ ..\..\..\..\components\language\micropython\py\stream.c
+
+
+ unicode.c
+ 1
+ ..\..\..\..\components\language\micropython\py\unicode.c
+
+
+ vm.c
+ 1
+ ..\..\..\..\components\language\micropython\py\vm.c
+
+
+ vstr.c
+ 1
+ ..\..\..\..\components\language\micropython\py\vstr.c
+
+
+ warning.c
+ 1
+ ..\..\..\..\components\language\micropython\py\warning.c
+
+
+
+
+ micropython/shared
+
+
+ 0
+ 1
+ 0
+ 0
+ 0
+ 2
+ 2
+ 2
+ 2
+ 2
+ 11
+
+
+ 1
+
+
+
+ 2
+ 0
+ 2
+ 2
+ 2
+ 2
+ 2
+ 2
+ 2
+ 2
+ 0
+ 2
+ 2
+ 2
+ 2
+ 2
+ 0
+ 0
+ 2
+ 2
+ 2
+ 2
+ 2
+
+
+
+
+
+
+
+
+ 2
+ 2
+ 2
+ 2
+ 2
+ 2
+ 2
+ 2
+ 2
+ 2
+
+
+
+
+
+
+
+
+
+
+
+ readline.c
+ 1
+ ..\..\..\..\components\language\micropython\shared\readline\readline.c
+
+
+ pyexec.c
+ 1
+ ..\..\..\..\components\language\micropython\shared\runtime\pyexec.c
+
+
+ stdout_helpers.c
+ 1
+ ..\..\..\..\components\language\micropython\shared\runtime\stdout_helpers.c
+
+
+ sys_stdio_mphal.c
+ 1
+ ..\..\..\..\components\language\micropython\shared\runtime\sys_stdio_mphal.c
+
+
+ interrupt_char.c
+ 1
+ ..\..\..\..\components\language\micropython\shared\runtime\interrupt_char.c
+
+
+ netutils.c
+ 1
+ ..\..\..\..\components\language\micropython\shared\netutils\netutils.c
+
+
+
+
+ micropython/extmod
+
+
+ 0
+ 1
+ 0
+ 0
+ 0
+ 2
+ 2
+ 2
+ 2
+ 2
+ 11
+
+
+ 1
+
+
+
+ 2
+ 0
+ 2
+ 2
+ 2
+ 2
+ 2
+ 2
+ 2
+ 2
+ 0
+ 2
+ 2
+ 2
+ 2
+ 2
+ 0
+ 0
+ 2
+ 2
+ 2
+ 2
+ 2
+
+
+
+
+
+
+
+
+ 2
+ 2
+ 2
+ 2
+ 2
+ 2
+ 2
+ 2
+ 2
+ 2
+
+
+
+
+
+
+
+
+
+
+
+ modframebuf.c
+ 1
+ ..\..\..\..\components\language\micropython\extmod\modframebuf.c
+
+
+ moduasyncio.c
+ 1
+ ..\..\..\..\components\language\micropython\extmod\moduasyncio.c
+
+
+ modubinascii.c
+ 1
+ ..\..\..\..\components\language\micropython\extmod\modubinascii.c
+
+
+ moductypes.c
+ 1
+ ..\..\..\..\components\language\micropython\extmod\moductypes.c
+
+
+ moduhashlib.c
+ 1
+ ..\..\..\..\components\language\micropython\extmod\moduhashlib.c
+
+
+ moduheapq.c
+ 1
+ ..\..\..\..\components\language\micropython\extmod\moduheapq.c
+
+
+ modujson.c
+ 1
+ ..\..\..\..\components\language\micropython\extmod\modujson.c
+
+
+ moduos.c
+ 1
+ ..\..\..\..\components\language\micropython\extmod\moduos.c
+
+
+ modurandom.c
+ 1
+ ..\..\..\..\components\language\micropython\extmod\modurandom.c
+
+
+ modure.c
+ 1
+ ..\..\..\..\components\language\micropython\extmod\modure.c
+
+
+ moduselect.c
+ 1
+ ..\..\..\..\components\language\micropython\extmod\moduselect.c
+
+
+ moduzlib.c
+ 1
+ ..\..\..\..\components\language\micropython\extmod\moduzlib.c
+
+
+ vfs.c
+ 1
+ ..\..\..\..\components\language\micropython\extmod\vfs.c
+
+
+ vfs_reader.c
+ 1
+ ..\..\..\..\components\language\micropython\extmod\vfs_reader.c
+
+
+ uos_dupterm.c
+ 1
+ ..\..\..\..\components\language\micropython\extmod\uos_dupterm.c
+
+
+ utime_mphal.c
+ 1
+ ..\..\..\..\components\language\micropython\extmod\utime_mphal.c
+
+
+ machine_signal.c
+ 1
+ ..\..\..\..\components\language\micropython\extmod\machine_signal.c
+
+
+ virtpin.c
+ 1
+ ..\..\..\..\components\language\micropython\extmod\virtpin.c
+
+
+ machine_mem.c
+ 1
+ ..\..\..\..\components\language\micropython\extmod\machine_mem.c
+
+
+ machine_spi.c
+ 1
+ ..\..\..\..\components\language\micropython\extmod\machine_spi.c
+
+
+ machine_i2c.c
+ 1
+ ..\..\..\..\components\language\micropython\extmod\machine_i2c.c
+
+
+ modnetwork.c
+ 1
+ ..\..\..\..\components\language\micropython\extmod\modnetwork.c
+
+
+ modusocket.c
+ 1
+ ..\..\..\..\components\language\micropython\extmod\modusocket.c
+
+
+
+
+ micropython/drivers
+
+
+ 0
+ 1
+ 0
+ 0
+ 0
+ 2
+ 2
+ 2
+ 2
+ 2
+ 11
+
+
+ 1
+
+
+
+ 2
+ 0
+ 2
+ 2
+ 2
+ 2
+ 2
+ 2
+ 2
+ 2
+ 0
+ 2
+ 2
+ 2
+ 2
+ 2
+ 0
+ 0
+ 2
+ 2
+ 2
+ 2
+ 2
+
+
+
+
+
+
+
+
+ 2
+ 2
+ 2
+ 2
+ 2
+ 2
+ 2
+ 2
+ 2
+ 2
+
+
+
+
+
+
+
+
+
+
+
+ softspi.c
+ 1
+ ..\..\..\..\components\language\micropython\drivers\bus\softspi.c
+
+
+
+
+ micropython/port
+
+
+ help.c
+ 1
+ ..\..\..\..\components\language\micropython\port\help.c
+
+
+ mphalport.c
+ 1
+ ..\..\..\..\components\language\micropython\port\mphalport.c
+
+
+ mpmain.c
+ 1
+ ..\..\..\..\components\language\micropython\port\mpmain.c
+
+
+ mpthreadport.c
+ 1
+ ..\..\..\..\components\language\micropython\port\mpthreadport.c
+
+
+ machine_hw_spi.c
+ 1
+ ..\..\..\..\components\language\micropython\port\modules\machine_hw_spi.c
+
+
+ machine_pin.c
+ 1
+ ..\..\..\..\components\language\micropython\port\modules\machine_pin.c
+
+
+ machine_timer.c
+ 1
+ ..\..\..\..\components\language\micropython\port\modules\machine_timer.c
+
+
+ machine_uart.c
+ 1
+ ..\..\..\..\components\language\micropython\port\modules\machine_uart.c
+
+
+ modesp8266.c
+ 1
+ ..\..\..\..\components\language\micropython\port\modules\modesp8266.c
+
+
+ modmachine.c
+ 1
+ ..\..\..\..\components\language\micropython\port\modules\modmachine.c
+
+
+ modutime.c
+ 1
+ ..\..\..\..\components\language\micropython\port\modules\modutime.c
+
+
+ vfs_tos.c
+ 1
+ ..\..\..\..\components\language\micropython\port\modules\vfs_tos.c
+
+
+ vfs_tos_file.c
+ 1
+ ..\..\..\..\components\language\micropython\port\modules\vfs_tos_file.c
+
+
+ mphalboard.c
+ 1
+ ..\micropython_basic_demo\board\mphalboard.c
+
+
+
+
+ ::CMSIS
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/board/BearPi_STM32L431RC/KEIL/micropython_extra_demo/BearPi_W25Q64JV.FLM b/board/BearPi_STM32L431RC/KEIL/micropython_extra_demo/BearPi_W25Q64JV.FLM
new file mode 100644
index 00000000..5b629cb7
Binary files /dev/null and b/board/BearPi_STM32L431RC/KEIL/micropython_extra_demo/BearPi_W25Q64JV.FLM differ
diff --git a/board/BearPi_STM32L431RC/KEIL/micropython_extra_demo/board/hal/mp_tos_hal_pin.c b/board/BearPi_STM32L431RC/KEIL/micropython_extra_demo/board/hal/mp_tos_hal_pin.c
new file mode 100644
index 00000000..1090378b
--- /dev/null
+++ b/board/BearPi_STM32L431RC/KEIL/micropython_extra_demo/board/hal/mp_tos_hal_pin.c
@@ -0,0 +1,273 @@
+#include "tos_k.h"
+#include "mp_tos_hal_pin.h"
+#include "gpio.h"
+
+#define ST_EXTI_VECTOR_SIZE 16
+
+#define ST_PORT_NUM(port) ((uint8_t)((port) >> 4) & 0x0F)
+#define ST_PIN_NUM(port) ((uint8_t)((port) & 0x0F))
+
+__STATIC__ hal_pin_cb_t hal_pin_irq_handler[ST_EXTI_VECTOR_SIZE];
+__STATIC__ void *hal_pin_irq_handler_arg[ST_EXTI_VECTOR_SIZE];
+__STATIC__ GPIO_TypeDef *hal_pin_irq_gpio[ST_EXTI_VECTOR_SIZE];
+
+__STATIC__ const uint8_t nvic_irq_channel[ST_EXTI_VECTOR_SIZE] = {
+ EXTI0_IRQn, EXTI1_IRQn, EXTI2_IRQn, EXTI3_IRQn,
+ EXTI4_IRQn, EXTI9_5_IRQn, EXTI9_5_IRQn, EXTI9_5_IRQn,
+ EXTI9_5_IRQn, EXTI9_5_IRQn, EXTI15_10_IRQn, EXTI15_10_IRQn,
+ EXTI15_10_IRQn, EXTI15_10_IRQn, EXTI15_10_IRQn, EXTI15_10_IRQn,
+};
+
+__STATIC__ int mask2no(uint32_t mask) {
+ for (int i = 0; i < 32; i++) {
+ if ((1U << i) == mask) {
+ return i;
+ }
+ }
+ return -1;
+}
+
+__API__ int tos_hal_pin_init(hal_pin_t *pin, hal_pin_port_t port, hal_pin_mode_t mode)
+{
+ GPIO_TypeDef *gpiox;
+ uint32_t gpio_pin;
+ GPIO_InitTypeDef gpio_init;
+
+ if (!pin) {
+ return -1;
+ }
+
+ gpiox = (GPIO_TypeDef *)(GPIOA_BASE + ST_PORT_NUM(port) * 0x0400UL);
+ gpio_pin = 1UL << ST_PIN_NUM(port);
+
+ gpio_init.Pin = gpio_pin;
+ gpio_init.Speed = GPIO_SPEED_FREQ_HIGH;
+ switch (mode) {
+ case HAL_PIN_MODE_OUTPUT:
+ gpio_init.Mode = GPIO_MODE_OUTPUT_PP;
+ gpio_init.Pull = GPIO_NOPULL;
+ break;
+ case HAL_PIN_MODE_OUTPUT_OD:
+ gpio_init.Mode = GPIO_MODE_OUTPUT_OD;
+ gpio_init.Pull = GPIO_NOPULL;
+ break;
+ case HAL_PIN_MODE_INPUT:
+ gpio_init.Mode = GPIO_MODE_INPUT;
+ gpio_init.Pull = GPIO_NOPULL;
+ break;
+ case HAL_PIN_MODE_INPUT_PULLUP:
+ gpio_init.Mode = GPIO_MODE_INPUT;
+ gpio_init.Pull = GPIO_PULLUP;
+ break;
+ case HAL_PIN_MODE_INPUT_PULLDOWN:
+ gpio_init.Mode = GPIO_MODE_INPUT;
+ gpio_init.Pull = GPIO_PULLDOWN;
+ break;
+ default:
+ return -1;
+ }
+ HAL_GPIO_Init((GPIO_TypeDef *)gpiox, &gpio_init);
+
+ pin->port = port;
+ pin->private_gpio = gpiox;
+ pin->private_pin = gpio_pin;
+ pin->mode = mode;
+
+ return 0;
+}
+
+__API__ int tos_hal_pin_irq(hal_pin_t *pin, hal_pin_irq_t irq)
+{
+ GPIO_TypeDef *gpiox;
+ uint32_t gpio_pin;
+ uint32_t gpio_pin_num;
+ GPIO_InitTypeDef gpio_init;
+ TOS_CPU_CPSR_ALLOC();
+
+ if (!pin) {
+ return -1;
+ }
+
+ if (!pin->private_gpio || !pin->private_pin) {
+ return -1;
+ }
+
+ gpiox = (GPIO_TypeDef *)pin->private_gpio;
+ gpio_pin = (uint32_t)pin->private_pin;
+ gpio_pin_num = mask2no(gpio_pin);
+ if (gpio_pin_num >= ST_EXTI_VECTOR_SIZE) {
+ return -1;
+ }
+
+ TOS_CPU_INT_DISABLE();
+ if (hal_pin_irq_gpio[gpio_pin_num] != NULL && hal_pin_irq_gpio[gpio_pin_num] != gpiox) {
+ TOS_CPU_INT_ENABLE();
+ return -1;
+ }
+
+ if (irq == HAL_PIN_IRQ_NONE) {
+ hal_pin_irq_gpio[gpio_pin_num] = NULL;
+ hal_pin_irq_handler[gpio_pin_num] = NULL;
+ hal_pin_irq_handler_arg[gpio_pin_num] = NULL;
+ TOS_CPU_INT_ENABLE();
+ HAL_NVIC_DisableIRQ(nvic_irq_channel[gpio_pin_num]);
+ } else {
+ hal_pin_irq_gpio[gpio_pin_num] = gpiox;
+ TOS_CPU_INT_ENABLE();
+ gpio_init.Pin = gpio_pin;
+ gpio_init.Speed = GPIO_SPEED_FREQ_HIGH;
+ gpio_init.Mode = GPIO_MODE_IT_RISING_FALLING;
+ switch (irq) {
+ case HAL_PIN_IRQ_RISING:
+ gpio_init.Mode = GPIO_MODE_IT_RISING;
+ break;
+ case HAL_PIN_IRQ_FALLING:
+ gpio_init.Mode = GPIO_MODE_IT_FALLING;
+ break;
+ case HAL_PIN_IRQ_RISING_FALLING:
+ gpio_init.Mode = GPIO_MODE_IT_RISING_FALLING;
+ break;
+ }
+ switch (pin->mode) {
+ case HAL_PIN_MODE_INPUT_PULLUP:
+ gpio_init.Pull = GPIO_PULLUP;
+ break;
+ case HAL_PIN_MODE_INPUT_PULLDOWN:
+ gpio_init.Pull = GPIO_PULLDOWN;
+ break;
+ default:
+ gpio_init.Pull = GPIO_NOPULL;
+ break;
+ }
+ HAL_GPIO_Init(gpiox, &gpio_init);
+ HAL_NVIC_SetPriority(nvic_irq_channel[gpio_pin_num], 2, 0);
+ HAL_NVIC_EnableIRQ(nvic_irq_channel[gpio_pin_num]);
+
+ pin->irq = irq;
+ }
+
+ return 0;
+}
+
+__API__ int tos_hal_pin_irq_callback(hal_pin_t *pin, hal_pin_cb_t callback, void *cb_arg)
+{
+ GPIO_TypeDef *gpiox;
+ uint32_t gpio_pin;
+ uint32_t gpio_pin_num;
+ TOS_CPU_CPSR_ALLOC();
+
+ if (!pin) {
+ return -1;
+ }
+
+ if (!pin->private_gpio || !pin->private_pin) {
+ return -1;
+ }
+
+ gpiox = (GPIO_TypeDef *)pin->private_gpio;
+ gpio_pin = (uint32_t)pin->private_pin;
+ gpio_pin_num = mask2no(gpio_pin);
+ if (gpio_pin_num >= ST_EXTI_VECTOR_SIZE) {
+ return -1;
+ }
+
+ TOS_CPU_INT_DISABLE();
+ if (hal_pin_irq_gpio[gpio_pin_num] != NULL && hal_pin_irq_gpio[gpio_pin_num] != gpiox) {
+ TOS_CPU_INT_ENABLE();
+ return -1;
+ }
+ hal_pin_irq_handler[gpio_pin_num] = gpiox;
+ hal_pin_irq_handler[gpio_pin_num] = callback;
+ hal_pin_irq_handler_arg[gpio_pin_num] = cb_arg;
+ TOS_CPU_INT_ENABLE();
+
+ return 0;
+}
+
+__API__ int tos_hal_pin_write(hal_pin_t *pin, int state)
+{
+ GPIO_TypeDef *gpiox;
+ uint32_t gpio_pin;
+
+ if (!pin) {
+ return -1;
+ }
+
+ if (!pin->private_gpio || !pin->private_pin) {
+ return -1;
+ }
+
+ gpiox = (GPIO_TypeDef *)pin->private_gpio;
+ gpio_pin = (uint32_t)pin->private_pin;
+
+ HAL_GPIO_WritePin(gpiox, gpio_pin, (state == 0) ? GPIO_PIN_RESET : GPIO_PIN_SET);
+
+ return 0;
+}
+
+__API__ int tos_hal_pin_read(hal_pin_t *pin)
+{
+ GPIO_TypeDef *gpiox;
+ uint32_t gpio_pin;
+
+ if (!pin) {
+ return -1;
+ }
+
+ if (!pin->private_gpio || !pin->private_pin) {
+ return -1;
+ }
+
+ gpiox = (GPIO_TypeDef *)pin->private_gpio;
+ gpio_pin = (uint32_t)pin->private_pin;
+
+ return (HAL_GPIO_ReadPin(gpiox, gpio_pin) == GPIO_PIN_RESET) ? 0 : 1;
+}
+
+__API__ int tos_hal_pin_deinit(hal_pin_t *pin)
+{
+ GPIO_TypeDef *gpiox;
+ uint32_t gpio_pin;
+ uint32_t gpio_pin_num;
+ TOS_CPU_CPSR_ALLOC();
+
+ if (!pin) {
+ return -1;
+ }
+
+ if (!pin->private_gpio || !pin->private_pin) {
+ return -1;
+ }
+
+ gpiox = (GPIO_TypeDef *)pin->private_gpio;
+ gpio_pin = (uint32_t)pin->private_pin;
+ gpio_pin_num = mask2no(gpio_pin);
+
+ TOS_CPU_INT_DISABLE();
+ if (hal_pin_irq_gpio[gpio_pin_num] == gpiox) {
+ hal_pin_irq_gpio[gpio_pin_num] = NULL;
+ hal_pin_irq_handler[gpio_pin_num] = NULL;
+ hal_pin_irq_handler_arg[gpio_pin_num] = NULL;
+ }
+ TOS_CPU_INT_ENABLE();
+ HAL_GPIO_DeInit(gpiox, gpio_pin);
+
+ return 0;
+}
+
+void HAL_GPIO_EXTI_Callback(uint16_t GPIO_Pin)
+{
+ uint32_t gpio_pin_num = mask2no(GPIO_Pin);
+ hal_pin_cb_t callback;
+ uint32_t cb_arg;
+ if (gpio_pin_num < ST_EXTI_VECTOR_SIZE) {
+
+ callback = hal_pin_irq_handler[gpio_pin_num];
+ cb_arg = hal_pin_irq_handler_arg[gpio_pin_num];
+ if (callback) {
+ callback(cb_arg);
+ }
+ }
+}
+
+
diff --git a/board/BearPi_STM32L431RC/KEIL/micropython_extra_demo/board/hal/mp_tos_hal_pin.h b/board/BearPi_STM32L431RC/KEIL/micropython_extra_demo/board/hal/mp_tos_hal_pin.h
new file mode 100644
index 00000000..6ac564d1
--- /dev/null
+++ b/board/BearPi_STM32L431RC/KEIL/micropython_extra_demo/board/hal/mp_tos_hal_pin.h
@@ -0,0 +1,45 @@
+#ifndef _TOS_HAL_PIN_H_
+#define _TOS_HAL_PIN_H_
+
+typedef unsigned char hal_pin_port_t;
+
+typedef enum hal_pin_mode_en {
+ HAL_PIN_MODE_OUTPUT = 0,
+ HAL_PIN_MODE_OUTPUT_OD,
+ HAL_PIN_MODE_INPUT,
+ HAL_PIN_MODE_INPUT_PULLUP,
+ HAL_PIN_MODE_INPUT_PULLDOWN,
+} hal_pin_mode_t;
+
+typedef enum hal_pin_irq_en {
+ HAL_PIN_IRQ_NONE = 0x00,
+ HAL_PIN_IRQ_RISING = 0x01,
+ HAL_PIN_IRQ_FALLING = 0x02,
+ HAL_PIN_IRQ_RISING_FALLING = 0x03,
+} hal_pin_irq_t;
+
+typedef struct hal_pin_st {
+ hal_pin_port_t port;
+ void *private_gpio;
+ void *private_pin;
+ hal_pin_mode_t mode;
+ hal_pin_irq_t irq;
+} hal_pin_t;
+
+
+typedef void (*hal_pin_cb_t)(void *arg);
+
+__API__ int tos_hal_pin_init(hal_pin_t *pin, hal_pin_port_t port, hal_pin_mode_t mode);
+
+__API__ int tos_hal_pin_write(hal_pin_t *pin, int state);
+
+__API__ int tos_hal_pin_read(hal_pin_t *pin);
+
+__API__ int tos_hal_pin_mode(hal_pin_t *pin, hal_pin_mode_t mode);
+
+__API__ int tos_hal_pin_irq(hal_pin_t *pin, hal_pin_irq_t irq);
+
+__API__ int tos_hal_pin_irq_callback(hal_pin_t *pin, hal_pin_cb_t callback, void *cb_arg);
+
+
+#endif
diff --git a/board/BearPi_STM32L431RC/KEIL/micropython_extra_demo/board/hal/mp_tos_hal_spi.c b/board/BearPi_STM32L431RC/KEIL/micropython_extra_demo/board/hal/mp_tos_hal_spi.c
new file mode 100644
index 00000000..b4f58be9
--- /dev/null
+++ b/board/BearPi_STM32L431RC/KEIL/micropython_extra_demo/board/hal/mp_tos_hal_spi.c
@@ -0,0 +1,80 @@
+#include "tos_k.h"
+#include "mp_tos_hal_spi.h"
+#include "stm32l4xx_hal.h"
+#include "spi.h"
+
+__API__ int tos_hal_spi_init(hal_spi_t *spi, hal_spi_port_t port)
+{
+ if (!spi) {
+ return -1;
+ }
+
+ if (port == HAL_SPI_PORT_1) {
+ spi->private_spi = &hspi1;
+ MX_SPI1_Init();
+ } else if (port == HAL_SPI_PORT_2) {
+ spi->private_spi = &hspi2;
+ MX_SPI2_Init();
+ } else if (port == HAL_SPI_PORT_3) {
+ spi->private_spi = &hspi3;
+ MX_SPI3_Init();
+ } else {
+ return -1;
+ }
+
+ return 0;
+}
+
+__API__ int tos_hal_spi_transfer(hal_spi_t *spi, const uint8_t *send_buf, uint8_t *recv_buf, size_t size, uint32_t timeout)
+{
+ HAL_StatusTypeDef hal_status;
+ SPI_HandleTypeDef *spi_handle;
+
+ if (!spi || (!send_buf && !recv_buf)) {
+ return -1;
+ }
+
+ if (!spi->private_spi) {
+ return -1;
+ }
+
+ spi_handle = (SPI_HandleTypeDef *)spi->private_spi;
+
+ if (send_buf && recv_buf) {
+ hal_status = HAL_SPI_TransmitReceive(spi_handle, send_buf, recv_buf, size, timeout);
+ } else if (send_buf) {
+ hal_status = HAL_SPI_Transmit(spi_handle, send_buf, size, timeout);
+ } else if (recv_buf) {
+ hal_status = HAL_SPI_Receive(spi_handle, send_buf, size, timeout);
+ }
+
+ if (hal_status != HAL_OK) {
+ return -1;
+ }
+ return 0;
+}
+
+__API__ int tos_hal_spi_deinit(hal_spi_t *spi)
+{
+ HAL_StatusTypeDef hal_status;
+ SPI_HandleTypeDef *spi_handle;
+
+ if (!spi) {
+ return -1;
+ }
+
+ if (!spi->private_spi) {
+ return -1;
+ }
+
+ spi_handle = (SPI_HandleTypeDef *)spi->private_spi;
+
+ hal_status = HAL_SPI_DeInit(spi_handle);
+ HAL_SPI_MspDeInit(spi_handle);
+
+ if (hal_status != HAL_OK) {
+ return -1;
+ }
+
+ return 0;
+}
diff --git a/board/BearPi_STM32L431RC/KEIL/micropython_extra_demo/board/hal/mp_tos_hal_spi.h b/board/BearPi_STM32L431RC/KEIL/micropython_extra_demo/board/hal/mp_tos_hal_spi.h
new file mode 100644
index 00000000..6dad4e9f
--- /dev/null
+++ b/board/BearPi_STM32L431RC/KEIL/micropython_extra_demo/board/hal/mp_tos_hal_spi.h
@@ -0,0 +1,22 @@
+#ifndef _TOS_HAL_SPI_H_
+#define _TOS_HAL_SPI_H_
+
+typedef enum hal_spi_port_en {
+ HAL_SPI_PORT_0 = 0,
+ HAL_SPI_PORT_1,
+ HAL_SPI_PORT_2,
+ HAL_SPI_PORT_3,
+} hal_spi_port_t;
+
+typedef struct hal_spi_st {
+ hal_spi_port_t port;
+ void *private_spi;
+} hal_spi_t;
+
+__API__ int tos_hal_spi_init(hal_spi_t *spi, hal_spi_port_t port);
+
+__API__ int tos_hal_spi_transfer(hal_spi_t *spi, const uint8_t *send_buf, uint8_t *recv_buf, size_t size, uint32_t timeout);
+
+__API__ int tos_hal_spi_deinit(hal_spi_t *spi);
+
+#endif
diff --git a/board/BearPi_STM32L431RC/KEIL/micropython_extra_demo/board/hal/mp_tos_hal_uart.c b/board/BearPi_STM32L431RC/KEIL/micropython_extra_demo/board/hal/mp_tos_hal_uart.c
new file mode 100644
index 00000000..a86dd40d
--- /dev/null
+++ b/board/BearPi_STM32L431RC/KEIL/micropython_extra_demo/board/hal/mp_tos_hal_uart.c
@@ -0,0 +1,26 @@
+#include "tos_k.h"
+#include "mp_tos_hal_uart.h"
+#include "stm32l4xx_hal.h"
+#include "usart.h"
+
+__API__ int tos_hal_uart_recv_start(hal_uart_t *uart, const uint8_t *buf, size_t size)
+{
+ HAL_StatusTypeDef hal_status;
+ UART_HandleTypeDef *uart_handle;
+
+ if (!uart || !buf) {
+ return -1;
+ }
+
+ if (!uart->private_uart) {
+ return -1;
+ }
+
+ uart_handle = (UART_HandleTypeDef *)uart->private_uart;
+
+ hal_status = HAL_UART_Receive_IT(uart_handle, (uint8_t *)buf, size);
+ if (hal_status != HAL_OK) {
+ return -1;
+ }
+ return 0;
+}
diff --git a/board/BearPi_STM32L431RC/KEIL/micropython_extra_demo/board/hal/mp_tos_hal_uart.h b/board/BearPi_STM32L431RC/KEIL/micropython_extra_demo/board/hal/mp_tos_hal_uart.h
new file mode 100644
index 00000000..31b79dbf
--- /dev/null
+++ b/board/BearPi_STM32L431RC/KEIL/micropython_extra_demo/board/hal/mp_tos_hal_uart.h
@@ -0,0 +1,8 @@
+#ifndef _MP_TOS_HAL_UART_H_
+#define _MP_TOS_HAL_UART_H_
+
+#include "tos_hal_uart.h"
+
+__API__ int tos_hal_uart_recv_start(hal_uart_t *uart, const uint8_t *buf, size_t size);
+
+#endif
diff --git a/board/BearPi_STM32L431RC/KEIL/micropython_extra_demo/board/mpconfigboard.h b/board/BearPi_STM32L431RC/KEIL/micropython_extra_demo/board/mpconfigboard.h
new file mode 100644
index 00000000..33fba638
--- /dev/null
+++ b/board/BearPi_STM32L431RC/KEIL/micropython_extra_demo/board/mpconfigboard.h
@@ -0,0 +1,16 @@
+/* board specific config */
+#define MICROPY_HW_BOARD_NAME "BearPi"
+#define MICROPY_HW_MCU_NAME "STM32F431RC"
+
+#define MICROPY_HW_UART_NUM 4
+#define MICROPY_HW_UART_REPL 2
+#define MICROPY_HW_SPI_NUM 4
+
+/* project specific config */
+#define MICROPY_CONFIG_ROM_LEVEL (MICROPY_CONFIG_ROM_LEVEL_EXTRA_FEATURES)
+
+#define MP_USING_QSPI_FLASH
+#define MP_USING_VFS
+#define MP_USING_NETWORK
+#define MP_USING_MACHINE_SPI
+#define MP_USING_MACHINE_I2C
diff --git a/board/BearPi_STM32L431RC/KEIL/micropython_extra_demo/board/mpconfigboard.mk b/board/BearPi_STM32L431RC/KEIL/micropython_extra_demo/board/mpconfigboard.mk
new file mode 100644
index 00000000..e69de29b
diff --git a/board/BearPi_STM32L431RC/KEIL/micropython_extra_demo/board/mphalboard.c b/board/BearPi_STM32L431RC/KEIL/micropython_extra_demo/board/mphalboard.c
new file mode 100644
index 00000000..58d8f0a0
--- /dev/null
+++ b/board/BearPi_STM32L431RC/KEIL/micropython_extra_demo/board/mphalboard.c
@@ -0,0 +1,109 @@
+
+#include "py/mpconfig.h"
+#include "py/mphal.h"
+#include "py/obj.h"
+#include "py/runtime.h"
+
+#include "modmachine.h"
+
+#if !(MP_GEN_HDR)
+#include "tos_k.h"
+#include "main.h"
+#endif
+
+/********************** Tick *************************/
+
+static uint32_t systick_get_us() {
+ // get systick value
+ uint32_t counter = SysTick->VAL;
+ uint32_t load = SysTick->LOAD;
+
+ // convert from decrementing to incrementing
+ counter = load - counter;
+
+ return (counter * 1000) / (load + 1);
+}
+
+mp_uint_t mp_hal_ticks_us(void) {
+ uint32_t ms = tos_tick2millisec(tos_systick_get());
+ uint32_t us = systick_get_us();
+ return ms * 1000 + us;
+}
+
+void mp_hal_delay_us(mp_uint_t usec) {
+ mp_uint_t ms = usec / 1000;
+ mp_uint_t us = usec % 1000;
+ if (ms > 0)
+ mp_hal_delay_ms(ms);
+ mp_uint_t start = mp_hal_ticks_us();
+ while (mp_hal_ticks_us() - start < us) {
+ }
+}
+
+/********************** GPIO *************************/
+
+#define ST_PIN(port_num, pin_num) ((uint8_t)(((port_num) << 4) & 0xF0) | ((pin_num) & 0x0F))
+
+STATIC const mp_rom_map_elem_t machine_pins_locals_dict_table[] = {
+
+ { MP_ROM_QSTR(MP_QSTR_A0), MP_ROM_INT(ST_PIN(0, 0)) },
+ { MP_ROM_QSTR(MP_QSTR_A1), MP_ROM_INT(ST_PIN(0, 1)) },
+ { MP_ROM_QSTR(MP_QSTR_A2), MP_ROM_INT(ST_PIN(0, 2)) },
+ { MP_ROM_QSTR(MP_QSTR_A3), MP_ROM_INT(ST_PIN(0, 3)) },
+ { MP_ROM_QSTR(MP_QSTR_A4), MP_ROM_INT(ST_PIN(0, 4)) },
+ { MP_ROM_QSTR(MP_QSTR_A5), MP_ROM_INT(ST_PIN(0, 5)) },
+ { MP_ROM_QSTR(MP_QSTR_A6), MP_ROM_INT(ST_PIN(0, 6)) },
+ { MP_ROM_QSTR(MP_QSTR_A7), MP_ROM_INT(ST_PIN(0, 7)) },
+ { MP_ROM_QSTR(MP_QSTR_A8), MP_ROM_INT(ST_PIN(0, 8)) },
+ { MP_ROM_QSTR(MP_QSTR_A9), MP_ROM_INT(ST_PIN(0, 9)) },
+ { MP_ROM_QSTR(MP_QSTR_A10), MP_ROM_INT(ST_PIN(0, 10)) },
+ { MP_ROM_QSTR(MP_QSTR_A11), MP_ROM_INT(ST_PIN(0, 11)) },
+ { MP_ROM_QSTR(MP_QSTR_A12), MP_ROM_INT(ST_PIN(0, 12)) },
+ { MP_ROM_QSTR(MP_QSTR_A13), MP_ROM_INT(ST_PIN(0, 13)) },
+ { MP_ROM_QSTR(MP_QSTR_A14), MP_ROM_INT(ST_PIN(0, 14)) },
+ { MP_ROM_QSTR(MP_QSTR_A15), MP_ROM_INT(ST_PIN(0, 15)) },
+
+ { MP_ROM_QSTR(MP_QSTR_B0), MP_ROM_INT(ST_PIN(1, 0)) },
+ { MP_ROM_QSTR(MP_QSTR_B1), MP_ROM_INT(ST_PIN(1, 1)) },
+ { MP_ROM_QSTR(MP_QSTR_B2), MP_ROM_INT(ST_PIN(1, 2)) },
+ { MP_ROM_QSTR(MP_QSTR_B3), MP_ROM_INT(ST_PIN(1, 3)) },
+ { MP_ROM_QSTR(MP_QSTR_B4), MP_ROM_INT(ST_PIN(1, 4)) },
+ { MP_ROM_QSTR(MP_QSTR_B5), MP_ROM_INT(ST_PIN(1, 5)) },
+ { MP_ROM_QSTR(MP_QSTR_B6), MP_ROM_INT(ST_PIN(1, 6)) },
+ { MP_ROM_QSTR(MP_QSTR_B7), MP_ROM_INT(ST_PIN(1, 7)) },
+ { MP_ROM_QSTR(MP_QSTR_B8), MP_ROM_INT(ST_PIN(1, 8)) },
+ { MP_ROM_QSTR(MP_QSTR_B9), MP_ROM_INT(ST_PIN(1, 9)) },
+ { MP_ROM_QSTR(MP_QSTR_B10), MP_ROM_INT(ST_PIN(1, 10)) },
+ { MP_ROM_QSTR(MP_QSTR_B11), MP_ROM_INT(ST_PIN(1, 11)) },
+ { MP_ROM_QSTR(MP_QSTR_B12), MP_ROM_INT(ST_PIN(1, 12)) },
+ { MP_ROM_QSTR(MP_QSTR_B13), MP_ROM_INT(ST_PIN(1, 13)) },
+ { MP_ROM_QSTR(MP_QSTR_B14), MP_ROM_INT(ST_PIN(1, 14)) },
+ { MP_ROM_QSTR(MP_QSTR_B15), MP_ROM_INT(ST_PIN(1, 15)) },
+
+ { MP_ROM_QSTR(MP_QSTR_C0), MP_ROM_INT(ST_PIN(2, 0)) },
+ { MP_ROM_QSTR(MP_QSTR_C1), MP_ROM_INT(ST_PIN(2, 1)) },
+ { MP_ROM_QSTR(MP_QSTR_C2), MP_ROM_INT(ST_PIN(2, 2)) },
+ { MP_ROM_QSTR(MP_QSTR_C3), MP_ROM_INT(ST_PIN(2, 3)) },
+ { MP_ROM_QSTR(MP_QSTR_C4), MP_ROM_INT(ST_PIN(2, 4)) },
+ { MP_ROM_QSTR(MP_QSTR_C5), MP_ROM_INT(ST_PIN(2, 5)) },
+ { MP_ROM_QSTR(MP_QSTR_C6), MP_ROM_INT(ST_PIN(2, 6)) },
+ { MP_ROM_QSTR(MP_QSTR_C7), MP_ROM_INT(ST_PIN(2, 7)) },
+ { MP_ROM_QSTR(MP_QSTR_C8), MP_ROM_INT(ST_PIN(2, 8)) },
+ { MP_ROM_QSTR(MP_QSTR_C9), MP_ROM_INT(ST_PIN(2, 9)) },
+ { MP_ROM_QSTR(MP_QSTR_C10), MP_ROM_INT(ST_PIN(2, 10)) },
+ { MP_ROM_QSTR(MP_QSTR_C11), MP_ROM_INT(ST_PIN(2, 11)) },
+ { MP_ROM_QSTR(MP_QSTR_C12), MP_ROM_INT(ST_PIN(2, 12)) },
+ { MP_ROM_QSTR(MP_QSTR_C13), MP_ROM_INT(ST_PIN(2, 13)) },
+ { MP_ROM_QSTR(MP_QSTR_C14), MP_ROM_INT(ST_PIN(2, 14)) },
+ { MP_ROM_QSTR(MP_QSTR_C15), MP_ROM_INT(ST_PIN(2, 15)) },
+
+ { MP_ROM_QSTR(MP_QSTR_D2), MP_ROM_INT(ST_PIN(3, 2)) },
+
+ { MP_ROM_QSTR(MP_QSTR_LED), MP_ROM_INT(ST_PIN(2, 13)) }, // C13
+ { MP_ROM_QSTR(MP_QSTR_KEY1), MP_ROM_INT(ST_PIN(1, 2)) }, // B2
+ { MP_ROM_QSTR(MP_QSTR_KEY2), MP_ROM_INT(ST_PIN(1, 3)) }, // B3
+
+};
+MP_DEFINE_CONST_DICT(machine_pins_locals_dict, machine_pins_locals_dict_table);
+
+
diff --git a/board/BearPi_STM32L431RC/KEIL/micropython_extra_demo/board/mphalboard.h b/board/BearPi_STM32L431RC/KEIL/micropython_extra_demo/board/mphalboard.h
new file mode 100644
index 00000000..bebb5f6d
--- /dev/null
+++ b/board/BearPi_STM32L431RC/KEIL/micropython_extra_demo/board/mphalboard.h
@@ -0,0 +1,11 @@
+#ifndef _MPHALBOARD_H_
+#define _MPHALBOARD_H_
+
+#include "py/obj.h"
+
+extern mp_uint_t mp_hal_ticks_us(void);
+extern void mp_hal_delay_us(mp_uint_t usec);
+
+extern const mp_obj_dict_t machine_pins_locals_dict;
+
+#endif /* _MPHALBOARD_H_ */
diff --git a/board/BearPi_STM32L431RC/KEIL/micropython_extra_demo/genhdr/moduledefs.h b/board/BearPi_STM32L431RC/KEIL/micropython_extra_demo/genhdr/moduledefs.h
new file mode 100644
index 00000000..6cc5d240
--- /dev/null
+++ b/board/BearPi_STM32L431RC/KEIL/micropython_extra_demo/genhdr/moduledefs.h
@@ -0,0 +1,150 @@
+// Automatically generated by makemoduledefs.py.
+
+extern const struct _mp_obj_module_t mp_module___main__;
+#undef MODULE_DEF_MP_QSTR___MAIN__
+#define MODULE_DEF_MP_QSTR___MAIN__ { MP_ROM_QSTR(MP_QSTR___main__), MP_ROM_PTR(&mp_module___main__) },
+
+extern const struct _mp_obj_module_t mp_module_thread;
+#undef MODULE_DEF_MP_QSTR__THREAD
+#define MODULE_DEF_MP_QSTR__THREAD { MP_ROM_QSTR(MP_QSTR__thread), MP_ROM_PTR(&mp_module_thread) },
+
+extern const struct _mp_obj_module_t mp_module_uasyncio;
+#undef MODULE_DEF_MP_QSTR__UASYNCIO
+#define MODULE_DEF_MP_QSTR__UASYNCIO { MP_ROM_QSTR(MP_QSTR__uasyncio), MP_ROM_PTR(&mp_module_uasyncio) },
+
+extern const struct _mp_obj_module_t mp_module_builtins;
+#undef MODULE_DEF_MP_QSTR_BUILTINS
+#define MODULE_DEF_MP_QSTR_BUILTINS { MP_ROM_QSTR(MP_QSTR_builtins), MP_ROM_PTR(&mp_module_builtins) },
+
+extern const struct _mp_obj_module_t mp_module_cmath;
+#undef MODULE_DEF_MP_QSTR_CMATH
+#define MODULE_DEF_MP_QSTR_CMATH { MP_ROM_QSTR(MP_QSTR_cmath), MP_ROM_PTR(&mp_module_cmath) },
+
+extern const struct _mp_obj_module_t mp_module_framebuf;
+#undef MODULE_DEF_MP_QSTR_FRAMEBUF
+#define MODULE_DEF_MP_QSTR_FRAMEBUF { MP_ROM_QSTR(MP_QSTR_framebuf), MP_ROM_PTR(&mp_module_framebuf) },
+
+extern const struct _mp_obj_module_t mp_module_gc;
+#undef MODULE_DEF_MP_QSTR_GC
+#define MODULE_DEF_MP_QSTR_GC { MP_ROM_QSTR(MP_QSTR_gc), MP_ROM_PTR(&mp_module_gc) },
+
+extern const struct _mp_obj_module_t mp_module_math;
+#undef MODULE_DEF_MP_QSTR_MATH
+#define MODULE_DEF_MP_QSTR_MATH { MP_ROM_QSTR(MP_QSTR_math), MP_ROM_PTR(&mp_module_math) },
+
+extern const struct _mp_obj_module_t mp_module_micropython;
+#undef MODULE_DEF_MP_QSTR_MICROPYTHON
+#define MODULE_DEF_MP_QSTR_MICROPYTHON { MP_ROM_QSTR(MP_QSTR_micropython), MP_ROM_PTR(&mp_module_micropython) },
+
+extern const struct _mp_obj_module_t mp_module_network;
+#undef MODULE_DEF_MP_QSTR_NETWORK
+#define MODULE_DEF_MP_QSTR_NETWORK { MP_ROM_QSTR(MP_QSTR_network), MP_ROM_PTR(&mp_module_network) },
+
+extern const struct _mp_obj_module_t mp_module_uarray;
+#undef MODULE_DEF_MP_QSTR_UARRAY
+#define MODULE_DEF_MP_QSTR_UARRAY { MP_ROM_QSTR(MP_QSTR_uarray), MP_ROM_PTR(&mp_module_uarray) },
+
+extern const struct _mp_obj_module_t mp_module_ubinascii;
+#undef MODULE_DEF_MP_QSTR_UBINASCII
+#define MODULE_DEF_MP_QSTR_UBINASCII { MP_ROM_QSTR(MP_QSTR_ubinascii), MP_ROM_PTR(&mp_module_ubinascii) },
+
+extern const struct _mp_obj_module_t mp_module_collections;
+#undef MODULE_DEF_MP_QSTR_UCOLLECTIONS
+#define MODULE_DEF_MP_QSTR_UCOLLECTIONS { MP_ROM_QSTR(MP_QSTR_ucollections), MP_ROM_PTR(&mp_module_collections) },
+
+extern const struct _mp_obj_module_t mp_module_uctypes;
+#undef MODULE_DEF_MP_QSTR_UCTYPES
+#define MODULE_DEF_MP_QSTR_UCTYPES { MP_ROM_QSTR(MP_QSTR_uctypes), MP_ROM_PTR(&mp_module_uctypes) },
+
+extern const struct _mp_obj_module_t mp_module_uerrno;
+#undef MODULE_DEF_MP_QSTR_UERRNO
+#define MODULE_DEF_MP_QSTR_UERRNO { MP_ROM_QSTR(MP_QSTR_uerrno), MP_ROM_PTR(&mp_module_uerrno) },
+
+extern const struct _mp_obj_module_t mp_module_uhashlib;
+#undef MODULE_DEF_MP_QSTR_UHASHLIB
+#define MODULE_DEF_MP_QSTR_UHASHLIB { MP_ROM_QSTR(MP_QSTR_uhashlib), MP_ROM_PTR(&mp_module_uhashlib) },
+
+extern const struct _mp_obj_module_t mp_module_uheapq;
+#undef MODULE_DEF_MP_QSTR_UHEAPQ
+#define MODULE_DEF_MP_QSTR_UHEAPQ { MP_ROM_QSTR(MP_QSTR_uheapq), MP_ROM_PTR(&mp_module_uheapq) },
+
+extern const struct _mp_obj_module_t mp_module_io;
+#undef MODULE_DEF_MP_QSTR_UIO
+#define MODULE_DEF_MP_QSTR_UIO { MP_ROM_QSTR(MP_QSTR_uio), MP_ROM_PTR(&mp_module_io) },
+
+extern const struct _mp_obj_module_t mp_module_ujson;
+#undef MODULE_DEF_MP_QSTR_UJSON
+#define MODULE_DEF_MP_QSTR_UJSON { MP_ROM_QSTR(MP_QSTR_ujson), MP_ROM_PTR(&mp_module_ujson) },
+
+extern const struct _mp_obj_module_t mp_module_machine;
+#undef MODULE_DEF_MP_QSTR_UMACHINE
+#define MODULE_DEF_MP_QSTR_UMACHINE { MP_ROM_QSTR(MP_QSTR_umachine), MP_ROM_PTR(&mp_module_machine) },
+
+extern const struct _mp_obj_module_t mp_module_uos;
+#undef MODULE_DEF_MP_QSTR_UOS
+#define MODULE_DEF_MP_QSTR_UOS { MP_ROM_QSTR(MP_QSTR_uos), MP_ROM_PTR(&mp_module_uos) },
+
+extern const struct _mp_obj_module_t mp_module_urandom;
+#undef MODULE_DEF_MP_QSTR_URANDOM
+#define MODULE_DEF_MP_QSTR_URANDOM { MP_ROM_QSTR(MP_QSTR_urandom), MP_ROM_PTR(&mp_module_urandom) },
+
+extern const struct _mp_obj_module_t mp_module_ure;
+#undef MODULE_DEF_MP_QSTR_URE
+#define MODULE_DEF_MP_QSTR_URE { MP_ROM_QSTR(MP_QSTR_ure), MP_ROM_PTR(&mp_module_ure) },
+
+extern const struct _mp_obj_module_t mp_module_uselect;
+#undef MODULE_DEF_MP_QSTR_USELECT
+#define MODULE_DEF_MP_QSTR_USELECT { MP_ROM_QSTR(MP_QSTR_uselect), MP_ROM_PTR(&mp_module_uselect) },
+
+extern const struct _mp_obj_module_t mp_module_usocket;
+#undef MODULE_DEF_MP_QSTR_USOCKET
+#define MODULE_DEF_MP_QSTR_USOCKET { MP_ROM_QSTR(MP_QSTR_usocket), MP_ROM_PTR(&mp_module_usocket) },
+
+extern const struct _mp_obj_module_t mp_module_ustruct;
+#undef MODULE_DEF_MP_QSTR_USTRUCT
+#define MODULE_DEF_MP_QSTR_USTRUCT { MP_ROM_QSTR(MP_QSTR_ustruct), MP_ROM_PTR(&mp_module_ustruct) },
+
+extern const struct _mp_obj_module_t mp_module_sys;
+#undef MODULE_DEF_MP_QSTR_USYS
+#define MODULE_DEF_MP_QSTR_USYS { MP_ROM_QSTR(MP_QSTR_usys), MP_ROM_PTR(&mp_module_sys) },
+
+extern const struct _mp_obj_module_t mp_module_utime;
+#undef MODULE_DEF_MP_QSTR_UTIME
+#define MODULE_DEF_MP_QSTR_UTIME { MP_ROM_QSTR(MP_QSTR_utime), MP_ROM_PTR(&mp_module_utime) },
+
+extern const struct _mp_obj_module_t mp_module_uzlib;
+#undef MODULE_DEF_MP_QSTR_UZLIB
+#define MODULE_DEF_MP_QSTR_UZLIB { MP_ROM_QSTR(MP_QSTR_uzlib), MP_ROM_PTR(&mp_module_uzlib) },
+
+
+#define MICROPY_REGISTERED_MODULES \
+ MODULE_DEF_MP_QSTR_BUILTINS \
+ MODULE_DEF_MP_QSTR_CMATH \
+ MODULE_DEF_MP_QSTR_FRAMEBUF \
+ MODULE_DEF_MP_QSTR_GC \
+ MODULE_DEF_MP_QSTR_MATH \
+ MODULE_DEF_MP_QSTR_MICROPYTHON \
+ MODULE_DEF_MP_QSTR_NETWORK \
+ MODULE_DEF_MP_QSTR_UARRAY \
+ MODULE_DEF_MP_QSTR_UBINASCII \
+ MODULE_DEF_MP_QSTR_UCOLLECTIONS \
+ MODULE_DEF_MP_QSTR_UCTYPES \
+ MODULE_DEF_MP_QSTR_UERRNO \
+ MODULE_DEF_MP_QSTR_UHASHLIB \
+ MODULE_DEF_MP_QSTR_UHEAPQ \
+ MODULE_DEF_MP_QSTR_UIO \
+ MODULE_DEF_MP_QSTR_UJSON \
+ MODULE_DEF_MP_QSTR_UMACHINE \
+ MODULE_DEF_MP_QSTR_UOS \
+ MODULE_DEF_MP_QSTR_URANDOM \
+ MODULE_DEF_MP_QSTR_URE \
+ MODULE_DEF_MP_QSTR_USELECT \
+ MODULE_DEF_MP_QSTR_USOCKET \
+ MODULE_DEF_MP_QSTR_USTRUCT \
+ MODULE_DEF_MP_QSTR_USYS \
+ MODULE_DEF_MP_QSTR_UTIME \
+ MODULE_DEF_MP_QSTR_UZLIB \
+ MODULE_DEF_MP_QSTR__THREAD \
+ MODULE_DEF_MP_QSTR__UASYNCIO \
+ MODULE_DEF_MP_QSTR___MAIN__ \
+// MICROPY_REGISTERED_MODULES
diff --git a/board/BearPi_STM32L431RC/KEIL/micropython_extra_demo/genhdr/mpversion.h b/board/BearPi_STM32L431RC/KEIL/micropython_extra_demo/genhdr/mpversion.h
new file mode 100644
index 00000000..28b57595
--- /dev/null
+++ b/board/BearPi_STM32L431RC/KEIL/micropython_extra_demo/genhdr/mpversion.h
@@ -0,0 +1,4 @@
+// This file was generated by py/makeversionhdr.py
+#define MICROPY_GIT_TAG "v2.5.0-73-g0e22ad73-dirty"
+#define MICROPY_GIT_HASH "0e22ad73-dirty"
+#define MICROPY_BUILD_DATE "2022-09-25"
diff --git a/board/BearPi_STM32L431RC/KEIL/micropython_extra_demo/genhdr/qstrdefs.generated.h b/board/BearPi_STM32L431RC/KEIL/micropython_extra_demo/genhdr/qstrdefs.generated.h
new file mode 100644
index 00000000..e6bc9971
--- /dev/null
+++ b/board/BearPi_STM32L431RC/KEIL/micropython_extra_demo/genhdr/qstrdefs.generated.h
@@ -0,0 +1,752 @@
+// This file was automatically generated by makeqstrdata.py
+
+QDEF(MP_QSTRnull, 0, 0, "")
+QDEF(MP_QSTR_, 5381, 0, "")
+QDEF(MP_QSTR___dir__, 36730, 7, "__dir__")
+QDEF(MP_QSTR__0x0a_, 46511, 1, "\x0a")
+QDEF(MP_QSTR__space_, 46469, 1, " ")
+QDEF(MP_QSTR__star_, 46479, 1, "*")
+QDEF(MP_QSTR__slash_, 46474, 1, "/")
+QDEF(MP_QSTR__lt_module_gt_, 38077, 8, "")
+QDEF(MP_QSTR__, 46586, 1, "_")
+QDEF(MP_QSTR___call__, 63911, 8, "__call__")
+QDEF(MP_QSTR___class__, 50475, 9, "__class__")
+QDEF(MP_QSTR___delitem__, 13821, 11, "__delitem__")
+QDEF(MP_QSTR___enter__, 47725, 9, "__enter__")
+QDEF(MP_QSTR___exit__, 63557, 8, "__exit__")
+QDEF(MP_QSTR___getattr__, 63552, 11, "__getattr__")
+QDEF(MP_QSTR___getitem__, 14630, 11, "__getitem__")
+QDEF(MP_QSTR___hash__, 51447, 8, "__hash__")
+QDEF(MP_QSTR___init__, 42335, 8, "__init__")
+QDEF(MP_QSTR___int__, 6934, 7, "__int__")
+QDEF(MP_QSTR___iter__, 13007, 8, "__iter__")
+QDEF(MP_QSTR___len__, 45282, 7, "__len__")
+QDEF(MP_QSTR___main__, 5006, 8, "__main__")
+QDEF(MP_QSTR___module__, 12543, 10, "__module__")
+QDEF(MP_QSTR___name__, 14562, 8, "__name__")
+QDEF(MP_QSTR___new__, 5497, 7, "__new__")
+QDEF(MP_QSTR___next__, 29442, 8, "__next__")
+QDEF(MP_QSTR___qualname__, 107, 12, "__qualname__")
+QDEF(MP_QSTR___repr__, 2832, 8, "__repr__")
+QDEF(MP_QSTR___setitem__, 15922, 11, "__setitem__")
+QDEF(MP_QSTR___str__, 52688, 7, "__str__")
+QDEF(MP_QSTR_ArithmeticError, 35885, 15, "ArithmeticError")
+QDEF(MP_QSTR_AssertionError, 23191, 14, "AssertionError")
+QDEF(MP_QSTR_AttributeError, 56865, 14, "AttributeError")
+QDEF(MP_QSTR_BaseException, 37383, 13, "BaseException")
+QDEF(MP_QSTR_EOFError, 49041, 8, "EOFError")
+QDEF(MP_QSTR_Ellipsis, 57584, 8, "Ellipsis")
+QDEF(MP_QSTR_Exception, 10738, 9, "Exception")
+QDEF(MP_QSTR_GeneratorExit, 25110, 13, "GeneratorExit")
+QDEF(MP_QSTR_ImportError, 39968, 11, "ImportError")
+QDEF(MP_QSTR_IndentationError, 8284, 16, "IndentationError")
+QDEF(MP_QSTR_IndexError, 44419, 10, "IndexError")
+QDEF(MP_QSTR_KeyError, 234, 8, "KeyError")
+QDEF(MP_QSTR_KeyboardInterrupt, 58031, 17, "KeyboardInterrupt")
+QDEF(MP_QSTR_LookupError, 27135, 11, "LookupError")
+QDEF(MP_QSTR_MemoryError, 33756, 11, "MemoryError")
+QDEF(MP_QSTR_NameError, 11706, 9, "NameError")
+QDEF(MP_QSTR_NoneType, 26647, 8, "NoneType")
+QDEF(MP_QSTR_NotImplementedError, 39110, 19, "NotImplementedError")
+QDEF(MP_QSTR_OSError, 26017, 7, "OSError")
+QDEF(MP_QSTR_OverflowError, 57729, 13, "OverflowError")
+QDEF(MP_QSTR_RuntimeError, 61793, 12, "RuntimeError")
+QDEF(MP_QSTR_StopIteration, 7402, 13, "StopIteration")
+QDEF(MP_QSTR_SyntaxError, 36756, 11, "SyntaxError")
+QDEF(MP_QSTR_SystemExit, 65312, 10, "SystemExit")
+QDEF(MP_QSTR_TypeError, 38437, 9, "TypeError")
+QDEF(MP_QSTR_ValueError, 34710, 10, "ValueError")
+QDEF(MP_QSTR_ZeroDivisionError, 10166, 17, "ZeroDivisionError")
+QDEF(MP_QSTR_abs, 12949, 3, "abs")
+QDEF(MP_QSTR_all, 13124, 3, "all")
+QDEF(MP_QSTR_any, 13075, 3, "any")
+QDEF(MP_QSTR_append, 38763, 6, "append")
+QDEF(MP_QSTR_args, 50882, 4, "args")
+QDEF(MP_QSTR_bool, 15595, 4, "bool")
+QDEF(MP_QSTR_builtins, 12791, 8, "builtins")
+QDEF(MP_QSTR_bytearray, 41846, 9, "bytearray")
+QDEF(MP_QSTR_bytecode, 32034, 8, "bytecode")
+QDEF(MP_QSTR_bytes, 45660, 5, "bytes")
+QDEF(MP_QSTR_callable, 28685, 8, "callable")
+QDEF(MP_QSTR_chr, 19676, 3, "chr")
+QDEF(MP_QSTR_classmethod, 36020, 11, "classmethod")
+QDEF(MP_QSTR_clear, 41084, 5, "clear")
+QDEF(MP_QSTR_close, 26419, 5, "close")
+QDEF(MP_QSTR_const, 65472, 5, "const")
+QDEF(MP_QSTR_copy, 56288, 4, "copy")
+QDEF(MP_QSTR_count, 19878, 5, "count")
+QDEF(MP_QSTR_dict, 64575, 4, "dict")
+QDEF(MP_QSTR_dir, 7930, 3, "dir")
+QDEF(MP_QSTR_divmod, 1208, 6, "divmod")
+QDEF(MP_QSTR_end, 8970, 3, "end")
+QDEF(MP_QSTR_endswith, 41755, 8, "endswith")
+QDEF(MP_QSTR_eval, 42651, 4, "eval")
+QDEF(MP_QSTR_exec, 49182, 4, "exec")
+QDEF(MP_QSTR_extend, 59491, 6, "extend")
+QDEF(MP_QSTR_find, 13312, 4, "find")
+QDEF(MP_QSTR_format, 13094, 6, "format")
+QDEF(MP_QSTR_from_bytes, 29749, 10, "from_bytes")
+QDEF(MP_QSTR_get, 15155, 3, "get")
+QDEF(MP_QSTR_getattr, 6080, 7, "getattr")
+QDEF(MP_QSTR_globals, 18845, 7, "globals")
+QDEF(MP_QSTR_hasattr, 45196, 7, "hasattr")
+QDEF(MP_QSTR_hash, 28855, 4, "hash")
+QDEF(MP_QSTR_id, 28456, 2, "id")
+QDEF(MP_QSTR_index, 10363, 5, "index")
+QDEF(MP_QSTR_insert, 21522, 6, "insert")
+QDEF(MP_QSTR_int, 21270, 3, "int")
+QDEF(MP_QSTR_isalpha, 14315, 7, "isalpha")
+QDEF(MP_QSTR_isdigit, 39592, 7, "isdigit")
+QDEF(MP_QSTR_isinstance, 48822, 10, "isinstance")
+QDEF(MP_QSTR_islower, 33020, 7, "islower")
+QDEF(MP_QSTR_isspace, 63579, 7, "isspace")
+QDEF(MP_QSTR_issubclass, 32693, 10, "issubclass")
+QDEF(MP_QSTR_isupper, 42973, 7, "isupper")
+QDEF(MP_QSTR_items, 21475, 5, "items")
+QDEF(MP_QSTR_iter, 8591, 4, "iter")
+QDEF(MP_QSTR_join, 23719, 4, "join")
+QDEF(MP_QSTR_key, 27954, 3, "key")
+QDEF(MP_QSTR_keys, 4865, 4, "keys")
+QDEF(MP_QSTR_len, 16482, 3, "len")
+QDEF(MP_QSTR_list, 7463, 4, "list")
+QDEF(MP_QSTR_little, 27273, 6, "little")
+QDEF(MP_QSTR_locals, 41275, 6, "locals")
+QDEF(MP_QSTR_lower, 52166, 5, "lower")
+QDEF(MP_QSTR_lstrip, 47589, 6, "lstrip")
+QDEF(MP_QSTR_main, 47054, 4, "main")
+QDEF(MP_QSTR_map, 17337, 3, "map")
+QDEF(MP_QSTR_micropython, 31755, 11, "micropython")
+QDEF(MP_QSTR_next, 34882, 4, "next")
+QDEF(MP_QSTR_object, 36240, 6, "object")
+QDEF(MP_QSTR_open, 15057, 4, "open")
+QDEF(MP_QSTR_ord, 24092, 3, "ord")
+QDEF(MP_QSTR_pop, 29482, 3, "pop")
+QDEF(MP_QSTR_popitem, 11455, 7, "popitem")
+QDEF(MP_QSTR_pow, 29485, 3, "pow")
+QDEF(MP_QSTR_print, 50772, 5, "print")
+QDEF(MP_QSTR_range, 24090, 5, "range")
+QDEF(MP_QSTR_read, 63927, 4, "read")
+QDEF(MP_QSTR_readinto, 48971, 8, "readinto")
+QDEF(MP_QSTR_readline, 6649, 8, "readline")
+QDEF(MP_QSTR_remove, 35427, 6, "remove")
+QDEF(MP_QSTR_replace, 9545, 7, "replace")
+QDEF(MP_QSTR_repr, 63440, 4, "repr")
+QDEF(MP_QSTR_reverse, 10789, 7, "reverse")
+QDEF(MP_QSTR_rfind, 40146, 5, "rfind")
+QDEF(MP_QSTR_rindex, 11241, 6, "rindex")
+QDEF(MP_QSTR_round, 9703, 5, "round")
+QDEF(MP_QSTR_rsplit, 165, 6, "rsplit")
+QDEF(MP_QSTR_rstrip, 38203, 6, "rstrip")
+QDEF(MP_QSTR_self, 30585, 4, "self")
+QDEF(MP_QSTR_send, 30393, 4, "send")
+QDEF(MP_QSTR_sep, 36643, 3, "sep")
+QDEF(MP_QSTR_set, 36647, 3, "set")
+QDEF(MP_QSTR_setattr, 43220, 7, "setattr")
+QDEF(MP_QSTR_setdefault, 41836, 10, "setdefault")
+QDEF(MP_QSTR_sort, 40383, 4, "sort")
+QDEF(MP_QSTR_sorted, 5470, 6, "sorted")
+QDEF(MP_QSTR_split, 13239, 5, "split")
+QDEF(MP_QSTR_start, 61317, 5, "start")
+QDEF(MP_QSTR_startswith, 59508, 10, "startswith")
+QDEF(MP_QSTR_staticmethod, 44898, 12, "staticmethod")
+QDEF(MP_QSTR_step, 13911, 4, "step")
+QDEF(MP_QSTR_stop, 13981, 4, "stop")
+QDEF(MP_QSTR_str, 36176, 3, "str")
+QDEF(MP_QSTR_strip, 7721, 5, "strip")
+QDEF(MP_QSTR_sum, 36142, 3, "sum")
+QDEF(MP_QSTR_super, 45764, 5, "super")
+QDEF(MP_QSTR_throw, 17587, 5, "throw")
+QDEF(MP_QSTR_to_bytes, 16088, 8, "to_bytes")
+QDEF(MP_QSTR_tuple, 16893, 5, "tuple")
+QDEF(MP_QSTR_type, 32669, 4, "type")
+QDEF(MP_QSTR_update, 30388, 6, "update")
+QDEF(MP_QSTR_upper, 37927, 5, "upper")
+QDEF(MP_QSTR_utf_hyphen_8, 33463, 5, "utf-8")
+QDEF(MP_QSTR_value, 13390, 5, "value")
+QDEF(MP_QSTR_values, 48765, 6, "values")
+QDEF(MP_QSTR_write, 43160, 5, "write")
+QDEF(MP_QSTR_zip, 44262, 3, "zip")
+QDEF(MP_QSTR___abs__, 54933, 7, "__abs__")
+QDEF(MP_QSTR___add__, 33476, 7, "__add__")
+QDEF(MP_QSTR___aenter__, 33868, 10, "__aenter__")
+QDEF(MP_QSTR___aexit__, 53188, 9, "__aexit__")
+QDEF(MP_QSTR___aiter__, 11086, 9, "__aiter__")
+QDEF(MP_QSTR___and__, 56078, 7, "__and__")
+QDEF(MP_QSTR___anext__, 46211, 9, "__anext__")
+QDEF(MP_QSTR___bases__, 12291, 9, "__bases__")
+QDEF(MP_QSTR___bool__, 25899, 8, "__bool__")
+QDEF(MP_QSTR___build_class__, 34882, 15, "__build_class__")
+QDEF(MP_QSTR___contains__, 24518, 12, "__contains__")
+QDEF(MP_QSTR___del__, 14184, 7, "__del__")
+QDEF(MP_QSTR___delattr__, 30555, 11, "__delattr__")
+QDEF(MP_QSTR___delete__, 60892, 10, "__delete__")
+QDEF(MP_QSTR___dict__, 21631, 8, "__dict__")
+QDEF(MP_QSTR___divmod__, 4472, 10, "__divmod__")
+QDEF(MP_QSTR___eq__, 15985, 6, "__eq__")
+QDEF(MP_QSTR___file__, 21507, 8, "__file__")
+QDEF(MP_QSTR___floordiv__, 24390, 12, "__floordiv__")
+QDEF(MP_QSTR___ge__, 18087, 6, "__ge__")
+QDEF(MP_QSTR___get__, 36787, 7, "__get__")
+QDEF(MP_QSTR___globals__, 44701, 11, "__globals__")
+QDEF(MP_QSTR___gt__, 33462, 6, "__gt__")
+QDEF(MP_QSTR___iadd__, 19053, 8, "__iadd__")
+QDEF(MP_QSTR___iand__, 8615, 8, "__iand__")
+QDEF(MP_QSTR___ifloordiv__, 3919, 13, "__ifloordiv__")
+QDEF(MP_QSTR___ilshift__, 41600, 11, "__ilshift__")
+QDEF(MP_QSTR___imatmul__, 28352, 11, "__imatmul__")
+QDEF(MP_QSTR___imod__, 34378, 8, "__imod__")
+QDEF(MP_QSTR___import__, 15928, 10, "__import__")
+QDEF(MP_QSTR___imul__, 52760, 8, "__imul__")
+QDEF(MP_QSTR___invert__, 30711, 10, "__invert__")
+QDEF(MP_QSTR___ior__, 36849, 7, "__ior__")
+QDEF(MP_QSTR___ipow__, 54660, 8, "__ipow__")
+QDEF(MP_QSTR___irshift__, 63710, 11, "__irshift__")
+QDEF(MP_QSTR___isub__, 30728, 8, "__isub__")
+QDEF(MP_QSTR___itruediv__, 545, 12, "__itruediv__")
+QDEF(MP_QSTR___ixor__, 47369, 8, "__ixor__")
+QDEF(MP_QSTR___le__, 5068, 6, "__le__")
+QDEF(MP_QSTR___lshift__, 34825, 10, "__lshift__")
+QDEF(MP_QSTR___lt__, 26717, 6, "__lt__")
+QDEF(MP_QSTR___matmul__, 62281, 10, "__matmul__")
+QDEF(MP_QSTR___mod__, 14179, 7, "__mod__")
+QDEF(MP_QSTR___mul__, 16945, 7, "__mul__")
+QDEF(MP_QSTR___ne__, 2830, 6, "__ne__")
+QDEF(MP_QSTR___neg__, 54633, 7, "__neg__")
+QDEF(MP_QSTR___or__, 47928, 6, "__or__")
+QDEF(MP_QSTR___path__, 9160, 8, "__path__")
+QDEF(MP_QSTR___pos__, 61481, 7, "__pos__")
+QDEF(MP_QSTR___pow__, 45, 7, "__pow__")
+QDEF(MP_QSTR___radd__, 50454, 8, "__radd__")
+QDEF(MP_QSTR___rand__, 11996, 8, "__rand__")
+QDEF(MP_QSTR___repl_print__, 47872, 14, "__repl_print__")
+QDEF(MP_QSTR___reversed__, 65377, 12, "__reversed__")
+QDEF(MP_QSTR___rfloordiv__, 38996, 13, "__rfloordiv__")
+QDEF(MP_QSTR___rlshift__, 53531, 11, "__rlshift__")
+QDEF(MP_QSTR___rmatmul__, 987, 11, "__rmatmul__")
+QDEF(MP_QSTR___rmod__, 35377, 8, "__rmod__")
+QDEF(MP_QSTR___rmul__, 355, 8, "__rmul__")
+QDEF(MP_QSTR___ror__, 56362, 7, "__ror__")
+QDEF(MP_QSTR___rpow__, 39679, 8, "__rpow__")
+QDEF(MP_QSTR___rrshift__, 40389, 11, "__rrshift__")
+QDEF(MP_QSTR___rshift__, 38999, 10, "__rshift__")
+QDEF(MP_QSTR___rsub__, 30579, 8, "__rsub__")
+QDEF(MP_QSTR___rtruediv__, 55130, 12, "__rtruediv__")
+QDEF(MP_QSTR___rxor__, 34546, 8, "__rxor__")
+QDEF(MP_QSTR___set__, 45991, 7, "__set__")
+QDEF(MP_QSTR___setattr__, 6484, 11, "__setattr__")
+QDEF(MP_QSTR___sub__, 2337, 7, "__sub__")
+QDEF(MP_QSTR___traceback__, 53071, 13, "__traceback__")
+QDEF(MP_QSTR___truediv__, 61320, 11, "__truediv__")
+QDEF(MP_QSTR___xor__, 60448, 7, "__xor__")
+QDEF(MP_QSTR__gt__gt__gt__space_, 44187, 4, ">>> ")
+QDEF(MP_QSTR__dot__dot__dot__space_, 10379, 4, "... ")
+QDEF(MP_QSTR__percent__hash_o, 6764, 3, "%#o")
+QDEF(MP_QSTR__percent__hash_x, 6779, 3, "%#x")
+QDEF(MP_QSTR__brace_open__colon__hash_b_brace_close_, 14168, 5, "{:#b}")
+QDEF(MP_QSTR_maximum_space_recursion_space_depth_space_exceeded, 7795, 32, "maximum recursion depth exceeded")
+QDEF(MP_QSTR__lt_lambda_gt_, 35968, 8, "")
+QDEF(MP_QSTR__lt_listcomp_gt_, 5588, 10, "")
+QDEF(MP_QSTR__lt_dictcomp_gt_, 36300, 10, "")
+QDEF(MP_QSTR__lt_setcomp_gt_, 20820, 9, "")
+QDEF(MP_QSTR__lt_genexpr_gt_, 27188, 9, "")
+QDEF(MP_QSTR__lt_string_gt_, 21330, 8, "")
+QDEF(MP_QSTR__lt_stdin_gt_, 25571, 7, "")
+QDEF(MP_QSTR_A0, 29268, 2, "A0")
+QDEF(MP_QSTR_A1, 29269, 2, "A1")
+QDEF(MP_QSTR_A10, 48325, 3, "A10")
+QDEF(MP_QSTR_A11, 48324, 3, "A11")
+QDEF(MP_QSTR_A12, 48327, 3, "A12")
+QDEF(MP_QSTR_A13, 48326, 3, "A13")
+QDEF(MP_QSTR_A14, 48321, 3, "A14")
+QDEF(MP_QSTR_A15, 48320, 3, "A15")
+QDEF(MP_QSTR_A2, 29270, 2, "A2")
+QDEF(MP_QSTR_A3, 29271, 2, "A3")
+QDEF(MP_QSTR_A4, 29264, 2, "A4")
+QDEF(MP_QSTR_A5, 29265, 2, "A5")
+QDEF(MP_QSTR_A6, 29266, 2, "A6")
+QDEF(MP_QSTR_A7, 29267, 2, "A7")
+QDEF(MP_QSTR_A8, 29276, 2, "A8")
+QDEF(MP_QSTR_A9, 29277, 2, "A9")
+QDEF(MP_QSTR_AF_INET, 47083, 7, "AF_INET")
+QDEF(MP_QSTR_AF_INET6, 46461, 8, "AF_INET6")
+QDEF(MP_QSTR_AP_IF, 38404, 5, "AP_IF")
+QDEF(MP_QSTR_ARRAY, 31324, 5, "ARRAY")
+QDEF(MP_QSTR_B0, 29431, 2, "B0")
+QDEF(MP_QSTR_B1, 29430, 2, "B1")
+QDEF(MP_QSTR_B10, 53638, 3, "B10")
+QDEF(MP_QSTR_B11, 53639, 3, "B11")
+QDEF(MP_QSTR_B12, 53636, 3, "B12")
+QDEF(MP_QSTR_B13, 53637, 3, "B13")
+QDEF(MP_QSTR_B14, 53634, 3, "B14")
+QDEF(MP_QSTR_B15, 53635, 3, "B15")
+QDEF(MP_QSTR_B2, 29429, 2, "B2")
+QDEF(MP_QSTR_B3, 29428, 2, "B3")
+QDEF(MP_QSTR_B4, 29427, 2, "B4")
+QDEF(MP_QSTR_B5, 29426, 2, "B5")
+QDEF(MP_QSTR_B6, 29425, 2, "B6")
+QDEF(MP_QSTR_B7, 29424, 2, "B7")
+QDEF(MP_QSTR_B8, 29439, 2, "B8")
+QDEF(MP_QSTR_B9, 29438, 2, "B9")
+QDEF(MP_QSTR_BFINT16, 58005, 7, "BFINT16")
+QDEF(MP_QSTR_BFINT32, 57939, 7, "BFINT32")
+QDEF(MP_QSTR_BFINT8, 39498, 6, "BFINT8")
+QDEF(MP_QSTR_BFUINT16, 42560, 8, "BFUINT16")
+QDEF(MP_QSTR_BFUINT32, 42502, 8, "BFUINT32")
+QDEF(MP_QSTR_BFUINT8, 44991, 7, "BFUINT8")
+QDEF(MP_QSTR_BF_LEN, 45081, 6, "BF_LEN")
+QDEF(MP_QSTR_BF_POS, 40274, 6, "BF_POS")
+QDEF(MP_QSTR_BIG_ENDIAN, 20991, 10, "BIG_ENDIAN")
+QDEF(MP_QSTR_BytesIO, 46874, 7, "BytesIO")
+QDEF(MP_QSTR_C0, 29334, 2, "C0")
+QDEF(MP_QSTR_C1, 29335, 2, "C1")
+QDEF(MP_QSTR_C10, 50503, 3, "C10")
+QDEF(MP_QSTR_C11, 50502, 3, "C11")
+QDEF(MP_QSTR_C12, 50501, 3, "C12")
+QDEF(MP_QSTR_C13, 50500, 3, "C13")
+QDEF(MP_QSTR_C14, 50499, 3, "C14")
+QDEF(MP_QSTR_C15, 50498, 3, "C15")
+QDEF(MP_QSTR_C2, 29332, 2, "C2")
+QDEF(MP_QSTR_C3, 29333, 2, "C3")
+QDEF(MP_QSTR_C4, 29330, 2, "C4")
+QDEF(MP_QSTR_C5, 29331, 2, "C5")
+QDEF(MP_QSTR_C6, 29328, 2, "C6")
+QDEF(MP_QSTR_C7, 29329, 2, "C7")
+QDEF(MP_QSTR_C8, 29342, 2, "C8")
+QDEF(MP_QSTR_C9, 29343, 2, "C9")
+QDEF(MP_QSTR_CancelledError, 39926, 14, "CancelledError")
+QDEF(MP_QSTR_D2, 29235, 2, "D2")
+QDEF(MP_QSTR_DecompIO, 46995, 8, "DecompIO")
+QDEF(MP_QSTR_EACCES, 49719, 6, "EACCES")
+QDEF(MP_QSTR_EADDRINUSE, 4375, 10, "EADDRINUSE")
+QDEF(MP_QSTR_EAGAIN, 60448, 6, "EAGAIN")
+QDEF(MP_QSTR_EALREADY, 5446, 8, "EALREADY")
+QDEF(MP_QSTR_EBADF, 41825, 5, "EBADF")
+QDEF(MP_QSTR_ECONNABORTED, 43815, 12, "ECONNABORTED")
+QDEF(MP_QSTR_ECONNREFUSED, 11322, 12, "ECONNREFUSED")
+QDEF(MP_QSTR_ECONNRESET, 64281, 10, "ECONNRESET")
+QDEF(MP_QSTR_EEXIST, 44371, 6, "EEXIST")
+QDEF(MP_QSTR_EHOSTUNREACH, 9606, 12, "EHOSTUNREACH")
+QDEF(MP_QSTR_EINPROGRESS, 41114, 11, "EINPROGRESS")
+QDEF(MP_QSTR_EINVAL, 65372, 6, "EINVAL")
+QDEF(MP_QSTR_EIO, 42630, 3, "EIO")
+QDEF(MP_QSTR_EISDIR, 20389, 6, "EISDIR")
+QDEF(MP_QSTR_ENOBUFS, 34787, 7, "ENOBUFS")
+QDEF(MP_QSTR_ENODEV, 26550, 6, "ENODEV")
+QDEF(MP_QSTR_ENOENT, 25950, 6, "ENOENT")
+QDEF(MP_QSTR_ENOMEM, 34212, 6, "ENOMEM")
+QDEF(MP_QSTR_ENOTCONN, 55161, 8, "ENOTCONN")
+QDEF(MP_QSTR_EOPNOTSUPP, 38828, 10, "EOPNOTSUPP")
+QDEF(MP_QSTR_EPERM, 32746, 5, "EPERM")
+QDEF(MP_QSTR_ESP8266, 55433, 7, "ESP8266")
+QDEF(MP_QSTR_ETIMEDOUT, 63743, 9, "ETIMEDOUT")
+QDEF(MP_QSTR_FLOAT32, 34740, 7, "FLOAT32")
+QDEF(MP_QSTR_FLOAT64, 34583, 7, "FLOAT64")
+QDEF(MP_QSTR_FileIO, 5573, 6, "FileIO")
+QDEF(MP_QSTR_FrameBuffer, 48856, 11, "FrameBuffer")
+QDEF(MP_QSTR_FrameBuffer1, 39401, 12, "FrameBuffer1")
+QDEF(MP_QSTR_GS2_HMSB, 49960, 8, "GS2_HMSB")
+QDEF(MP_QSTR_GS4_HMSB, 29550, 8, "GS4_HMSB")
+QDEF(MP_QSTR_GS8, 49321, 3, "GS8")
+QDEF(MP_QSTR_IN, 29474, 2, "IN")
+QDEF(MP_QSTR_INT, 55094, 3, "INT")
+QDEF(MP_QSTR_INT16, 30353, 5, "INT16")
+QDEF(MP_QSTR_INT32, 30295, 5, "INT32")
+QDEF(MP_QSTR_INT64, 30196, 5, "INT64")
+QDEF(MP_QSTR_INT8, 48590, 4, "INT8")
+QDEF(MP_QSTR_IN_PULLDOWN, 47946, 11, "IN_PULLDOWN")
+QDEF(MP_QSTR_IN_PULLUP, 55837, 9, "IN_PULLUP")
+QDEF(MP_QSTR_IOBase, 48694, 6, "IOBase")
+QDEF(MP_QSTR_IRQ_FALLING, 49207, 11, "IRQ_FALLING")
+QDEF(MP_QSTR_IRQ_RISING, 60792, 10, "IRQ_RISING")
+QDEF(MP_QSTR_KEY1, 4963, 4, "KEY1")
+QDEF(MP_QSTR_KEY2, 4960, 4, "KEY2")
+QDEF(MP_QSTR_LED, 56456, 3, "LED")
+QDEF(MP_QSTR_LITTLE_ENDIAN, 23487, 13, "LITTLE_ENDIAN")
+QDEF(MP_QSTR_LONG, 25871, 4, "LONG")
+QDEF(MP_QSTR_LONGLONG, 54405, 8, "LONGLONG")
+QDEF(MP_QSTR_LSB, 57048, 3, "LSB")
+QDEF(MP_QSTR_LockType, 8246, 8, "LockType")
+QDEF(MP_QSTR_MONO_HLSB, 38988, 9, "MONO_HLSB")
+QDEF(MP_QSTR_MONO_HMSB, 33741, 9, "MONO_HMSB")
+QDEF(MP_QSTR_MONO_VLSB, 64530, 9, "MONO_VLSB")
+QDEF(MP_QSTR_MSB, 51801, 3, "MSB")
+QDEF(MP_QSTR_MVLSB, 5123, 5, "MVLSB")
+QDEF(MP_QSTR_NATIVE, 36356, 6, "NATIVE")
+QDEF(MP_QSTR_NotImplemented, 50750, 14, "NotImplemented")
+QDEF(MP_QSTR_ONE_SHOT, 65374, 8, "ONE_SHOT")
+QDEF(MP_QSTR_OPEN_DRAIN, 18526, 10, "OPEN_DRAIN")
+QDEF(MP_QSTR_OUT, 58123, 3, "OUT")
+QDEF(MP_QSTR_OrderedDict, 32496, 11, "OrderedDict")
+QDEF(MP_QSTR_PERIODIC, 13578, 8, "PERIODIC")
+QDEF(MP_QSTR_POLLERR, 49375, 7, "POLLERR")
+QDEF(MP_QSTR_POLLHUP, 35447, 7, "POLLHUP")
+QDEF(MP_QSTR_POLLIN, 24957, 6, "POLLIN")
+QDEF(MP_QSTR_POLLOUT, 34164, 7, "POLLOUT")
+QDEF(MP_QSTR_PTR, 3251, 3, "PTR")
+QDEF(MP_QSTR_Pin, 5138, 3, "Pin")
+QDEF(MP_QSTR_PinBase, 17223, 7, "PinBase")
+QDEF(MP_QSTR_RGB565, 52324, 6, "RGB565")
+QDEF(MP_QSTR_SHORT, 7159, 5, "SHORT")
+QDEF(MP_QSTR_SOCK_DGRAM, 5299, 10, "SOCK_DGRAM")
+QDEF(MP_QSTR_SOCK_RAW, 38602, 8, "SOCK_RAW")
+QDEF(MP_QSTR_SOCK_STREAM, 48690, 11, "SOCK_STREAM")
+QDEF(MP_QSTR_SOL_SOCKET, 57103, 10, "SOL_SOCKET")
+QDEF(MP_QSTR_SO_KEEPALIVE, 41770, 12, "SO_KEEPALIVE")
+QDEF(MP_QSTR_SO_RCVTIMEO, 10459, 11, "SO_RCVTIMEO")
+QDEF(MP_QSTR_SO_REUSEADDR, 21281, 12, "SO_REUSEADDR")
+QDEF(MP_QSTR_SO_SNDTIMEO, 65317, 11, "SO_SNDTIMEO")
+QDEF(MP_QSTR_SPI, 4591, 3, "SPI")
+QDEF(MP_QSTR_STA_IF, 7091, 6, "STA_IF")
+QDEF(MP_QSTR_Signal, 58523, 6, "Signal")
+QDEF(MP_QSTR_SoftI2C, 61971, 7, "SoftI2C")
+QDEF(MP_QSTR_SoftSPI, 22561, 7, "SoftSPI")
+QDEF(MP_QSTR_StopAsyncIteration, 61676, 18, "StopAsyncIteration")
+QDEF(MP_QSTR_StringIO, 30326, 8, "StringIO")
+QDEF(MP_QSTR_Task, 16904, 4, "Task")
+QDEF(MP_QSTR_TaskQueue, 23705, 9, "TaskQueue")
+QDEF(MP_QSTR_TextIOWrapper, 36269, 13, "TextIOWrapper")
+QDEF(MP_QSTR_Timer, 8098, 5, "Timer")
+QDEF(MP_QSTR_UART, 6583, 4, "UART")
+QDEF(MP_QSTR_UINT, 15651, 4, "UINT")
+QDEF(MP_QSTR_UINT16, 6084, 6, "UINT16")
+QDEF(MP_QSTR_UINT32, 6018, 6, "UINT32")
+QDEF(MP_QSTR_UINT64, 6241, 6, "UINT64")
+QDEF(MP_QSTR_UINT8, 57787, 5, "UINT8")
+QDEF(MP_QSTR_ULONG, 36218, 5, "ULONG")
+QDEF(MP_QSTR_ULONGLONG, 50800, 9, "ULONGLONG")
+QDEF(MP_QSTR_USHORT, 62626, 6, "USHORT")
+QDEF(MP_QSTR_UnicodeError, 53538, 12, "UnicodeError")
+QDEF(MP_QSTR_VOID, 62001, 4, "VOID")
+QDEF(MP_QSTR_VfsTos, 55502, 6, "VfsTos")
+QDEF(MP_QSTR__machine, 19391, 8, "_machine")
+QDEF(MP_QSTR__task_queue, 50649, 11, "_task_queue")
+QDEF(MP_QSTR__thread, 724, 7, "_thread")
+QDEF(MP_QSTR__uasyncio, 24527, 9, "_uasyncio")
+QDEF(MP_QSTR_a2b_base64, 2876, 10, "a2b_base64")
+QDEF(MP_QSTR_abs_tol, 28029, 7, "abs_tol")
+QDEF(MP_QSTR_accept, 35205, 6, "accept")
+QDEF(MP_QSTR_acos, 40987, 4, "acos")
+QDEF(MP_QSTR_acquire, 54045, 7, "acquire")
+QDEF(MP_QSTR_add, 12868, 3, "add")
+QDEF(MP_QSTR_addr, 31414, 4, "addr")
+QDEF(MP_QSTR_addressof, 63834, 9, "addressof")
+QDEF(MP_QSTR_addrsize, 37267, 8, "addrsize")
+QDEF(MP_QSTR_alloc_emergency_exception_buf, 10872, 29, "alloc_emergency_exception_buf")
+QDEF(MP_QSTR_allocate_lock, 60908, 13, "allocate_lock")
+QDEF(MP_QSTR_arg, 13457, 3, "arg")
+QDEF(MP_QSTR_argv, 50887, 4, "argv")
+QDEF(MP_QSTR_array, 29308, 5, "array")
+QDEF(MP_QSTR_asin, 58704, 4, "asin")
+QDEF(MP_QSTR_atan, 48671, 4, "atan")
+QDEF(MP_QSTR_atan2, 33229, 5, "atan2")
+QDEF(MP_QSTR_b2a_base64, 36668, 10, "b2a_base64")
+QDEF(MP_QSTR_baudrate, 55541, 8, "baudrate")
+QDEF(MP_QSTR_bin, 18656, 3, "bin")
+QDEF(MP_QSTR_bind, 25732, 4, "bind")
+QDEF(MP_QSTR_bits, 26697, 4, "bits")
+QDEF(MP_QSTR_blit, 20726, 4, "blit")
+QDEF(MP_QSTR_bound_method, 41623, 12, "bound_method")
+QDEF(MP_QSTR_buffer, 41189, 6, "buffer")
+QDEF(MP_QSTR_buffering, 56101, 9, "buffering")
+QDEF(MP_QSTR_bytearray_at, 23708, 12, "bytearray_at")
+QDEF(MP_QSTR_byteorder, 39265, 9, "byteorder")
+QDEF(MP_QSTR_bytes_at, 23990, 8, "bytes_at")
+QDEF(MP_QSTR_calcsize, 14413, 8, "calcsize")
+QDEF(MP_QSTR_callback, 61516, 8, "callback")
+QDEF(MP_QSTR_cancel, 34563, 6, "cancel")
+QDEF(MP_QSTR_ceil, 45062, 4, "ceil")
+QDEF(MP_QSTR_center, 48974, 6, "center")
+QDEF(MP_QSTR_chdir, 45745, 5, "chdir")
+QDEF(MP_QSTR_choice, 13102, 6, "choice")
+QDEF(MP_QSTR_closure, 51828, 7, "closure")
+QDEF(MP_QSTR_cmath, 62646, 5, "cmath")
+QDEF(MP_QSTR_code, 55912, 4, "code")
+QDEF(MP_QSTR_collect, 26011, 7, "collect")
+QDEF(MP_QSTR_compile, 51700, 7, "compile")
+QDEF(MP_QSTR_complex, 40389, 7, "complex")
+QDEF(MP_QSTR_connect, 15835, 7, "connect")
+QDEF(MP_QSTR_copysign, 5171, 8, "copysign")
+QDEF(MP_QSTR_coro, 56244, 4, "coro")
+QDEF(MP_QSTR_cos, 19578, 3, "cos")
+QDEF(MP_QSTR_crc32, 59510, 5, "crc32")
+QDEF(MP_QSTR_cur_task, 11763, 8, "cur_task")
+QDEF(MP_QSTR_data, 56341, 4, "data")
+QDEF(MP_QSTR_decode, 22953, 6, "decode")
+QDEF(MP_QSTR_decompress, 64354, 10, "decompress")
+QDEF(MP_QSTR_default, 32206, 7, "default")
+QDEF(MP_QSTR_degrees, 16642, 7, "degrees")
+QDEF(MP_QSTR_deinit, 36254, 6, "deinit")
+QDEF(MP_QSTR_delattr, 51419, 7, "delattr")
+QDEF(MP_QSTR_deleter, 56174, 7, "deleter")
+QDEF(MP_QSTR_deque, 39173, 5, "deque")
+QDEF(MP_QSTR_dict_view, 43309, 9, "dict_view")
+QDEF(MP_QSTR_difference, 9330, 10, "difference")
+QDEF(MP_QSTR_difference_update, 64156, 17, "difference_update")
+QDEF(MP_QSTR_digest, 50381, 6, "digest")
+QDEF(MP_QSTR_disable, 30353, 7, "disable")
+QDEF(MP_QSTR_discard, 28943, 7, "discard")
+QDEF(MP_QSTR_doc, 7981, 3, "doc")
+QDEF(MP_QSTR_done, 837, 4, "done")
+QDEF(MP_QSTR_dump, 12265, 4, "dump")
+QDEF(MP_QSTR_dumps, 11642, 5, "dumps")
+QDEF(MP_QSTR_e, 46528, 1, "e")
+QDEF(MP_QSTR_enable, 56836, 6, "enable")
+QDEF(MP_QSTR_encode, 51779, 6, "encode")
+QDEF(MP_QSTR_encoding, 39942, 8, "encoding")
+QDEF(MP_QSTR_enumerate, 47729, 9, "enumerate")
+QDEF(MP_QSTR_errno, 4545, 5, "errno")
+QDEF(MP_QSTR_errorcode, 56592, 9, "errorcode")
+QDEF(MP_QSTR_execfile, 10328, 8, "execfile")
+QDEF(MP_QSTR_exit, 48773, 4, "exit")
+QDEF(MP_QSTR_exp, 9416, 3, "exp")
+QDEF(MP_QSTR_fabs, 4755, 4, "fabs")
+QDEF(MP_QSTR_factorial, 13004, 9, "factorial")
+QDEF(MP_QSTR_file, 13507, 4, "file")
+QDEF(MP_QSTR_fileno, 30338, 6, "fileno")
+QDEF(MP_QSTR_fill, 13514, 4, "fill")
+QDEF(MP_QSTR_fill_rect, 60725, 9, "fill_rect")
+QDEF(MP_QSTR_filter, 48677, 6, "filter")
+QDEF(MP_QSTR_firstbit, 14624, 8, "firstbit")
+QDEF(MP_QSTR_float, 17461, 5, "float")
+QDEF(MP_QSTR_floor, 18045, 5, "floor")
+QDEF(MP_QSTR_flush, 49505, 5, "flush")
+QDEF(MP_QSTR_fmod, 17637, 4, "fmod")
+QDEF(MP_QSTR_framebuf, 33385, 8, "framebuf")
+QDEF(MP_QSTR_freq, 15077, 4, "freq")
+QDEF(MP_QSTR_frexp, 38940, 5, "frexp")
+QDEF(MP_QSTR_fromkeys, 48439, 8, "fromkeys")
+QDEF(MP_QSTR_frozenset, 40173, 9, "frozenset")
+QDEF(MP_QSTR_function, 551, 8, "function")
+QDEF(MP_QSTR_gc, 28257, 2, "gc")
+QDEF(MP_QSTR_generator, 50070, 9, "generator")
+QDEF(MP_QSTR_get_ident, 45566, 9, "get_ident")
+QDEF(MP_QSTR_getaddrinfo, 6254, 11, "getaddrinfo")
+QDEF(MP_QSTR_getcwd, 53251, 6, "getcwd")
+QDEF(MP_QSTR_getrandbits, 32102, 11, "getrandbits")
+QDEF(MP_QSTR_getter, 45712, 6, "getter")
+QDEF(MP_QSTR_getvalue, 44152, 8, "getvalue")
+QDEF(MP_QSTR_group, 45242, 5, "group")
+QDEF(MP_QSTR_handler, 24029, 7, "handler")
+QDEF(MP_QSTR_heap_lock, 36013, 9, "heap_lock")
+QDEF(MP_QSTR_heap_unlock, 11606, 11, "heap_unlock")
+QDEF(MP_QSTR_heapify, 11695, 7, "heapify")
+QDEF(MP_QSTR_heappop, 10198, 7, "heappop")
+QDEF(MP_QSTR_heappush, 27527, 8, "heappush")
+QDEF(MP_QSTR_help, 23700, 4, "help")
+QDEF(MP_QSTR_hex, 20592, 3, "hex")
+QDEF(MP_QSTR_hexlify, 32554, 7, "hexlify")
+QDEF(MP_QSTR_hline, 15491, 5, "hline")
+QDEF(MP_QSTR_ilistdir, 27249, 8, "ilistdir")
+QDEF(MP_QSTR_imag, 46919, 4, "imag")
+QDEF(MP_QSTR_implementation, 11543, 14, "implementation")
+QDEF(MP_QSTR_indices, 18522, 7, "indices")
+QDEF(MP_QSTR_inf, 21252, 3, "inf")
+QDEF(MP_QSTR_init, 46111, 4, "init")
+QDEF(MP_QSTR_input, 23155, 5, "input")
+QDEF(MP_QSTR_intersection, 10792, 12, "intersection")
+QDEF(MP_QSTR_intersection_update, 56582, 19, "intersection_update")
+QDEF(MP_QSTR_invert, 183, 6, "invert")
+QDEF(MP_QSTR_ioctl, 49784, 5, "ioctl")
+QDEF(MP_QSTR_ipoll, 23891, 5, "ipoll")
+QDEF(MP_QSTR_irq, 22159, 3, "irq")
+QDEF(MP_QSTR_isclose, 20041, 7, "isclose")
+QDEF(MP_QSTR_isdisjoint, 26871, 10, "isdisjoint")
+QDEF(MP_QSTR_isenabled, 58778, 9, "isenabled")
+QDEF(MP_QSTR_isfinite, 43942, 8, "isfinite")
+QDEF(MP_QSTR_isinf, 4414, 5, "isinf")
+QDEF(MP_QSTR_isnan, 926, 5, "isnan")
+QDEF(MP_QSTR_issubset, 49593, 8, "issubset")
+QDEF(MP_QSTR_issuperset, 60668, 10, "issuperset")
+QDEF(MP_QSTR_iterable, 37413, 8, "iterable")
+QDEF(MP_QSTR_iterator, 48711, 8, "iterator")
+QDEF(MP_QSTR_kbd_intr, 5110, 8, "kbd_intr")
+QDEF(MP_QSTR_keepends, 35682, 8, "keepends")
+QDEF(MP_QSTR_ldexp, 28480, 5, "ldexp")
+QDEF(MP_QSTR_line, 7371, 4, "line")
+QDEF(MP_QSTR_listdir, 58264, 7, "listdir")
+QDEF(MP_QSTR_listen, 3788, 6, "listen")
+QDEF(MP_QSTR_load, 9315, 4, "load")
+QDEF(MP_QSTR_loads, 45232, 5, "loads")
+QDEF(MP_QSTR_lock, 9134, 4, "lock")
+QDEF(MP_QSTR_locked, 47631, 6, "locked")
+QDEF(MP_QSTR_log, 16161, 3, "log")
+QDEF(MP_QSTR_machine, 43872, 7, "machine")
+QDEF(MP_QSTR_makefile, 54721, 8, "makefile")
+QDEF(MP_QSTR_match, 8854, 5, "match")
+QDEF(MP_QSTR_math, 47925, 4, "math")
+QDEF(MP_QSTR_max, 17329, 3, "max")
+QDEF(MP_QSTR_maxsize, 28884, 7, "maxsize")
+QDEF(MP_QSTR_mem, 17440, 3, "mem")
+QDEF(MP_QSTR_mem16, 51719, 5, "mem16")
+QDEF(MP_QSTR_mem32, 51777, 5, "mem32")
+QDEF(MP_QSTR_mem8, 51224, 4, "mem8")
+QDEF(MP_QSTR_mem_alloc, 11090, 9, "mem_alloc")
+QDEF(MP_QSTR_mem_free, 25291, 8, "mem_free")
+QDEF(MP_QSTR_mem_info, 61905, 8, "mem_info")
+QDEF(MP_QSTR_memaddr, 59539, 7, "memaddr")
+QDEF(MP_QSTR_memoryview, 17513, 10, "memoryview")
+QDEF(MP_QSTR_min, 17071, 3, "min")
+QDEF(MP_QSTR_miso, 39069, 4, "miso")
+QDEF(MP_QSTR_mkdir, 46492, 5, "mkdir")
+QDEF(MP_QSTR_mkfs, 45174, 4, "mkfs")
+QDEF(MP_QSTR_mode, 49190, 4, "mode")
+QDEF(MP_QSTR_modf, 49189, 4, "modf")
+QDEF(MP_QSTR_modify, 26357, 6, "modify")
+QDEF(MP_QSTR_module, 39359, 6, "module")
+QDEF(MP_QSTR_modules, 53740, 7, "modules")
+QDEF(MP_QSTR_mosi, 49693, 4, "mosi")
+QDEF(MP_QSTR_mount, 3496, 5, "mount")
+QDEF(MP_QSTR_name, 30114, 4, "name")
+QDEF(MP_QSTR_namedtuple, 5662, 10, "namedtuple")
+QDEF(MP_QSTR_nan, 22756, 3, "nan")
+QDEF(MP_QSTR_network, 10331, 7, "network")
+QDEF(MP_QSTR_newline, 35127, 7, "newline")
+QDEF(MP_QSTR_nodename, 43874, 8, "nodename")
+QDEF(MP_QSTR_oct, 23805, 3, "oct")
+QDEF(MP_QSTR_off, 23690, 3, "off")
+QDEF(MP_QSTR_on, 28516, 2, "on")
+QDEF(MP_QSTR_opt_level, 26503, 9, "opt_level")
+QDEF(MP_QSTR_pack, 53692, 4, "pack")
+QDEF(MP_QSTR_pack_into, 43295, 9, "pack_into")
+QDEF(MP_QSTR_partition, 58759, 9, "partition")
+QDEF(MP_QSTR_path, 52872, 4, "path")
+QDEF(MP_QSTR_peek, 49534, 4, "peek")
+QDEF(MP_QSTR_pend_throw, 29939, 10, "pend_throw")
+QDEF(MP_QSTR_period, 41120, 6, "period")
+QDEF(MP_QSTR_ph_key, 6901, 6, "ph_key")
+QDEF(MP_QSTR_phase, 54634, 5, "phase")
+QDEF(MP_QSTR_pi, 28700, 2, "pi")
+QDEF(MP_QSTR_pixel, 61517, 5, "pixel")
+QDEF(MP_QSTR_platform, 6458, 8, "platform")
+QDEF(MP_QSTR_polar, 3077, 5, "polar")
+QDEF(MP_QSTR_polarity, 60737, 8, "polarity")
+QDEF(MP_QSTR_poll, 55706, 4, "poll")
+QDEF(MP_QSTR_popleft, 39537, 7, "popleft")
+QDEF(MP_QSTR_print_exception, 8732, 15, "print_exception")
+QDEF(MP_QSTR_property, 10690, 8, "property")
+QDEF(MP_QSTR_ps1, 28919, 3, "ps1")
+QDEF(MP_QSTR_ps2, 28916, 3, "ps2")
+QDEF(MP_QSTR_push, 32443, 4, "push")
+QDEF(MP_QSTR_pwd, 28710, 3, "pwd")
+QDEF(MP_QSTR_qstr_info, 33200, 9, "qstr_info")
+QDEF(MP_QSTR_r, 46551, 1, "r")
+QDEF(MP_QSTR_radians, 16263, 7, "radians")
+QDEF(MP_QSTR_randint, 56495, 7, "randint")
+QDEF(MP_QSTR_random, 11454, 6, "random")
+QDEF(MP_QSTR_randrange, 16035, 9, "randrange")
+QDEF(MP_QSTR_rb, 28885, 2, "rb")
+QDEF(MP_QSTR_readblocks, 7213, 10, "readblocks")
+QDEF(MP_QSTR_readfrom, 45377, 8, "readfrom")
+QDEF(MP_QSTR_readfrom_into, 16258, 13, "readfrom_into")
+QDEF(MP_QSTR_readfrom_mem, 25915, 12, "readfrom_mem")
+QDEF(MP_QSTR_readfrom_mem_into, 36408, 17, "readfrom_mem_into")
+QDEF(MP_QSTR_readlines, 22890, 9, "readlines")
+QDEF(MP_QSTR_readonly, 35075, 8, "readonly")
+QDEF(MP_QSTR_real, 63935, 4, "real")
+QDEF(MP_QSTR_rect, 63973, 4, "rect")
+QDEF(MP_QSTR_recv, 63975, 4, "recv")
+QDEF(MP_QSTR_recvfrom, 37009, 8, "recvfrom")
+QDEF(MP_QSTR_register, 41388, 8, "register")
+QDEF(MP_QSTR_rel_tol, 18006, 7, "rel_tol")
+QDEF(MP_QSTR_release, 36844, 7, "release")
+QDEF(MP_QSTR_rename, 6197, 6, "rename")
+QDEF(MP_QSTR_reversed, 28321, 8, "reversed")
+QDEF(MP_QSTR_rmdir, 42821, 5, "rmdir")
+QDEF(MP_QSTR_route, 10300, 5, "route")
+QDEF(MP_QSTR_rpartition, 53269, 10, "rpartition")
+QDEF(MP_QSTR_rxbuf, 26494, 5, "rxbuf")
+QDEF(MP_QSTR_scan, 36378, 4, "scan")
+QDEF(MP_QSTR_schedule, 44256, 8, "schedule")
+QDEF(MP_QSTR_sck, 36862, 3, "sck")
+QDEF(MP_QSTR_scl, 36857, 3, "scl")
+QDEF(MP_QSTR_scroll, 23080, 6, "scroll")
+QDEF(MP_QSTR_sda, 36691, 3, "sda")
+QDEF(MP_QSTR_search, 49579, 6, "search")
+QDEF(MP_QSTR_seed, 30098, 4, "seed")
+QDEF(MP_QSTR_seek, 30109, 4, "seek")
+QDEF(MP_QSTR_select, 16781, 6, "select")
+QDEF(MP_QSTR_sendall, 40760, 7, "sendall")
+QDEF(MP_QSTR_sendto, 802, 6, "sendto")
+QDEF(MP_QSTR_separators, 3307, 10, "separators")
+QDEF(MP_QSTR_setblocking, 6254, 11, "setblocking")
+QDEF(MP_QSTR_setsockopt, 59448, 10, "setsockopt")
+QDEF(MP_QSTR_setter, 22788, 6, "setter")
+QDEF(MP_QSTR_settimeout, 35548, 10, "settimeout")
+QDEF(MP_QSTR_sha256, 302, 6, "sha256")
+QDEF(MP_QSTR_sin, 37041, 3, "sin")
+QDEF(MP_QSTR_single, 8255, 6, "single")
+QDEF(MP_QSTR_sizeof, 29513, 6, "sizeof")
+QDEF(MP_QSTR_sleep, 10218, 5, "sleep")
+QDEF(MP_QSTR_sleep_ms, 25355, 8, "sleep_ms")
+QDEF(MP_QSTR_slice, 62645, 5, "slice")
+QDEF(MP_QSTR_socket, 52320, 6, "socket")
+QDEF(MP_QSTR_soft_reset, 26081, 10, "soft_reset")
+QDEF(MP_QSTR_splitlines, 54122, 10, "splitlines")
+QDEF(MP_QSTR_sqrt, 17441, 4, "sqrt")
+QDEF(MP_QSTR_ssid, 19208, 4, "ssid")
+QDEF(MP_QSTR_stack_size, 15153, 10, "stack_size")
+QDEF(MP_QSTR_stack_use, 63383, 9, "stack_use")
+QDEF(MP_QSTR_start_new_thread, 9687, 16, "start_new_thread")
+QDEF(MP_QSTR_stat, 13783, 4, "stat")
+QDEF(MP_QSTR_state, 61650, 5, "state")
+QDEF(MP_QSTR_statvfs, 6420, 7, "statvfs")
+QDEF(MP_QSTR_stderr, 22691, 6, "stderr")
+QDEF(MP_QSTR_stdin, 1057, 5, "stdin")
+QDEF(MP_QSTR_stdout, 33544, 6, "stdout")
+QDEF(MP_QSTR_struct, 36882, 6, "struct")
+QDEF(MP_QSTR_sub, 36129, 3, "sub")
+QDEF(MP_QSTR_symmetric_difference, 26574, 20, "symmetric_difference")
+QDEF(MP_QSTR_symmetric_difference_update, 63584, 27, "symmetric_difference_update")
+QDEF(MP_QSTR_sync, 25250, 4, "sync")
+QDEF(MP_QSTR_sys, 36540, 3, "sys")
+QDEF(MP_QSTR_sysname, 13979, 7, "sysname")
+QDEF(MP_QSTR_tan, 25086, 3, "tan")
+QDEF(MP_QSTR_tau, 25061, 3, "tau")
+QDEF(MP_QSTR_tell, 45332, 4, "tell")
+QDEF(MP_QSTR_text, 44952, 4, "text")
+QDEF(MP_QSTR_threshold, 12274, 9, "threshold")
+QDEF(MP_QSTR_tick_hz, 56189, 7, "tick_hz")
+QDEF(MP_QSTR_ticks_add, 44701, 9, "ticks_add")
+QDEF(MP_QSTR_ticks_cpu, 42266, 9, "ticks_cpu")
+QDEF(MP_QSTR_ticks_diff, 57521, 10, "ticks_diff")
+QDEF(MP_QSTR_ticks_ms, 12866, 8, "ticks_ms")
+QDEF(MP_QSTR_timeout, 21566, 7, "timeout")
+QDEF(MP_QSTR_timeout_char, 19065, 12, "timeout_char")
+QDEF(MP_QSTR_trigger, 35997, 7, "trigger")
+QDEF(MP_QSTR_trunc, 39259, 5, "trunc")
+QDEF(MP_QSTR_uarray, 34441, 6, "uarray")
+QDEF(MP_QSTR_ubinascii, 35012, 9, "ubinascii")
+QDEF(MP_QSTR_ucollections, 39445, 12, "ucollections")
+QDEF(MP_QSTR_uctypes, 29176, 7, "uctypes")
+QDEF(MP_QSTR_uerrno, 59828, 6, "uerrno")
+QDEF(MP_QSTR_uhashlib, 40293, 8, "uhashlib")
+QDEF(MP_QSTR_uheapq, 17181, 6, "uheapq")
+QDEF(MP_QSTR_uio, 26294, 3, "uio")
+QDEF(MP_QSTR_ujson, 12520, 5, "ujson")
+QDEF(MP_QSTR_umachine, 32661, 8, "umachine")
+QDEF(MP_QSTR_umount, 40669, 6, "umount")
+QDEF(MP_QSTR_uname, 40119, 5, "uname")
+QDEF(MP_QSTR_unhexlify, 47537, 9, "unhexlify")
+QDEF(MP_QSTR_uniform, 62721, 7, "uniform")
+QDEF(MP_QSTR_union, 31990, 5, "union")
+QDEF(MP_QSTR_unlink, 36862, 6, "unlink")
+QDEF(MP_QSTR_unpack, 15367, 6, "unpack")
+QDEF(MP_QSTR_unpack_from, 27918, 11, "unpack_from")
+QDEF(MP_QSTR_unregister, 54295, 10, "unregister")
+QDEF(MP_QSTR_uos, 26604, 3, "uos")
+QDEF(MP_QSTR_urandom, 44715, 7, "urandom")
+QDEF(MP_QSTR_ure, 25479, 3, "ure")
+QDEF(MP_QSTR_uselect, 36440, 7, "uselect")
+QDEF(MP_QSTR_usocket, 117, 7, "usocket")
+QDEF(MP_QSTR_ustruct, 2119, 7, "ustruct")
+QDEF(MP_QSTR_usys, 62409, 4, "usys")
+QDEF(MP_QSTR_utime, 40421, 5, "utime")
+QDEF(MP_QSTR_uzlib, 39789, 5, "uzlib")
+QDEF(MP_QSTR_version, 54207, 7, "version")
+QDEF(MP_QSTR_version_info, 2670, 12, "version_info")
+QDEF(MP_QSTR_vline, 63005, 5, "vline")
+QDEF(MP_QSTR_write_readinto, 33929, 14, "write_readinto")
+QDEF(MP_QSTR_writeblocks, 57090, 11, "writeblocks")
+QDEF(MP_QSTR_writeto, 14595, 7, "writeto")
+QDEF(MP_QSTR_writeto_mem, 60793, 11, "writeto_mem")
+QDEF(MP_QSTR_writevto, 30069, 8, "writevto")
diff --git a/board/BearPi_STM32L431RC/KEIL/micropython_extra_demo/startup_stm32l431xx.s b/board/BearPi_STM32L431RC/KEIL/micropython_extra_demo/startup_stm32l431xx.s
new file mode 100644
index 00000000..6a5c15a5
--- /dev/null
+++ b/board/BearPi_STM32L431RC/KEIL/micropython_extra_demo/startup_stm32l431xx.s
@@ -0,0 +1,404 @@
+;********************** COPYRIGHT(c) 2017 STMicroelectronics ******************
+;* File Name : startup_stm32l431xx.s
+;* Author : MCD Application Team
+;* Description : STM32L431xx Ultra Low Power devices vector table for MDK-ARM toolchain.
+;* This module performs:
+;* - Set the initial SP
+;* - Set the initial PC == Reset_Handler
+;* - Set the vector table entries with the exceptions ISR address
+;* - Branches to __main in the C library (which eventually
+;* calls main()).
+;* After Reset the Cortex-M4 processor is in Thread mode,
+;* priority is Privileged, and the Stack is set to Main.
+;* <<< Use Configuration Wizard in Context Menu >>>
+;*******************************************************************************
+;*
+;* Redistribution and use in source and binary forms, with or without modification,
+;* are permitted provided that the following conditions are met:
+;* 1. Redistributions of source code must retain the above copyright notice,
+;* this list of conditions and the following disclaimer.
+;* 2. Redistributions in binary form must reproduce the above copyright notice,
+;* this list of conditions and the following disclaimer in the documentation
+;* and/or other materials provided with the distribution.
+;* 3. Neither the name of STMicroelectronics nor the names of its contributors
+;* may be used to endorse or promote products derived from this software
+;* without specific prior written permission.
+;*
+;* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+;* AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+;* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+;* DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
+;* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+;* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
+;* SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
+;* CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
+;* OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+;* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+;*
+;*******************************************************************************
+;
+; Amount of memory (in bytes) allocated for Stack
+; Tailor this value to your application needs
+; Stack Configuration
+; Stack Size (in Bytes) <0x0-0xFFFFFFFF:8>
+;
+
+Stack_Size EQU 0x100
+
+ AREA STACK, NOINIT, READWRITE, ALIGN=3
+Stack_Mem SPACE Stack_Size
+__initial_sp
+
+
+; Heap Configuration
+; Heap Size (in Bytes) <0x0-0xFFFFFFFF:8>
+;
+
+Heap_Size EQU 0x100
+
+ AREA HEAP, NOINIT, READWRITE, ALIGN=3
+__heap_base
+Heap_Mem SPACE Heap_Size
+__heap_limit
+
+ PRESERVE8
+ THUMB
+
+
+; Vector Table Mapped to Address 0 at Reset
+ AREA RESET, DATA, READONLY
+ EXPORT __Vectors
+ EXPORT __Vectors_End
+ EXPORT __Vectors_Size
+
+__Vectors DCD __initial_sp ; Top of Stack
+ DCD Reset_Handler ; Reset Handler
+ DCD NMI_Handler ; NMI Handler
+ DCD HardFault_Handler ; Hard Fault Handler
+ DCD MemManage_Handler ; MPU Fault Handler
+ DCD BusFault_Handler ; Bus Fault Handler
+ DCD UsageFault_Handler ; Usage Fault Handler
+ DCD 0 ; Reserved
+ DCD 0 ; Reserved
+ DCD 0 ; Reserved
+ DCD 0 ; Reserved
+ DCD SVC_Handler ; SVCall Handler
+ DCD DebugMon_Handler ; Debug Monitor Handler
+ DCD 0 ; Reserved
+ DCD PendSV_Handler ; PendSV Handler
+ DCD SysTick_Handler ; SysTick Handler
+
+ ; External Interrupts
+ DCD WWDG_IRQHandler ; Window WatchDog
+ DCD PVD_PVM_IRQHandler ; PVD/PVM1/PVM2/PVM3/PVM4 through EXTI Line detection
+ DCD TAMP_STAMP_IRQHandler ; Tamper and TimeStamps through the EXTI line
+ DCD RTC_WKUP_IRQHandler ; RTC Wakeup through the EXTI line
+ DCD FLASH_IRQHandler ; FLASH
+ DCD RCC_IRQHandler ; RCC
+ DCD EXTI0_IRQHandler ; EXTI Line0
+ DCD EXTI1_IRQHandler ; EXTI Line1
+ DCD EXTI2_IRQHandler ; EXTI Line2
+ DCD EXTI3_IRQHandler ; EXTI Line3
+ DCD EXTI4_IRQHandler ; EXTI Line4
+ DCD DMA1_Channel1_IRQHandler ; DMA1 Channel 1
+ DCD DMA1_Channel2_IRQHandler ; DMA1 Channel 2
+ DCD DMA1_Channel3_IRQHandler ; DMA1 Channel 3
+ DCD DMA1_Channel4_IRQHandler ; DMA1 Channel 4
+ DCD DMA1_Channel5_IRQHandler ; DMA1 Channel 5
+ DCD DMA1_Channel6_IRQHandler ; DMA1 Channel 6
+ DCD DMA1_Channel7_IRQHandler ; DMA1 Channel 7
+ DCD ADC1_IRQHandler ; ADC1
+ DCD CAN1_TX_IRQHandler ; CAN1 TX
+ DCD CAN1_RX0_IRQHandler ; CAN1 RX0
+ DCD CAN1_RX1_IRQHandler ; CAN1 RX1
+ DCD CAN1_SCE_IRQHandler ; CAN1 SCE
+ DCD EXTI9_5_IRQHandler ; External Line[9:5]s
+ DCD TIM1_BRK_TIM15_IRQHandler ; TIM1 Break and TIM15
+ DCD TIM1_UP_TIM16_IRQHandler ; TIM1 Update and TIM16
+ DCD TIM1_TRG_COM_IRQHandler ; TIM1 Trigger and Commutation
+ DCD TIM1_CC_IRQHandler ; TIM1 Capture Compare
+ DCD TIM2_IRQHandler ; TIM2
+ DCD 0 ; Reserved
+ DCD 0 ; Reserved
+ DCD I2C1_EV_IRQHandler ; I2C1 Event
+ DCD I2C1_ER_IRQHandler ; I2C1 Error
+ DCD I2C2_EV_IRQHandler ; I2C2 Event
+ DCD I2C2_ER_IRQHandler ; I2C2 Error
+ DCD SPI1_IRQHandler ; SPI1
+ DCD SPI2_IRQHandler ; SPI2
+ DCD USART1_IRQHandler ; USART1
+ DCD USART2_IRQHandler ; USART2
+ DCD USART3_IRQHandler ; USART3
+ DCD EXTI15_10_IRQHandler ; External Line[15:10]
+ DCD RTC_Alarm_IRQHandler ; RTC Alarm (A and B) through EXTI Line
+ DCD 0 ; Reserved
+ DCD 0 ; Reserved
+ DCD 0 ; Reserved
+ DCD 0 ; Reserved
+ DCD 0 ; Reserved
+ DCD 0 ; Reserved
+ DCD 0 ; Reserved
+ DCD SDMMC1_IRQHandler ; SDMMC1
+ DCD 0 ; Reserved
+ DCD SPI3_IRQHandler ; SPI3
+ DCD 0 ; Reserved
+ DCD 0 ; Reserved
+ DCD TIM6_DAC_IRQHandler ; TIM6 and DAC1&2 underrun errors
+ DCD TIM7_IRQHandler ; TIM7
+ DCD DMA2_Channel1_IRQHandler ; DMA2 Channel 1
+ DCD DMA2_Channel2_IRQHandler ; DMA2 Channel 2
+ DCD DMA2_Channel3_IRQHandler ; DMA2 Channel 3
+ DCD DMA2_Channel4_IRQHandler ; DMA2 Channel 4
+ DCD DMA2_Channel5_IRQHandler ; DMA2 Channel 5
+ DCD 0 ; Reserved
+ DCD 0 ; Reserved
+ DCD 0 ; Reserved
+ DCD COMP_IRQHandler ; COMP Interrupt
+ DCD LPTIM1_IRQHandler ; LP TIM1 interrupt
+ DCD LPTIM2_IRQHandler ; LP TIM2 interrupt
+ DCD 0 ; Reserved
+ DCD DMA2_Channel6_IRQHandler ; DMA2 Channel 6
+ DCD DMA2_Channel7_IRQHandler ; DMA2 Channel 7
+ DCD LPUART1_IRQHandler ; LP UART1 interrupt
+ DCD QUADSPI_IRQHandler ; Quad SPI global interrupt
+ DCD I2C3_EV_IRQHandler ; I2C3 event
+ DCD I2C3_ER_IRQHandler ; I2C3 error
+ DCD SAI1_IRQHandler ; Serial Audio Interface 1 global interrupt
+ DCD 0 ; Reserved
+ DCD SWPMI1_IRQHandler ; Serial Wire Interface 1 global interrupt
+ DCD TSC_IRQHandler ; Touch Sense Controller global interrupt
+ DCD 0 ; Reserved
+ DCD 0 ; Reserved
+ DCD RNG_IRQHandler ; RNG global interrupt
+ DCD FPU_IRQHandler ; FPU
+ DCD CRS_IRQHandler ; CRS interrupt
+
+__Vectors_End
+
+__Vectors_Size EQU __Vectors_End - __Vectors
+
+ AREA |.text|, CODE, READONLY
+
+; Reset handler
+Reset_Handler PROC
+ EXPORT Reset_Handler [WEAK]
+ IMPORT SystemInit
+ IMPORT __main
+
+ LDR R0, =SystemInit
+ BLX R0
+ LDR R0, =__main
+ BX R0
+ ENDP
+
+; Dummy Exception Handlers (infinite loops which can be modified)
+
+NMI_Handler PROC
+ EXPORT NMI_Handler [WEAK]
+ B .
+ ENDP
+HardFault_Handler\
+ PROC
+ EXPORT HardFault_Handler [WEAK]
+ B .
+ ENDP
+MemManage_Handler\
+ PROC
+ EXPORT MemManage_Handler [WEAK]
+ B .
+ ENDP
+BusFault_Handler\
+ PROC
+ EXPORT BusFault_Handler [WEAK]
+ B .
+ ENDP
+UsageFault_Handler\
+ PROC
+ EXPORT UsageFault_Handler [WEAK]
+ B .
+ ENDP
+SVC_Handler PROC
+ EXPORT SVC_Handler [WEAK]
+ B .
+ ENDP
+DebugMon_Handler\
+ PROC
+ EXPORT DebugMon_Handler [WEAK]
+ B .
+ ENDP
+PendSV_Handler PROC
+ EXPORT PendSV_Handler [WEAK]
+ B .
+ ENDP
+SysTick_Handler PROC
+ EXPORT SysTick_Handler [WEAK]
+ B .
+ ENDP
+
+Default_Handler PROC
+
+ EXPORT WWDG_IRQHandler [WEAK]
+ EXPORT PVD_PVM_IRQHandler [WEAK]
+ EXPORT TAMP_STAMP_IRQHandler [WEAK]
+ EXPORT RTC_WKUP_IRQHandler [WEAK]
+ EXPORT FLASH_IRQHandler [WEAK]
+ EXPORT RCC_IRQHandler [WEAK]
+ EXPORT EXTI0_IRQHandler [WEAK]
+ EXPORT EXTI1_IRQHandler [WEAK]
+ EXPORT EXTI2_IRQHandler [WEAK]
+ EXPORT EXTI3_IRQHandler [WEAK]
+ EXPORT EXTI4_IRQHandler [WEAK]
+ EXPORT DMA1_Channel1_IRQHandler [WEAK]
+ EXPORT DMA1_Channel2_IRQHandler [WEAK]
+ EXPORT DMA1_Channel3_IRQHandler [WEAK]
+ EXPORT DMA1_Channel4_IRQHandler [WEAK]
+ EXPORT DMA1_Channel5_IRQHandler [WEAK]
+ EXPORT DMA1_Channel6_IRQHandler [WEAK]
+ EXPORT DMA1_Channel7_IRQHandler [WEAK]
+ EXPORT ADC1_IRQHandler [WEAK]
+ EXPORT CAN1_TX_IRQHandler [WEAK]
+ EXPORT CAN1_RX0_IRQHandler [WEAK]
+ EXPORT CAN1_RX1_IRQHandler [WEAK]
+ EXPORT CAN1_SCE_IRQHandler [WEAK]
+ EXPORT EXTI9_5_IRQHandler [WEAK]
+ EXPORT TIM1_BRK_TIM15_IRQHandler [WEAK]
+ EXPORT TIM1_UP_TIM16_IRQHandler [WEAK]
+ EXPORT TIM1_TRG_COM_IRQHandler [WEAK]
+ EXPORT TIM1_CC_IRQHandler [WEAK]
+ EXPORT TIM2_IRQHandler [WEAK]
+ EXPORT I2C1_EV_IRQHandler [WEAK]
+ EXPORT I2C1_ER_IRQHandler [WEAK]
+ EXPORT I2C2_EV_IRQHandler [WEAK]
+ EXPORT I2C2_ER_IRQHandler [WEAK]
+ EXPORT SPI1_IRQHandler [WEAK]
+ EXPORT SPI2_IRQHandler [WEAK]
+ EXPORT USART1_IRQHandler [WEAK]
+ EXPORT USART2_IRQHandler [WEAK]
+ EXPORT USART3_IRQHandler [WEAK]
+ EXPORT EXTI15_10_IRQHandler [WEAK]
+ EXPORT RTC_Alarm_IRQHandler [WEAK]
+ EXPORT SDMMC1_IRQHandler [WEAK]
+ EXPORT SPI3_IRQHandler [WEAK]
+ EXPORT TIM6_DAC_IRQHandler [WEAK]
+ EXPORT TIM7_IRQHandler [WEAK]
+ EXPORT DMA2_Channel1_IRQHandler [WEAK]
+ EXPORT DMA2_Channel2_IRQHandler [WEAK]
+ EXPORT DMA2_Channel3_IRQHandler [WEAK]
+ EXPORT DMA2_Channel4_IRQHandler [WEAK]
+ EXPORT DMA2_Channel5_IRQHandler [WEAK]
+ EXPORT COMP_IRQHandler [WEAK]
+ EXPORT LPTIM1_IRQHandler [WEAK]
+ EXPORT LPTIM2_IRQHandler [WEAK]
+ EXPORT DMA2_Channel6_IRQHandler [WEAK]
+ EXPORT DMA2_Channel7_IRQHandler [WEAK]
+ EXPORT LPUART1_IRQHandler [WEAK]
+ EXPORT QUADSPI_IRQHandler [WEAK]
+ EXPORT I2C3_EV_IRQHandler [WEAK]
+ EXPORT I2C3_ER_IRQHandler [WEAK]
+ EXPORT SAI1_IRQHandler [WEAK]
+ EXPORT SWPMI1_IRQHandler [WEAK]
+ EXPORT TSC_IRQHandler [WEAK]
+ EXPORT RNG_IRQHandler [WEAK]
+ EXPORT FPU_IRQHandler [WEAK]
+ EXPORT CRS_IRQHandler [WEAK]
+
+WWDG_IRQHandler
+PVD_PVM_IRQHandler
+TAMP_STAMP_IRQHandler
+RTC_WKUP_IRQHandler
+FLASH_IRQHandler
+RCC_IRQHandler
+EXTI0_IRQHandler
+EXTI1_IRQHandler
+EXTI2_IRQHandler
+EXTI3_IRQHandler
+EXTI4_IRQHandler
+DMA1_Channel1_IRQHandler
+DMA1_Channel2_IRQHandler
+DMA1_Channel3_IRQHandler
+DMA1_Channel4_IRQHandler
+DMA1_Channel5_IRQHandler
+DMA1_Channel6_IRQHandler
+DMA1_Channel7_IRQHandler
+ADC1_IRQHandler
+CAN1_TX_IRQHandler
+CAN1_RX0_IRQHandler
+CAN1_RX1_IRQHandler
+CAN1_SCE_IRQHandler
+EXTI9_5_IRQHandler
+TIM1_BRK_TIM15_IRQHandler
+TIM1_UP_TIM16_IRQHandler
+TIM1_TRG_COM_IRQHandler
+TIM1_CC_IRQHandler
+TIM2_IRQHandler
+I2C1_EV_IRQHandler
+I2C1_ER_IRQHandler
+I2C2_EV_IRQHandler
+I2C2_ER_IRQHandler
+SPI1_IRQHandler
+SPI2_IRQHandler
+USART1_IRQHandler
+USART2_IRQHandler
+USART3_IRQHandler
+EXTI15_10_IRQHandler
+RTC_Alarm_IRQHandler
+SDMMC1_IRQHandler
+SPI3_IRQHandler
+TIM6_DAC_IRQHandler
+TIM7_IRQHandler
+DMA2_Channel1_IRQHandler
+DMA2_Channel2_IRQHandler
+DMA2_Channel3_IRQHandler
+DMA2_Channel4_IRQHandler
+DMA2_Channel5_IRQHandler
+COMP_IRQHandler
+LPTIM1_IRQHandler
+LPTIM2_IRQHandler
+DMA2_Channel6_IRQHandler
+DMA2_Channel7_IRQHandler
+LPUART1_IRQHandler
+QUADSPI_IRQHandler
+I2C3_EV_IRQHandler
+I2C3_ER_IRQHandler
+SAI1_IRQHandler
+SWPMI1_IRQHandler
+TSC_IRQHandler
+RNG_IRQHandler
+FPU_IRQHandler
+CRS_IRQHandler
+
+ B .
+
+ ENDP
+
+ ALIGN
+
+;*******************************************************************************
+; User Stack and Heap initialization
+;*******************************************************************************
+ IF :DEF:__MICROLIB
+
+ EXPORT __initial_sp
+ EXPORT __heap_base
+ EXPORT __heap_limit
+
+ ELSE
+
+ IMPORT __use_two_region_memory
+ EXPORT __user_initial_stackheap
+
+__user_initial_stackheap
+
+ LDR R0, = Heap_Mem
+ LDR R1, =(Stack_Mem + Stack_Size)
+ LDR R2, = (Heap_Mem + Heap_Size)
+ LDR R3, = Stack_Mem
+ BX LR
+
+ ALIGN
+
+ ENDIF
+
+ END
+
+;************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE*****
diff --git a/components/language/micropython/.git-blame-ignore-revs b/components/language/micropython/.git-blame-ignore-revs
new file mode 100644
index 00000000..0ffa4fcf
--- /dev/null
+++ b/components/language/micropython/.git-blame-ignore-revs
@@ -0,0 +1,47 @@
+#all: Reformat remaining C code that doesn't have a space after a comma.
+5b700b0af90591d6b1a2c087bb8de6b7f1bfdd2d
+
+# ports: Reformat more C and Python source code.
+5c32111fa0e31e451b0f1666bdf926be2fdfd82c
+
+# all: Update Python formatting to latest Black version 22.1.0.
+ab2923dfa1174dc177f0a90cb00a7e4ff87958d2
+
+# all: Update Python formatting to latest Black version 21.12b0.
+3770fab33449a5dadf8eb06edfae0767e75320a6
+
+# tools/gen-cpydiff.py: Fix formatting of doc strings for new Black.
+0f78c36c5aa458a954eed39a46942209107a553e
+
+# tests/run-tests.py: Reformat with Black.
+2a38d7103672580882fb621a5b76e8d26805d593
+
+# all: Update Python code to conform to latest black formatting.
+06659077a81b85882254cf0953c33b27614e018e
+
+# tools/uncrustify: Enable more opts to remove space between func and '('.
+77ed6f69ac35c1663a5633a8ee1d8a2446542204
+
+# tools/codeformat.py: Include extmod/{btstack,nimble} in code formatting.
+026fda605e03113d6e753290d65fed774418bc53
+
+# all: Format code to add space after C++-style comment start.
+84fa3312cfa7d2237d4b56952f2cd6e3591210c4
+
+# tests: Format all Python code with black, except tests in basics subdir.
+3dc324d3f1312e40d3a8ed87e7244966bb756f26
+
+# all: Remove spaces inside and around parenthesis.
+1a3e386c67e03a79eb768cb6e9f6777e002d6660
+
+# all: Remove spaces between nested paren and inside function arg paren.
+feb25775851ba0c04b8d1013716f442258879d9c
+
+# all: Reformat C and Python source code with tools/codeformat.py.
+69661f3343bedf86e514337cff63d96cc42f8859
+
+# stm32/usbdev: Convert files to unix line endings.
+abde0fa2267f9062b28c3c015d7662a550125cc6
+
+# all: Remove trailing spaces, per coding conventions.
+761e4c7ff62896c7d8f8c3dfc3cc98a4cc4f2f6f
diff --git a/components/language/micropython/.gitattributes b/components/language/micropython/.gitattributes
new file mode 100644
index 00000000..e6d31d6a
--- /dev/null
+++ b/components/language/micropython/.gitattributes
@@ -0,0 +1,26 @@
+# Per default everything gets normalized and gets LF line endings on checkout.
+* text eol=lf
+
+# These will always have CRLF line endings on checkout.
+*.vcxproj text eol=crlf
+*.props text eol=crlf
+*.bat text eol=crlf
+
+# These are binary so should never be modified by git.
+*.a binary
+*.png binary
+*.jpg binary
+*.dxf binary
+*.mpy binary
+
+# These should also not be modified by git.
+tests/basics/string_cr_conversion.py -text
+tests/basics/string_crlf_conversion.py -text
+ports/stm32/pybcdc.inf_template -text
+ports/stm32/usbhost/** -text
+ports/cc3200/hal/aes.c -text
+ports/cc3200/hal/aes.h -text
+ports/cc3200/hal/des.c -text
+ports/cc3200/hal/i2s.c -text
+ports/cc3200/hal/i2s.h -text
+ports/cc3200/version.h -text
diff --git a/components/language/micropython/.github/FUNDING.yml b/components/language/micropython/.github/FUNDING.yml
new file mode 100644
index 00000000..15186fd5
--- /dev/null
+++ b/components/language/micropython/.github/FUNDING.yml
@@ -0,0 +1 @@
+github: micropython
diff --git a/components/language/micropython/.github/ISSUE_TEMPLATE/bug_report.md b/components/language/micropython/.github/ISSUE_TEMPLATE/bug_report.md
new file mode 100644
index 00000000..adddd334
--- /dev/null
+++ b/components/language/micropython/.github/ISSUE_TEMPLATE/bug_report.md
@@ -0,0 +1,25 @@
+---
+name: Bug report
+about: Report an issue
+title: ''
+labels: bug
+assignees: ''
+
+---
+
+* Remove all placeholder text below before submitting.
+
+* Please search existing issues before raising a new issue. For questions about MicroPython or for help using MicroPython, please see the MicroPython Forum -- https://forum.micropython.org/
+
+* In your issue, please include a clear and concise description of what the bug is, the expected output, and how to replicate it.
+
+* If this issue involves external hardware, please include links to relevant datasheets and schematics.
+
+* If you are seeing code being executed incorrectly, please provide a minimal example and expected output (e.g. comparison to CPython).
+
+* For build issues, please include full details of your environment, compiler versions, command lines, and build output.
+
+* Please provide as much information as possible about the version of MicroPython you're running, such as:
+ - firmware file name
+ - git commit hash and port/board
+ - version information shown in the REPL (hit Ctrl-B to see the startup message)
diff --git a/components/language/micropython/.github/ISSUE_TEMPLATE/config.yml b/components/language/micropython/.github/ISSUE_TEMPLATE/config.yml
new file mode 100644
index 00000000..318d9416
--- /dev/null
+++ b/components/language/micropython/.github/ISSUE_TEMPLATE/config.yml
@@ -0,0 +1,11 @@
+blank_issues_enabled: false
+contact_links:
+ - name: MicroPython Forum
+ url: https://forum.micropython.org/
+ about: Community discussion about all things MicroPython. This is the best place to start if you have questions about using MicroPython or getting started with MicroPython development.
+ - name: MicroPython Documentation
+ url: https://docs.micropython.org/
+ about: Documentation for using and working with MicroPython and libraries.
+ - name: MicroPython Downloads
+ url: https://micropython.org/download/
+ about: Pre-built firmware and information for most supported boards.
diff --git a/components/language/micropython/.github/ISSUE_TEMPLATE/documentation.md b/components/language/micropython/.github/ISSUE_TEMPLATE/documentation.md
new file mode 100644
index 00000000..84ff2ba6
--- /dev/null
+++ b/components/language/micropython/.github/ISSUE_TEMPLATE/documentation.md
@@ -0,0 +1,16 @@
+---
+name: Documentation issue
+about: Report areas of the documentation or examples that need improvement
+title: 'docs: '
+labels: documentation
+assignees: ''
+
+---
+
+* Remove all placeholder text below before submitting.
+
+* Please search existing issues before raising a new issue. For questions about MicroPython or for help using MicroPython, please see the MicroPython Forum -- https://forum.micropython.org/
+
+* Describe what was missing from the documentation and/or what was incorrect/incomplete.
+
+* If possible, please link to the relevant page on https://docs.micropython.org/
diff --git a/components/language/micropython/.github/ISSUE_TEMPLATE/feature_request.md b/components/language/micropython/.github/ISSUE_TEMPLATE/feature_request.md
new file mode 100644
index 00000000..1ac2055e
--- /dev/null
+++ b/components/language/micropython/.github/ISSUE_TEMPLATE/feature_request.md
@@ -0,0 +1,24 @@
+---
+name: Feature request
+about: Request a feature or improvement
+title: ''
+labels: enhancement
+assignees: ''
+
+---
+
+* Remove all placeholder text below before submitting.
+
+* Please search existing issues before raising a new issue. For questions about MicroPython or for help using MicroPython, please see the MicroPython Forum -- https://forum.micropython.org/
+
+* Describe the feature you'd like to see added to MicroPython. In particular, what does this feature enable and why is it useful. MicroPython aims to strike a balance between functionality and code size, so please consider whether this feature can be optionally enabled and whether it can be provided in other ways (e.g. pure-Python library).
+
+* For core Python features, where possible please include a link to the relevant PEP.
+
+* For new architectures / ports / boards, please provide links to relevant documentation, specifications, and toolchains. Any information about the popularity and unique features about this hardware would also be useful.
+
+* For features for existing ports (e.g. new peripherals or microcontroller features), please describe which port(s) it applies too, and whether this is could be an extension to the machine API or a port-specific module?
+
+* For drivers (e.g. for external hardware), please link to datasheets and/or existing drivers from other sources.
+
+* Who do you expect will implement the feature you are requesting? Would you be willing to sponsor this work?
diff --git a/components/language/micropython/.github/ISSUE_TEMPLATE/security.md b/components/language/micropython/.github/ISSUE_TEMPLATE/security.md
new file mode 100644
index 00000000..fe60875f
--- /dev/null
+++ b/components/language/micropython/.github/ISSUE_TEMPLATE/security.md
@@ -0,0 +1,16 @@
+---
+name: Security report
+about: Report a security issue or vunerability in MicroPython
+title: ''
+labels: security
+assignees: ''
+
+---
+
+* Remove all placeholder text before submitting the new issue.
+
+* If you need to raise this issue privately with the MicroPython team, please email contact@micropython.org instead.
+
+* Include a clear and concise description of what the security issue is.
+
+* What does this issue allow an attacker to do?
diff --git a/components/language/micropython/.github/workflows/code_formatting.yml b/components/language/micropython/.github/workflows/code_formatting.yml
new file mode 100644
index 00000000..aab347d7
--- /dev/null
+++ b/components/language/micropython/.github/workflows/code_formatting.yml
@@ -0,0 +1,16 @@
+name: Check code formatting
+
+on: [push, pull_request]
+
+jobs:
+ build:
+ runs-on: ubuntu-latest
+ steps:
+ - uses: actions/checkout@v2
+ - uses: actions/setup-python@v1
+ - name: Install packages
+ run: source tools/ci.sh && ci_code_formatting_setup
+ - name: Run code formatting
+ run: source tools/ci.sh && ci_code_formatting_run
+ - name: Check code formatting
+ run: git diff --exit-code
diff --git a/components/language/micropython/.github/workflows/code_size.yml b/components/language/micropython/.github/workflows/code_size.yml
new file mode 100644
index 00000000..7570261e
--- /dev/null
+++ b/components/language/micropython/.github/workflows/code_size.yml
@@ -0,0 +1,27 @@
+name: Check code size
+
+on:
+ push:
+ pull_request:
+ paths:
+ - '.github/workflows/*.yml'
+ - 'tools/**'
+ - 'py/**'
+ - 'extmod/**'
+ - 'lib/**'
+ - 'ports/bare-arm/**'
+ - 'ports/minimal/**'
+
+jobs:
+ build:
+ runs-on: ubuntu-20.04
+ steps:
+ - uses: actions/checkout@v2
+ with:
+ fetch-depth: 100
+ - name: Install packages
+ run: source tools/ci.sh && ci_code_size_setup
+ - name: Build
+ run: source tools/ci.sh && ci_code_size_build
+ - name: Compute code size difference
+ run: tools/metrics.py diff --error-threshold 0 ~/size0 ~/size1
diff --git a/components/language/micropython/.github/workflows/commit_formatting.yml b/components/language/micropython/.github/workflows/commit_formatting.yml
new file mode 100644
index 00000000..5f96fbb9
--- /dev/null
+++ b/components/language/micropython/.github/workflows/commit_formatting.yml
@@ -0,0 +1,14 @@
+name: Check commit message formatting
+
+on: [push, pull_request]
+
+jobs:
+ build:
+ runs-on: ubuntu-latest
+ steps:
+ - uses: actions/checkout@v2
+ with:
+ fetch-depth: '100'
+ - uses: actions/setup-python@v1
+ - name: Check commit message formatting
+ run: source tools/ci.sh && ci_commit_formatting_run
diff --git a/components/language/micropython/.github/workflows/docs.yml b/components/language/micropython/.github/workflows/docs.yml
new file mode 100644
index 00000000..ec6b4c7f
--- /dev/null
+++ b/components/language/micropython/.github/workflows/docs.yml
@@ -0,0 +1,18 @@
+name: Build docs
+
+on:
+ pull_request:
+ paths:
+ - docs/**
+
+jobs:
+ build:
+ runs-on: ubuntu-latest
+
+ steps:
+ - uses: actions/checkout@v2
+ - uses: actions/setup-python@v1
+ - name: Install Python packages
+ run: pip install Sphinx
+ - name: Build docs
+ run: make -C docs/ html
diff --git a/components/language/micropython/.github/workflows/examples.yml b/components/language/micropython/.github/workflows/examples.yml
new file mode 100644
index 00000000..53a817af
--- /dev/null
+++ b/components/language/micropython/.github/workflows/examples.yml
@@ -0,0 +1,21 @@
+name: Check examples
+
+on:
+ push:
+ pull_request:
+ paths:
+ - '.github/workflows/*.yml'
+ - 'examples/**'
+ - 'ports/unix/**'
+ - 'py/**'
+ - 'shared/**'
+
+jobs:
+ embedding:
+ runs-on: ubuntu-latest
+ steps:
+ - uses: actions/checkout@v2
+ - name: Build
+ run: make -C examples/embedding
+ - name: Run
+ run: test "$(./examples/embedding/hello-embed)" = "Hello world of easy embedding!"
diff --git a/components/language/micropython/.github/workflows/mpy_format.yml b/components/language/micropython/.github/workflows/mpy_format.yml
new file mode 100644
index 00000000..ab90bb33
--- /dev/null
+++ b/components/language/micropython/.github/workflows/mpy_format.yml
@@ -0,0 +1,18 @@
+name: .mpy file format and tools
+
+on:
+ push:
+ pull_request:
+ paths:
+ - '.github/workflows/*.yml'
+ - 'tools/**'
+
+jobs:
+ test:
+ runs-on: ubuntu-latest
+ steps:
+ - uses: actions/checkout@v2
+ - name: Install packages
+ run: source tools/ci.sh && ci_mpy_format_setup
+ - name: Test mpy-tool.py
+ run: source tools/ci.sh && ci_mpy_format_test
diff --git a/components/language/micropython/.github/workflows/ports.yml b/components/language/micropython/.github/workflows/ports.yml
new file mode 100644
index 00000000..e9e6de28
--- /dev/null
+++ b/components/language/micropython/.github/workflows/ports.yml
@@ -0,0 +1,18 @@
+name: Build ports metadata
+
+on:
+ push:
+ pull_request:
+ paths:
+ - '.github/workflows/*.yml'
+ - 'tools/**'
+ - ports/**
+
+jobs:
+ build:
+ runs-on: ubuntu-latest
+
+ steps:
+ - uses: actions/checkout@v2
+ - name: Build ports download metadata
+ run: mkdir boards && ./tools/autobuild/build-downloads.py . ./boards
diff --git a/components/language/micropython/.github/workflows/ports_cc3200.yml b/components/language/micropython/.github/workflows/ports_cc3200.yml
new file mode 100644
index 00000000..0eaa36da
--- /dev/null
+++ b/components/language/micropython/.github/workflows/ports_cc3200.yml
@@ -0,0 +1,23 @@
+name: cc3200 port
+
+on:
+ push:
+ pull_request:
+ paths:
+ - '.github/workflows/*.yml'
+ - 'tools/**'
+ - 'py/**'
+ - 'extmod/**'
+ - 'lib/**'
+ - 'drivers/**'
+ - 'ports/cc3200/**'
+
+jobs:
+ build:
+ runs-on: ubuntu-latest
+ steps:
+ - uses: actions/checkout@v2
+ - name: Install packages
+ run: source tools/ci.sh && ci_cc3200_setup
+ - name: Build
+ run: source tools/ci.sh && ci_cc3200_build
diff --git a/components/language/micropython/.github/workflows/ports_esp32.yml b/components/language/micropython/.github/workflows/ports_esp32.yml
new file mode 100644
index 00000000..de88de37
--- /dev/null
+++ b/components/language/micropython/.github/workflows/ports_esp32.yml
@@ -0,0 +1,32 @@
+name: esp32 port
+
+on:
+ push:
+ pull_request:
+ paths:
+ - '.github/workflows/*.yml'
+ - 'tools/**'
+ - 'py/**'
+ - 'extmod/**'
+ - 'lib/**'
+ - 'drivers/**'
+ - 'ports/esp32/**'
+
+jobs:
+ build_idf402:
+ runs-on: ubuntu-20.04
+ steps:
+ - uses: actions/checkout@v2
+ - name: Install packages
+ run: source tools/ci.sh && ci_esp32_idf402_setup
+ - name: Build
+ run: source tools/ci.sh && ci_esp32_build
+
+ build_idf44:
+ runs-on: ubuntu-20.04
+ steps:
+ - uses: actions/checkout@v2
+ - name: Install packages
+ run: source tools/ci.sh && ci_esp32_idf44_setup
+ - name: Build
+ run: source tools/ci.sh && ci_esp32_build
diff --git a/components/language/micropython/.github/workflows/ports_esp8266.yml b/components/language/micropython/.github/workflows/ports_esp8266.yml
new file mode 100644
index 00000000..f4ce1f82
--- /dev/null
+++ b/components/language/micropython/.github/workflows/ports_esp8266.yml
@@ -0,0 +1,23 @@
+name: esp8266 port
+
+on:
+ push:
+ pull_request:
+ paths:
+ - '.github/workflows/*.yml'
+ - 'tools/**'
+ - 'py/**'
+ - 'extmod/**'
+ - 'lib/**'
+ - 'drivers/**'
+ - 'ports/esp8266/**'
+
+jobs:
+ build:
+ runs-on: ubuntu-latest
+ steps:
+ - uses: actions/checkout@v2
+ - name: Install packages
+ run: source tools/ci.sh && ci_esp8266_setup && ci_esp8266_path >> $GITHUB_PATH
+ - name: Build
+ run: source tools/ci.sh && ci_esp8266_build
diff --git a/components/language/micropython/.github/workflows/ports_javascript.yml b/components/language/micropython/.github/workflows/ports_javascript.yml
new file mode 100644
index 00000000..244dc966
--- /dev/null
+++ b/components/language/micropython/.github/workflows/ports_javascript.yml
@@ -0,0 +1,24 @@
+name: javascript port
+
+on:
+ push:
+ pull_request:
+ paths:
+ - '.github/workflows/*.yml'
+ - 'tools/**'
+ - 'py/**'
+ - 'extmod/**'
+ - 'lib/**'
+ - 'ports/javascript/**'
+
+jobs:
+ build:
+ runs-on: ubuntu-latest
+ steps:
+ - uses: actions/checkout@v2
+ - name: Install packages
+ run: source tools/ci.sh && ci_javascript_setup
+ - name: Build
+ run: source tools/ci.sh && ci_javascript_build
+ - name: Run tests
+ run: source tools/ci.sh && ci_javascript_run_tests
diff --git a/components/language/micropython/.github/workflows/ports_mimxrt.yml b/components/language/micropython/.github/workflows/ports_mimxrt.yml
new file mode 100644
index 00000000..8fbc2209
--- /dev/null
+++ b/components/language/micropython/.github/workflows/ports_mimxrt.yml
@@ -0,0 +1,23 @@
+name: mimxrt port
+
+on:
+ push:
+ pull_request:
+ paths:
+ - '.github/workflows/*.yml'
+ - 'tools/**'
+ - 'py/**'
+ - 'extmod/**'
+ - 'lib/**'
+ - 'drivers/**'
+ - 'ports/mimxrt/**'
+
+jobs:
+ build:
+ runs-on: ubuntu-20.04
+ steps:
+ - uses: actions/checkout@v2
+ - name: Install packages
+ run: source tools/ci.sh && ci_mimxrt_setup
+ - name: Build
+ run: source tools/ci.sh && ci_mimxrt_build
diff --git a/components/language/micropython/.github/workflows/ports_nrf.yml b/components/language/micropython/.github/workflows/ports_nrf.yml
new file mode 100644
index 00000000..1ba3b0ce
--- /dev/null
+++ b/components/language/micropython/.github/workflows/ports_nrf.yml
@@ -0,0 +1,23 @@
+name: nrf port
+
+on:
+ push:
+ pull_request:
+ paths:
+ - '.github/workflows/*.yml'
+ - 'tools/**'
+ - 'py/**'
+ - 'extmod/**'
+ - 'lib/**'
+ - 'drivers/**'
+ - 'ports/nrf/**'
+
+jobs:
+ build:
+ runs-on: ubuntu-20.04
+ steps:
+ - uses: actions/checkout@v2
+ - name: Install packages
+ run: source tools/ci.sh && ci_nrf_setup
+ - name: Build
+ run: source tools/ci.sh && ci_nrf_build
diff --git a/components/language/micropython/.github/workflows/ports_powerpc.yml b/components/language/micropython/.github/workflows/ports_powerpc.yml
new file mode 100644
index 00000000..88fa5976
--- /dev/null
+++ b/components/language/micropython/.github/workflows/ports_powerpc.yml
@@ -0,0 +1,23 @@
+name: powerpc port
+
+on:
+ push:
+ pull_request:
+ paths:
+ - '.github/workflows/*.yml'
+ - 'tools/**'
+ - 'py/**'
+ - 'extmod/**'
+ - 'lib/**'
+ - 'drivers/**'
+ - 'ports/powerpc/**'
+
+jobs:
+ build:
+ runs-on: ubuntu-latest
+ steps:
+ - uses: actions/checkout@v2
+ - name: Install packages
+ run: source tools/ci.sh && ci_powerpc_setup
+ - name: Build
+ run: source tools/ci.sh && ci_powerpc_build
diff --git a/components/language/micropython/.github/workflows/ports_qemu-arm.yml b/components/language/micropython/.github/workflows/ports_qemu-arm.yml
new file mode 100644
index 00000000..0489a93d
--- /dev/null
+++ b/components/language/micropython/.github/workflows/ports_qemu-arm.yml
@@ -0,0 +1,27 @@
+name: qemu-arm port
+
+on:
+ push:
+ pull_request:
+ paths:
+ - '.github/workflows/*.yml'
+ - 'tools/**'
+ - 'py/**'
+ - 'extmod/**'
+ - 'lib/**'
+ - 'drivers/**'
+ - 'ports/qemu-arm/**'
+ - 'tests/**'
+
+jobs:
+ build_and_test:
+ runs-on: ubuntu-latest
+ steps:
+ - uses: actions/checkout@v2
+ - name: Install packages
+ run: source tools/ci.sh && ci_qemu_arm_setup
+ - name: Build and run test suite
+ run: source tools/ci.sh && ci_qemu_arm_build
+ - name: Print failures
+ if: failure()
+ run: grep --before-context=100 --text "FAIL" ports/qemu-arm/build/console.out
diff --git a/components/language/micropython/.github/workflows/ports_renesas-ra.yml b/components/language/micropython/.github/workflows/ports_renesas-ra.yml
new file mode 100644
index 00000000..20e068ee
--- /dev/null
+++ b/components/language/micropython/.github/workflows/ports_renesas-ra.yml
@@ -0,0 +1,24 @@
+name: renesas-ra port
+
+on:
+ push:
+ pull_request:
+ paths:
+ - '.github/workflows/*.yml'
+ - 'tools/**'
+ - 'py/**'
+ - 'extmod/**'
+ - 'lib/**'
+ - 'drivers/**'
+ - 'ports/renesas-ra/**'
+
+jobs:
+ build_renesas_ra_board:
+ runs-on: ubuntu-20.04
+ steps:
+ - uses: actions/checkout@v2
+ - name: Install packages
+ run: source tools/ci.sh && ci_renesas_ra_setup
+ - name: Build
+ run: source tools/ci.sh && ci_renesas_ra_board_build
+
diff --git a/components/language/micropython/.github/workflows/ports_rp2.yml b/components/language/micropython/.github/workflows/ports_rp2.yml
new file mode 100644
index 00000000..668b79ca
--- /dev/null
+++ b/components/language/micropython/.github/workflows/ports_rp2.yml
@@ -0,0 +1,23 @@
+name: rp2 port
+
+on:
+ push:
+ pull_request:
+ paths:
+ - '.github/workflows/*.yml'
+ - 'tools/**'
+ - 'py/**'
+ - 'extmod/**'
+ - 'lib/**'
+ - 'drivers/**'
+ - 'ports/rp2/**'
+
+jobs:
+ build:
+ runs-on: ubuntu-latest
+ steps:
+ - uses: actions/checkout@v2
+ - name: Install packages
+ run: source tools/ci.sh && ci_rp2_setup
+ - name: Build
+ run: source tools/ci.sh && ci_rp2_build
diff --git a/components/language/micropython/.github/workflows/ports_samd.yml b/components/language/micropython/.github/workflows/ports_samd.yml
new file mode 100644
index 00000000..bde4ed96
--- /dev/null
+++ b/components/language/micropython/.github/workflows/ports_samd.yml
@@ -0,0 +1,23 @@
+name: samd port
+
+on:
+ push:
+ pull_request:
+ paths:
+ - '.github/workflows/*.yml'
+ - 'tools/**'
+ - 'py/**'
+ - 'extmod/**'
+ - 'lib/**'
+ - 'drivers/**'
+ - 'ports/samd/**'
+
+jobs:
+ build:
+ runs-on: ubuntu-latest
+ steps:
+ - uses: actions/checkout@v2
+ - name: Install packages
+ run: source tools/ci.sh && ci_samd_setup
+ - name: Build
+ run: source tools/ci.sh && ci_samd_build
diff --git a/components/language/micropython/.github/workflows/ports_stm32.yml b/components/language/micropython/.github/workflows/ports_stm32.yml
new file mode 100644
index 00000000..4634339c
--- /dev/null
+++ b/components/language/micropython/.github/workflows/ports_stm32.yml
@@ -0,0 +1,32 @@
+name: stm32 port
+
+on:
+ push:
+ pull_request:
+ paths:
+ - '.github/workflows/*.yml'
+ - 'tools/**'
+ - 'py/**'
+ - 'extmod/**'
+ - 'lib/**'
+ - 'drivers/**'
+ - 'ports/stm32/**'
+
+jobs:
+ build_pyb:
+ runs-on: ubuntu-20.04
+ steps:
+ - uses: actions/checkout@v2
+ - name: Install packages
+ run: source tools/ci.sh && ci_stm32_setup
+ - name: Build
+ run: source tools/ci.sh && ci_stm32_pyb_build
+
+ build_nucleo:
+ runs-on: ubuntu-20.04
+ steps:
+ - uses: actions/checkout@v2
+ - name: Install packages
+ run: source tools/ci.sh && ci_stm32_setup
+ - name: Build
+ run: source tools/ci.sh && ci_stm32_nucleo_build
diff --git a/components/language/micropython/.github/workflows/ports_teensy.yml b/components/language/micropython/.github/workflows/ports_teensy.yml
new file mode 100644
index 00000000..7ae77c80
--- /dev/null
+++ b/components/language/micropython/.github/workflows/ports_teensy.yml
@@ -0,0 +1,23 @@
+name: teensy port
+
+on:
+ push:
+ pull_request:
+ paths:
+ - '.github/workflows/*.yml'
+ - 'tools/**'
+ - 'py/**'
+ - 'extmod/**'
+ - 'lib/**'
+ - 'drivers/**'
+ - 'ports/teensy/**'
+
+jobs:
+ build:
+ runs-on: ubuntu-latest
+ steps:
+ - uses: actions/checkout@v2
+ - name: Install packages
+ run: source tools/ci.sh && ci_teensy_setup
+ - name: Build
+ run: source tools/ci.sh && ci_teensy_build
diff --git a/components/language/micropython/.github/workflows/ports_unix.yml b/components/language/micropython/.github/workflows/ports_unix.yml
new file mode 100644
index 00000000..63cc1c0f
--- /dev/null
+++ b/components/language/micropython/.github/workflows/ports_unix.yml
@@ -0,0 +1,230 @@
+name: unix port
+
+on:
+ push:
+ pull_request:
+ paths:
+ - '.github/workflows/*.yml'
+ - 'tools/**'
+ - 'py/**'
+ - 'extmod/**'
+ - 'lib/**'
+ - 'examples/**'
+ - 'ports/unix/**'
+ - 'tests/**'
+
+jobs:
+ minimal:
+ runs-on: ubuntu-latest
+ steps:
+ - uses: actions/checkout@v2
+ - name: Build
+ run: source tools/ci.sh && ci_unix_minimal_build
+ - name: Run main test suite
+ run: source tools/ci.sh && ci_unix_minimal_run_tests
+ - name: Print failures
+ if: failure()
+ run: tests/run-tests.py --print-failures
+
+ reproducible:
+ runs-on: ubuntu-latest
+ steps:
+ - uses: actions/checkout@v2
+ - name: Build with reproducible date
+ run: source tools/ci.sh && ci_unix_minimal_build
+ env:
+ SOURCE_DATE_EPOCH: 1234567890
+ - name: Check reproducible build date
+ run: echo | ports/unix/micropython-minimal -i | grep 'on 2009-02-13;'
+
+ standard:
+ runs-on: ubuntu-latest
+ steps:
+ - uses: actions/checkout@v2
+ - name: Build
+ run: source tools/ci.sh && ci_unix_standard_build
+ - name: Run main test suite
+ run: source tools/ci.sh && ci_unix_standard_run_tests
+ - name: Print failures
+ if: failure()
+ run: tests/run-tests.py --print-failures
+
+ dev:
+ runs-on: ubuntu-latest
+ steps:
+ - uses: actions/checkout@v2
+ - name: Build
+ run: source tools/ci.sh && ci_unix_dev_build
+ - name: Run main test suite
+ run: source tools/ci.sh && ci_unix_dev_run_tests
+ - name: Print failures
+ if: failure()
+ run: tests/run-tests.py --print-failures
+
+ coverage:
+ runs-on: ubuntu-latest
+ steps:
+ - uses: actions/checkout@v2
+ - name: Install packages
+ run: source tools/ci.sh && ci_unix_coverage_setup
+ - name: Build
+ run: source tools/ci.sh && ci_unix_coverage_build
+ - name: Run main test suite
+ run: source tools/ci.sh && ci_unix_coverage_run_tests
+ - name: Test merging .mpy files
+ run: source tools/ci.sh && ci_unix_coverage_run_mpy_merge_tests
+ - name: Build native mpy modules
+ run: source tools/ci.sh && ci_native_mpy_modules_build
+ - name: Test importing .mpy generated by mpy_ld.py
+ run: source tools/ci.sh && ci_unix_coverage_run_native_mpy_tests
+ - name: Run gcov coverage analysis
+ run: |
+ (cd ports/unix && gcov -o build-coverage/py ../../py/*.c || true)
+ (cd ports/unix && gcov -o build-coverage/extmod ../../extmod/*.c || true)
+ - name: Upload coverage to Codecov
+ uses: codecov/codecov-action@v1
+ with:
+ fail_ci_if_error: true
+ verbose: true
+ - name: Print failures
+ if: failure()
+ run: tests/run-tests.py --print-failures
+
+ coverage_32bit:
+ runs-on: ubuntu-latest
+ steps:
+ - uses: actions/checkout@v2
+ - name: Install packages
+ run: source tools/ci.sh && ci_unix_32bit_setup
+ - name: Build
+ run: source tools/ci.sh && ci_unix_coverage_32bit_build
+ - name: Run main test suite
+ run: source tools/ci.sh && ci_unix_coverage_32bit_run_tests
+ - name: Build native mpy modules
+ run: source tools/ci.sh && ci_native_mpy_modules_32bit_build
+ - name: Test importing .mpy generated by mpy_ld.py
+ run: source tools/ci.sh && ci_unix_coverage_32bit_run_native_mpy_tests
+ - name: Print failures
+ if: failure()
+ run: tests/run-tests.py --print-failures
+
+ nanbox:
+ runs-on: ubuntu-latest
+ steps:
+ - uses: actions/checkout@v2
+ - name: Install packages
+ run: source tools/ci.sh && ci_unix_32bit_setup
+ - name: Build
+ run: source tools/ci.sh && ci_unix_nanbox_build
+ - name: Run main test suite
+ run: source tools/ci.sh && ci_unix_nanbox_run_tests
+ - name: Print failures
+ if: failure()
+ run: tests/run-tests.py --print-failures
+
+ float:
+ runs-on: ubuntu-latest
+ steps:
+ - uses: actions/checkout@v2
+ - name: Build
+ run: source tools/ci.sh && ci_unix_float_build
+ - name: Run main test suite
+ run: source tools/ci.sh && ci_unix_float_run_tests
+ - name: Print failures
+ if: failure()
+ run: tests/run-tests.py --print-failures
+
+ stackless_clang:
+ runs-on: ubuntu-20.04
+ steps:
+ - uses: actions/checkout@v2
+ - name: Install packages
+ run: source tools/ci.sh && ci_unix_clang_setup
+ - name: Build
+ run: source tools/ci.sh && ci_unix_stackless_clang_build
+ - name: Run main test suite
+ run: source tools/ci.sh && ci_unix_stackless_clang_run_tests
+ - name: Print failures
+ if: failure()
+ run: tests/run-tests.py --print-failures
+
+ float_clang:
+ runs-on: ubuntu-20.04
+ steps:
+ - uses: actions/checkout@v2
+ - name: Install packages
+ run: source tools/ci.sh && ci_unix_clang_setup
+ - name: Build
+ run: source tools/ci.sh && ci_unix_float_clang_build
+ - name: Run main test suite
+ run: source tools/ci.sh && ci_unix_float_clang_run_tests
+ - name: Print failures
+ if: failure()
+ run: tests/run-tests.py --print-failures
+
+ settrace:
+ runs-on: ubuntu-latest
+ steps:
+ - uses: actions/checkout@v2
+ - name: Build
+ run: source tools/ci.sh && ci_unix_settrace_build
+ - name: Run main test suite
+ run: source tools/ci.sh && ci_unix_settrace_run_tests
+ - name: Print failures
+ if: failure()
+ run: tests/run-tests.py --print-failures
+
+ settrace_stackless:
+ runs-on: ubuntu-latest
+ steps:
+ - uses: actions/checkout@v2
+ - name: Build
+ run: source tools/ci.sh && ci_unix_settrace_stackless_build
+ - name: Run main test suite
+ run: source tools/ci.sh && ci_unix_settrace_stackless_run_tests
+ - name: Print failures
+ if: failure()
+ run: tests/run-tests.py --print-failures
+
+ macos:
+ runs-on: macos-11.0
+ steps:
+ - uses: actions/checkout@v2
+ - uses: actions/setup-python@v2
+ with:
+ python-version: '3.8'
+ - name: Build
+ run: source tools/ci.sh && ci_unix_macos_build
+ - name: Run tests
+ run: source tools/ci.sh && ci_unix_macos_run_tests
+ - name: Print failures
+ if: failure()
+ run: tests/run-tests.py --print-failures
+
+ qemu_mips:
+ runs-on: ubuntu-latest
+ steps:
+ - uses: actions/checkout@v2
+ - name: Install packages
+ run: source tools/ci.sh && ci_unix_qemu_mips_setup
+ - name: Build
+ run: source tools/ci.sh && ci_unix_qemu_mips_build
+ - name: Run main test suite
+ run: source tools/ci.sh && ci_unix_qemu_mips_run_tests
+ - name: Print failures
+ if: failure()
+ run: tests/run-tests.py --print-failures
+
+ qemu_arm:
+ runs-on: ubuntu-latest
+ steps:
+ - uses: actions/checkout@v2
+ - name: Install packages
+ run: source tools/ci.sh && ci_unix_qemu_arm_setup
+ - name: Build
+ run: source tools/ci.sh && ci_unix_qemu_arm_build
+ - name: Run main test suite
+ run: source tools/ci.sh && ci_unix_qemu_arm_run_tests
+ - name: Print failures
+ if: failure()
+ run: tests/run-tests.py --print-failures
diff --git a/components/language/micropython/.github/workflows/ports_windows.yml b/components/language/micropython/.github/workflows/ports_windows.yml
new file mode 100644
index 00000000..1bfe40c7
--- /dev/null
+++ b/components/language/micropython/.github/workflows/ports_windows.yml
@@ -0,0 +1,23 @@
+name: windows port
+
+on:
+ push:
+ pull_request:
+ paths:
+ - '.github/workflows/*.yml'
+ - 'tools/**'
+ - 'py/**'
+ - 'extmod/**'
+ - 'lib/**'
+ - 'ports/unix/**'
+ - 'ports/windows/**'
+
+jobs:
+ build:
+ runs-on: ubuntu-latest
+ steps:
+ - uses: actions/checkout@v2
+ - name: Install packages
+ run: source tools/ci.sh && ci_windows_setup
+ - name: Build
+ run: source tools/ci.sh && ci_windows_build
diff --git a/components/language/micropython/.github/workflows/ports_zephyr.yml b/components/language/micropython/.github/workflows/ports_zephyr.yml
new file mode 100644
index 00000000..d9ae2b8c
--- /dev/null
+++ b/components/language/micropython/.github/workflows/ports_zephyr.yml
@@ -0,0 +1,24 @@
+name: zephyr port
+
+on:
+ push:
+ pull_request:
+ paths:
+ - '.github/workflows/ports_zephyr.yml'
+ - 'tools/**'
+ - 'py/**'
+ - 'extmod/**'
+ - 'lib/**'
+ - 'ports/zephyr/**'
+
+jobs:
+ build:
+ runs-on: ubuntu-latest
+ steps:
+ - uses: actions/checkout@v2
+ - name: Install packages
+ run: source tools/ci.sh && ci_zephyr_setup
+ - name: Install Zephyr
+ run: source tools/ci.sh && ci_zephyr_install
+ - name: Build
+ run: source tools/ci.sh && ci_zephyr_build
diff --git a/components/language/micropython/.gitignore b/components/language/micropython/.gitignore
new file mode 100644
index 00000000..73424899
--- /dev/null
+++ b/components/language/micropython/.gitignore
@@ -0,0 +1,48 @@
+# Compiled Sources
+###################
+*.o
+*.a
+*.elf
+*.bin
+*.map
+*.hex
+*.dis
+*.exe
+
+# Packages
+############
+
+# Logs and Databases
+######################
+*.log
+
+# VIM Swap Files
+######################
+*.swp
+
+# Build directories
+######################
+build/
+build-*/
+
+# Test failure outputs
+######################
+tests/results/*
+
+# Python cache files
+######################
+__pycache__/
+*.pyc
+
+# Customized Makefile/project overrides
+######################
+GNUmakefile
+user.props
+
+# Generated rst files
+######################
+genrst/
+
+# MacOS desktop metadata files
+######################
+.DS_Store
diff --git a/components/language/micropython/.gitmodules b/components/language/micropython/.gitmodules
new file mode 100644
index 00000000..118e023d
--- /dev/null
+++ b/components/language/micropython/.gitmodules
@@ -0,0 +1,52 @@
+[submodule "lib/axtls"]
+ path = lib/axtls
+ url = https://github.com/micropython/axtls.git
+[submodule "lib/libffi"]
+ path = lib/libffi
+ url = https://github.com/atgreen/libffi
+[submodule "lib/lwip"]
+ path = lib/lwip
+ url = https://github.com/lwip-tcpip/lwip.git
+[submodule "lib/berkeley-db-1.xx"]
+ path = lib/berkeley-db-1.xx
+ url = https://github.com/pfalcon/berkeley-db-1.xx
+[submodule "lib/stm32lib"]
+ path = lib/stm32lib
+ url = https://github.com/micropython/stm32lib
+ branch = work-F0-1.9.0+F4-1.16.0+F7-1.7.0+G4-1.3.0+H7-1.6.0+L0-1.11.2+L4-1.17.0+WB-1.10.0+WL-1.1.0
+[submodule "lib/nrfx"]
+ path = lib/nrfx
+ url = https://github.com/NordicSemiconductor/nrfx.git
+[submodule "lib/mbedtls"]
+ path = lib/mbedtls
+ url = https://github.com/ARMmbed/mbedtls.git
+[submodule "lib/asf4"]
+ path = lib/asf4
+ url = https://github.com/adafruit/asf4
+ branch = circuitpython
+[submodule "lib/tinyusb"]
+ path = lib/tinyusb
+ url = https://github.com/hathach/tinyusb
+[submodule "lib/mynewt-nimble"]
+ path = lib/mynewt-nimble
+ url = https://github.com/micropython/mynewt-nimble.git
+[submodule "lib/btstack"]
+ path = lib/btstack
+ url = https://github.com/bluekitchen/btstack.git
+[submodule "lib/nxp_driver"]
+ path = lib/nxp_driver
+ url = https://github.com/hathach/nxp_driver.git
+[submodule "lib/libhydrogen"]
+ path = lib/libhydrogen
+ url = https://github.com/jedisct1/libhydrogen.git
+[submodule "lib/pico-sdk"]
+ path = lib/pico-sdk
+ url = https://github.com/raspberrypi/pico-sdk.git
+[submodule "lib/fsp"]
+ path = lib/fsp
+ url = https://github.com/renesas/fsp.git
+[submodule "lib/wiznet"]
+ path = lib/wiznet5k
+ url = https://github.com/andrewleech/wiznet_ioLibrary_Driver.git
+ # Requires https://github.com/Wiznet/ioLibrary_Driver/pull/120
+ # url = https://github.com/Wiznet/ioLibrary_Driver.git
diff --git a/components/language/micropython/ACKNOWLEDGEMENTS b/components/language/micropython/ACKNOWLEDGEMENTS
new file mode 100644
index 00000000..41ed6bf2
--- /dev/null
+++ b/components/language/micropython/ACKNOWLEDGEMENTS
@@ -0,0 +1,1764 @@
+The MicroPython project was proudly and successfully crowdfunded
+via a Kickstarter campaign which ended on 13th December 2013. The
+project was supported by 1923 very generous backers, who pledged
+for a total of 2320 pyboards.
+
+Damien George, the project creator, is grateful to the people
+listed below (and others who asked not to be named), whose support
+of the project help make the code in this repository what it is
+today. The names appear in order of pledging.
+
+ 3 Cliff Senkbeil
+ 4 MacDefender (http://www.macdefender.org)
+ 11 Shaun Walker - http://theshaun.com
+ 12 Robert Joscelyne
+ 17 Peter Simon, Germany
+ 18 theNetImp
+ 21 Eamonn Maguire
+ 22 Rob Knegjens
+ 27 Greg, https://www.logre.eu
+ 28 Rick S
+ 30 Norman Jaffe (OpenDragon)
+ 34 UltraBob was here.
+ 35 Geoffrey R. Thompson
+ 36 MrAtoni
+ 40 Proud to be a backer of Micro Python, Phil C. United Kingdom.
+ 42 www.babybadger.co.uk
+ 45 Mert
+ 46 Miles Cederman-Haysom
+ 47 unixarmy.com
+ 52 Proud to be here! Tonton Pommes
+ 54 Espen Sae-Tang Ottersen
+ 56 howang.hk
+ 58 Innovatology
+ 59 Marzsman
+ 63 Tristan A. Hearn
+ 64 Patrick Clarke
+ 65 Bryan Lyon
+ 70 Craig Burkhead
+ 72 Dr Igor Vizir
+ 73 Steve Iltis, @steven_iltis
+ 79 www.giacomo.inches.ch
+ 80 Alexander Gordeyev
+ 81 Steve Conklin www.ai4qr.com
+ 83 n1c0la5
+ 84 Matthew R. Johnson
+ 86 Jeppe Rishede
+ 87 Kirill Zakharenko - Russian Federation
+ 88 beltwaybureau.com
+ 93 felix svoboda
+ 95 Smart
+ 96 Stephen Goudge
+ 97 Dr Richard Whitaker, www.drrich.co.uk, UK
+ 99 Tim Robertson
+ 101 Rudy De Volder, www.devolder.be, Belgium
+ 104 August H., Wien
+ 107 Jason Hsu
+ 109 dstensnes
+ 110 Joe Reynolds (professorlamp)
+ 112 Michael Davies (AU) - @butterparty @spaceduststudio
+ 113 Jim Kirk, Westborough, MA, USA
+ 114 yfnt
+ 117 Even when it looks like someone is reaching for blue sky. Some days you just have to blindly support that dreamer.
+ 118 G. Todd Vaules - todd.vaules.net
+ 122 Gunnar Wehrhahn
+ 124 Eric Masser
+ 126 Vaibhav Sagar
+ 128 Eric Wallstedt
+ 129 Richard G Wiater
+ 130 Toby Nance
+ 132 Michael Fogleman
+ 133 Snepo Research www.snepo.com Gary says Hi!
+ 137 nic gihl
+ 138 Felix Yuan
+ 139 mmhanif
+ 141 James Snyder
+ 144 roddyr2
+ 146 Richard Jones
+ 147 Jon-Eric Simmons
+ 148 Craig "The Coder" Dunn
+ 150 Jesse S (USA)
+ 151 Matt I. - github.com/pengii23
+ 153 Seth Borders - sethborders.com
+ 155 David Zemon (http://david.zemon.name)
+ 156 Garry DuBose
+ 157 Apeiron Systems
+ 158 BAR
+ 160 Jakob Hedman
+ 163 Bryan Moffatt
+ 165 Moises Lorenzo, Tenerife Isl.
+ 166 Erik H.
+ 170 Peter George
+ 171 Nikolas Akerblom
+ 174 Chris (@chassing)
+ 176 Wei-Ning Huang
+ 178 Edd Barrett, UK
+ 179 Alec Langford
+ 180 Shunya Sato
+ 181 Serge GUILLAUME
+ 183 Dr. Ross A Lumley
+ 184 Dorian Pula
+ 189 Tendayi Mawushe
+ 190 SDanziger
+ 191 Sean O'Donnell
+ 192 Kevin McLaughlin
+ 193 Tommy Allen
+ 194 Beedlebub
+ 195 Brad Howes
+ 196 Mike B
+ 200 Aleš Bublík
+ 202 David Dever
+ 206 Danilo Bargen, https://dbrgn.ch/
+ 209 Brendan Curran-Johnson
+ 210 Piotr Maliński http://www.rkblog.rk.edu.pl
+ 211 SEE Co. - Science, Engineering and Education Co. - www.seeco.us
+ 215 Richard Lancaster
+ 218 Bilbo Baggins from Middle Zealand
+ 219 Ollie Guy
+ 221 Shlomo Zippel
+ 222 Andy Kenny
+ 223 Double-O-ren
+ 226 For the pleasure of @tinproject
+ 229 mfr
+ 230 Eric Floehr
+ 232 Matt from Adp.EU.Com
+ 234 Joanna Tustanowska & Wojciech Bederski
+ 235 Eric LeBlanc
+ 236 Siggy , Belgium
+ 238 Mauro De Giorgi
+ 239 Belug http://belug.ca/
+ 241 Arik Baratz - @arikb
+ 242 Zvika Palkovich
+ 243 Yves Dorfsman - yves at zioup dot com
+ 244 Asad Ansari, Canada
+ 245 Brandon Bennett
+ 246 Christoph Bluoss
+ 248 Konstantin Renner
+ 249 Abtin Afshar
+ 250 A. Soltani
+ 251 Jon Mills
+ 256 NoisyGecko
+ 258 Lothilius
+ 262 Jay Deiman
+ 263 flo at twigs dot de
+ 265 _Mark_ eichin at thok dot org
+ 267 Adrian Astley
+ 268 aknerats[::-1]
+ 271 @robberwick
+ 272 Daniele Lacamera
+ 273 Thanks to M. Derome
+ 275 Paul Paradigm, Australia
+ 276 lyuden
+ 277 www.SamuelJohn.de
+ 279 John Pinner, funthyme at gmail dot com
+ 280 Michael and Vicky Twomey-Lee
+ 281 Kenneth Ljungqvist
+ 292 Karin Beitins, Australia
+ 295 Nick Johnson
+ 297 Chris Cole U.K.
+ 298 The planet Andete is famous for its killer edible poets.
+ 302 Patrick B (aged 11)
+ 304 Chris Mason, Australia
+ 306 Steven Foster
+ 308 Pat Fleury, Andrew Hodgson
+ 311 @moneywithwings
+ 313 Neil Stephen
+ 314 Cory A. Johannsen
+ 315 Massimo Di Stefano - geofemengineering.it - Italy
+ 317 James Luscher, Madison, Wisconsin, USA
+ 319 Lindsay Watt
+ 320 Nils Fischbeck
+ 324 Peter J. Farrell - Maestro Publishing, LLC - Minneapolis, MN, USA
+ 325 Alex Willmer (@moreati)
+ 328 T.R. Renicker
+ 329 William B. Phelps
+ 330 David Goodger
+ 331 Viktoriya Skoryk
+ 334 JR Rickerson
+ 336 Keven Webb
+ 338 www.hcfengineering.com
+ 341 Larry Lab Rat, Shalford.
+ 342 Rob Hetland
+ 343 Brush Technology (NZ)
+ 346 Jason Fehr
+ 347 Olivier Vigneresse
+ 348 Nano Gennari, me at nngn dot net, Brasilia, Brazil
+ 352 Petr Viktorin (http://encukou.cz)
+ 355 Karijn Wessing (IN2TECH)
+ 356 Arsham Hatambeiki
+ 358 Alvaro Rivera-Rei
+ 360 Nolan & Theo Baldwin
+ 362 Tyler Baker, USA
+ 363 Russell Warren (Canada)
+ 365 Aaron Peterson
+ 366 Al Billings
+ 367 Jeremy Herbert
+ 372 Dimitrios Bogiatzoules, www.bogiatzoules.de, Germany
+ 375 Paul Nicholls
+ 376 Robert F. Brost
+ 378 Aideen (Cambridge, UK) - Very happy backer and follower of this great project
+ 379 Caelan Borowiec
+ 380 Caroline, Canada - carolinesimpson.ca
+ 382 Rikard Anglerud
+ 383 Scott Will
+ 384 Jussi Ylanen
+ 385 @joshbapiste
+ 387 spongefile
+ 389 Keith Baston
+ 392 Holger Steinlechner
+ 394 sent by State mail service
+ 398 N.Pearce, Wells UK - @t #ashtag UK
+ 399 Paid up & stood back;;
+ 401 Mike M. Tempe, AZ, USA
+ 406 Brandon Jasper
+ 407 Dan Mahoney
+ 411 George Bushnell, for use in CPSS
+ 412 Per Konradsson
+ 413 Supported by afinzel
+ 417 Tom Igoe
+ 418 Jonathan Saggau
+ 419 Chris Allick http://chrisallick.com
+ 420 joshuaalbers.com
+ 423 B. Adryan
+ 432 Tim Fuchs
+ 433 steven antalics
+ 434 BezouwenR
+ 435 Andrew Addison
+ 436 Hubert de L'arrêtdubus - France
+ 437 Salim Fadhley
+ 438 Ben Hockley
+ 439 Geoffrey Webb
+ 441 Vladimir Mikulik
+ 442 7 Elements & Troy Benjegerdes - hozer at hozed dot org
+ 443 Pashakun
+ 444 Craig Barnes, UK
+ 445 Andres Ayala
+ 446 Stonly Baptiste (urban.us)
+ 448 Brian Conner
+ 452 Jeremy Blum (jeremyblum.com)
+ 454 Pebble Technology
+ 455 Andrew
+ 456 Jeffrey Allen Randorf, PE PhD
+ 457 J.A.Zaratiegui a.k.a. Zara
+ 459 simon.vc and hack.rs
+ 462 La vida es para vivirla y ser feliz, de esa forma damos gracias por tan gran regalo!
+ 463 Alistair Walsh
+ 469 fun, Ireland
+ 474 martijnthe.nl
+ 479 Andreas Kobara
+ 486 Armanda
+ 487 Richard Myhill
+ 488 Ash Gibbons
+ 489 Glenn Franxman HackerMojo.com
+ 492 Russell Durrett
+ 494 Pieter Ennes
+ 495 Tom Gross, Washington D.C.
+ 496 Mark Schafer
+ 497 Sandro Dutra, Brazil
+ 500 Can Bulbul
+ 501 Chih-Chun Chen, http://abmcet.net/Chih-Chun_Chen/home.html
+ 502 Lost Property Bureau Ltd
+ 503 skakz
+ 504 Chad Cooper
+ 505 Makhan Virdi, mlvirdi.com, InfinityXLabs.com, USA
+ 506 Glenn Ruben Bakke, Norway
+ 507 Alasdair Allan
+ 509 dlbrandon
+ 511 Dr J Garcia, Sweden
+ 513 Tiago Vieira
+ 518 Team ME
+ 519 OBD Solutions (http://www.obdsol.com)
+ 520 @pors
+ 521 Joo Chew Ang
+ 523 garbas
+ 526 http://epoz.org/
+ 527 J. Sabater
+ 530 José-María Súnico
+ 537 Erfundnix
+ 538 Tontonisback Belgium
+ 539 Greg Benson, Professor, University of San Francisco
+ 542 Thomas Sarlandie aka @sarfata
+ 545 JanTheMan kickstarter at embedded-systems dot craftx dot biz
+ 546 Chuhan Frank Qin
+ 549 Peb R Aryan, Indonesia
+ 553 Johan Deimert, http://www.ldchome.org
+ 555 Conny Sjöblom / Finland
+ 558 AndyboyH, UK
+ 559 Anthony Lupinetti
+ 561 Travis Travelstead
+ 566 Siegfried Boyd Isidro-Cloudas
+ 567 G. Schroeer
+ 568 mmths, http://randomaccessmemory.at/
+ 570 Andy Miller - NZ..
+ 571 Rodolfo Lara from México
+ 572 Gary Patton Wolfe
+ 574 Vend-lab Russia
+ 578 Super Job! FXF
+ 579 Oliver Heggelbacher, www.kickdrive.de
+ 581 James Husum
+ 585 David Lodge
+ 587 Tess
+ 592 PR Taylor
+ 593 6306665119
+ 598 Jorg Bliesener, Brazil - www.bliesener.com
+ 602 Rodrigo, Germany
+ 605 Tanja Kaiser, www.mrsminirobot.de, Germany
+ 606 Franco Ponticelli - www.weblob.net
+ 608 Piet Hoffman
+ 609 Paul Cunnane
+ 610 Balazs Kinszler
+ 611 Nathan Ramella (synthesizerpatel)
+ 612 Tyler Jones (squirly)
+ 613 James Saffery
+ 614 Christoffer Sjowall
+ 615 Iman Shames
+ 616 Thomas Dejanovic, Australia.
+ 618 Tom Alker
+ 619 Matt Davis, UK
+ 621 Design for the real world! @UXnightingale
+ 622 Budd Van Lines
+ 624 __Gio__
+ 628 Chew Kok Hoor
+ 630 Santiago Alarcon, Thanks Damien for Micro Python
+ 632 hardtoneselector
+ 633 supported by Chris Bunker
+ 634 Sebus - France
+ 635 Mechanical Men Sweden
+ 638 A Fellow Electronics Enthusiast
+ 639 Stan Seibert
+ 642 Dave Curtis
+ 652 Sebastian Ross - www.ross.sx
+ 653 Julien Goodwin
+ 654 Reinoud de Lange, the Netherlands
+ 655 carl beck
+ 659 John Gaidimas
+ 660 Tyler Eckwright
+ 661 Keith Rome (Wintellect - http://www.wintellect.com/blogs/krome)
+ 662 Kashev Dalmia - kashevdalmia.com
+ 666 Alberto Martín de la Torre
+ 667 Niels Kjøller Hansen
+ 668 pmst - Italy
+ 671 Sergio Conde Gómez (skgsergio)
+ 672 Micromint, www.micromint.com
+ 673 Xie Yanbo, China
+ 675 Thank you
+ 677 Kacem Ben Dhiab
+ 679 CornishSteve
+ 680 Daniel Wood, Warrington, UK.
+ 682 Greg "GothAck" Miell
+ 688 Matt Williams & Sam Carter
+ 691 Frédéric Lasnier
+ 694 Tim K
+ 697 Joshua Clarke, Guernsey!
+ 700 daynewaterlow.com
+ 703 Scott Winder
+ 704 @DepletionMode
+ 707 Maria Yablonina
+ 710 Roger Hausermann
+ 713 Crazy_Owl
+ 714 mike hardin usa
+ 717 C. Towne Springer
+ 719 ursm gruesst euch
+ 720 madnis
+ 727 http://itay.bazoo.org
+ 729 @0atman
+ 730 Jerry Gagnon
+ 732 Emmanuel Boyer
+ 738 suspenders
+ 739 Roland Frédéric - http://www.creativeconvergence.be/
+ 742 @herchu
+ 745 Riley Lundquist
+ 746 Go LOBOS
+ 749 João Alves, http://jpralves.net, Portugal
+ 751 Nick Porcino
+ 753 Jack E. Wilkinson, Texas, USA
+ 754 @rcarmo on Twitter/Github
+ 758 Matt Manuel, www.mattmanuel.com
+ 759 Padraic D. Hallinan
+ 760 Rob Fairbairn
+ 763 Zac Luzader
+ 768 Sam Shams
+ 773 terje nagel, dk
+ 775 Luc LEGER
+ 782 Luis M. Morales S.
+ 785 Charles Edward Pax
+ 786 Daryl Cumbo
+ 787 Zephyris13
+ 788 Wonderful project.
+ 792 Sylvain Maziere
+ 794 Milen
+ 795 Robert Mai, Germany, hsapps.com
+ 797 Angelo Compagnucci angelo.compagnucci at gmail dot com
+ 801 Long Live Micro Python, airtripper.com
+ 804 António M P Mendes
+ 805 Marc Z.
+ 809 Anoyomouse
+ 810 in memory of Dan J. Schlacks III
+ 817 Peter Froehlich - http://werk-schau.blogspot.com
+ 818 Ahmad Albaqsami
+ 821 Peter Lavelle (http://solderintheveins.co.uk)
+ 822 Manuel Sagra de Diego http://manuelsagra.com/
+ 823 Sam Wilson
+ 824 Khalis
+ 825 c't Hacks
+ 828 Georg Bremer
+ 830 Ward en Sanne (WenS)
+ 832 javacasm http://www.elcacharreo.com Spain
+ 833 mctouch
+ 835 Bruce Schreiner @ www.stevenscollege.edu/electronics
+ 836 Jonas
+ 839 Nick Ludlam
+ 840 Patrick_Law, UK
+ 843 Alex Crouzen, UK
+ 848 Ben Banfield-Zanin
+ 850 Wouter Slegers, Your Creative Solutions
+ 851 Fred Zyda
+ 853 Gianfranco Risaliti
+ 854 Ron Hochsprung
+ 858 Vianney Tran
+ 862 Aaron Mahler - http://halfpress.com
+ 868 Stephan Schulte, Germany
+ 869 Kenneth Henderick
+ 872 DaveP (www.davepeake.com)
+ 873 Markus Schuss, Austria
+ 876 Kyle Gordon, http://lodge.glasgownet.com
+ 877 Joseph Gerard Campbell
+ 881 Thanks for the board. Good luck to you. --Jason Doege
+ 883 Garet McKinley
+ 884 www.magtouchelectronics.co.za
+ 889 Ben Johnson
+ 896 Ruairi Newman
+ 897 Gemma Hentsch
+ 902 Alexander Steppke
+ 906 Stephen Paulger
+ 907 Martin Buhr, http://lonelycode.com, UK
+ 912 Dale Drummond
+ 913 Go Utah State
+ 918 Jarturomartinez, Mexico
+ 921 Barry Bourne Micro Python Supporter
+ 923 Andreas Bolka
+ 927 Thanks Susan, Tom, Paul, and Mark!
+ 935 http://wall-y.fr
+ 937 Eero af Heurlin, Finland, https://github.com/rambo/
+ 938 Guillaume DAVY
+ 941 Alexander Steffen
+ 942 Janne "Lietu" Enberg
+ 945 Luca 'loop' de Marinis - https://github.com/loop23
+ 946 Andras Veres-Szentkiralyi http://techblog.vsza.hu/
+ 948 Florian flowolf Klien (http://blog.flo.cx)
+ 949 nickyb
+ 951 Mark Walland, England
+ 952 Ian Barfield
+ 953 Andrew Murray, UK - eat my code - http://links.bloater.org/micropython
+ 955 Kyle Howells
+ 956 Chris Cadonic
+ 957 LCS, USA: scripting___/||\===/||\___embedded
+ 958 Sven Wegener
+ 963 Kean Electronics http://www.kean.com.au/
+ 964 Beandob
+ 965 Don't feed the troll.
+ 966 Alexis Polti (http://rose.eu.org)
+ 969 Scottyler
+ 971 The Dead's Own Jones
+ 974 Evseev Alexey
+ 976 Arnaud
+ 978 Jannis Rosenbaum
+ 980 paul at fontenworks dot com
+ 981 John Griessen ecosensory.com USA
+ 982 Tobias Ammann
+ 983 Simon V.
+ 984 JaWi
+ 987 Ergun Kucukkose
+ 989 Jonathan Piat France
+ 990 Steve Pemberton
+ 993 Aaron Robson
+ 994 Antoine Authier
+ 995 Thomas Winkler, Austria
+ 997 Jannes mit dem dicken Pannes
+ 1001 Joe Baker
+ 1002 Jon Hylands, Canada (blog.huv.com)
+ 1004 Mike Asker (aka mpymike)
+ 1007 Charles V Bock - Charles at CharlesBock dot com
+ 1010 Remember June 4th, 1989
+ 1012 Stuart Marsden
+ 1013 Herbert Graef, Stuttgart
+ 1014 Arthur P, USA
+ 1015 John Hall & Jeremy Armijo
+ 1017 Luciano Ramalho, Python.pro.br
+ 1018 Quentin Stafford-Fraser
+ 1019 Marcin Walendzik Ratingpedia.eu
+ 1020 Wincent Balin
+ 1022 rbp
+ 1024 Frank Carver ( www.frankcarver.me )
+ 1026 Peter Farmer, http://geekytronics.com/
+ 1029 Rubens Altimari
+ 1033 Sebastian
+ 1035 Gerli, Estonia
+ 1036 Maurin, Switzerland
+ 1037 Kevin Houlihan (http://crimsoncookie.com)
+ 1039 Jon Green of Adeptium Consulting (www.adeptium.com)
+ 1040 Eirik S. Mikkelsen
+ 1042 Jogy Sam
+ 1043 GGG
+ 1045 Sean E Palmer, epimetheon.com
+ 1049 Greg O'Drobinak, USA
+ 1050 RaptorBird Robotics Inc
+ 1051 Desmond Larsen-Rosner
+ 1056 Crusty
+ 1057 ArthurGuy.co.uk
+ 1059 Melissa-Ivan, 14/04/2013
+ 1064 Enrico Spinielli, https://github.com/espinielli
+ 1066 Dave Snowdon
+ 1067 Martin P. Hellwig
+ 1070 Carl Clement
+ 1074 Paul Taylor
+ 1076 Pandemon
+ 1082 Thrilled to support Damien's effort to put this together: there will no doubt be many applications for this effort and many enhancements and ports..
+ 1083 Oddvar Lovaas
+ 1090 BenScarb
+ 1093 Www.qualnetics.com
+ 1094 Manny Muro - Now Python can RULE from below as it does from above! PYTHON RULES!!! :)
+ 1095 Michael Grazebrook
+ 1098 Mark Shuttleworth, UK
+ 1106 wyzzar
+ 1110 Luca Zanetti
+ 1112 Carl A Fagg
+ 1115 Adam Klotblixt
+ 1118 Breawn
+ 1122 pippyisatruck
+ 1124 Andrew "ClothBot" Plumb
+ 1126 Realise the projects your heart beats for! Sven Wiebus (http://wiebus.tumblr.com)
+ 1128 Citius Systems
+ 1130 Benjamin & Reuben Fuller
+ 1131 aglimme
+ 1133 John Becker
+ 1135 Mark Drummond
+ 1138 JHProuty
+ 1141 Lars Olsson Sweden
+ 1144 daisuke, http://dkpyn.com
+ 1145 Chris Pawley - http://www.pawley.co.uk/honey/
+ 1147 Daniel from EzSBC.com
+ 1149 New York Mortgage Exchange NYME.COM
+ 1150 Herb Winters,USA,www.ecs87.com
+ 1151 renttu
+ 1159 Joe Rickerby
+ 1160 john guthrie
+ 1161 PUBLIC
+ 1163 dobra-dobra
+ 1164 Neil Reynolds, Staffordshire
+ 1165 GEHoward
+ 1166 Frank Delporte
+ 1167 Bauer Brauner Enterprise
+ 1168 Francisco Mardones
+ 1169 Ryan Kirkpatrick, @rkirkpatnet, http://rkirkpat.net/
+ 1170 Krister Svanlund
+ 1174 Derek Patton Pearcy
+ 1177 Roger Olsson, Sweden
+ 1179 Jan-Niklas Braak
+ 1180 Pete boy
+ 1181 MilenX
+ 1182 Ubbe Larsson
+ 1183 Simon Freethy
+ 1184 Daniel Andersson
+ 1187 Daniele Procida
+ 1190 Adrian Duke
+ 1191 Pauline Middelink
+ 1193 Ted Gueniche
+ 1197 Craig Knott, University of Queensland, Australia
+ 1198 Jamie Mackenzie - Australia
+ 1199 ravenoak
+ 1200 LucaP Luni Italy
+ 1203 jacanterbury
+ 1205 Bleachin, www.rhyspowell.com
+ 1207 Supported by Andrew Maier via Kickstarter
+ 1208 Rob, http://robjstanley.me.uk
+ 1210 George Gingell
+ 1213 Chris Elleman
+ 1215 Jack Barham - @jackbarham - http://jackbarham.com
+ 1221 Kyle Dausin
+ 1222 Ben Lucker
+ 1225 Gareth cheesewhisk Evans
+ 1226 Jacob Forsyth
+ 1227 Olof S - Germany
+ 1231 Brasil
+ 1233 glaslos
+ 1234 Will Cooke - http://www.whizzy.org
+ 1236 Andrew Wright - Canada
+ 1239 Resourceful Robin
+ 1240 Jay O'Neill @jayoneilluk
+ 1241 Dennis G Daniels
+ 1244 J. Peterson (www.saccade.com)
+ 1245 Chipaca
+ 1246 Nicko van Someren
+ 1247 C. Cumbaa, Canada
+ 1248 Gyro Gearloose was here
+ 1249 Magnus Ericmats, Sweden
+ 1253 Steve Wilson
+ 1256 Adrian Bullock
+ 1258 Sarevian & Longwall
+ 1261 Skipp Savage
+ 1265 Eric Nahon
+ 1267 Stuart Dallas / 3ft9 Ltd
+ 1270 USA
+ 1271 Oliver
+ 1277 jeffmcneill.com
+ 1278 alnjxn
+ 1283 Marc Liyanage
+ 1285 Christian Lange
+ 1286 Bryant Paul Umali from the Philippines
+ 1290 W.B.Hill, Norwich, UK
+ 1292 Michael Karliner
+ 1293 Oli Larkin
+ 1303 A. Pockberger
+ 1304 dc - bagel
+ 1305 Thadeus Arnel
+ 1308 technoweenie
+ 1309 Liam Welsh
+ 1313 Per Thorell, Sweden
+ 1314 peterlee
+ 1316 Dustin Mierau
+ 1317 tech-zen.tv
+ 1320 Cheers from IDF :)
+ 1322 www.a-d-k.de
+ 1323 rixx
+ 1324 @jlev
+ 1325 e2e4
+ 1328 Thomas J. Quinlan, London UK
+ 1329 Don Bone
+ 1331 Narayanamurthi
+ 1333 PGS_Astra-ProjeX_Wilts
+ 1337 Mark Schulz & Phillip Long, CEIT, The University of Queensland
+ 1340 Tiegeng (Tim) Ren
+ 1344 EMR_1344, DE
+ 1348 Matt Ward, Nottingham
+ 1351 Rupert
+ 1352 Cory Li - http://cory.li
+ 1354 Jim Davies, Brighton, UK
+ 1355 Jon Watkins, UK
+ 1356 Thomas, www.bitmix.de
+ 1359 Markus Gritsch
+ 1362 Carl H. Blomqvist
+ 1371 Brian Green
+ 1374 Ben Merryman
+ 1375 O'Dea
+ 1376 Josh Trujillo
+ 1378 Daniel Halloran
+ 1379 another_martin
+ 1383 Thanks for innovating!
+ 1385 CoderDojo Malahide
+ 1397 Jacob Z
+ 1398 Staffan Hillberg
+ 1399 http://kim.ht
+ 1402 Can't wait to plug it in!
+ 1403 Márton Szinovszki
+ 1405 sellorm says 'Hi!'
+ 1406 Thomas Provoost
+ 1411 Clive Freeman
+ 1412 Norman Thomas
+ 1415 Javier Llopis
+ 1417 Ho Man Fai
+ 1418 Anders Helland
+ 1421 Richard lavanture
+ 1425 Alan Churley, UK
+ 1426 Robert'); DROP TABLE Students;--unicode is fun!
+ 1427 Go Illini!
+ 1430 MicroPy FTW
+ 1431 Bryan Morrissey, www.browninnovations.com
+ 1436 Krzysztof Chomski, Poland
+ 1437 WellAware (USA)
+ 1441 Tomas Hau
+ 1443 Paul Way
+ 1444 Benjamin Anderson
+ 1445 Andrew Bates
+ 1446 Davide Di Blasi
+ 1451 Mathias Fischer
+ 1453 Drexore, NL
+ 1454 Marek Mroz
+ 1455 Mark Easley Jr. - USA
+ 1457 Joshua Warren
+ 1459 Rohan Menon
+ 1460 Paul Sokolovsky
+ 1461 Chris Foresman, @foresmac
+ 1475 USI
+ 1478 Chris Emerson
+ 1479 Ph. Truillet, France, http://www.irit.fr/~Philippe.Truillet
+ 1480 WAB3
+ 1481 Lucidologia.pl
+ 1482 Ed Hardebeck | www.hardebeck.us
+ 1484 Ludovic Léau-Mercier, www.coriolys.org, France
+ 1487 BLUEBOBO
+ 1488 Berno Kneer, Germany
+ 1491 Julian Eccli
+ 1494 Batman
+ 1495 Manuel Núñez Sánchez
+ 1496 Millie and Sadie Smith
+ 1499 Ronald Eddy
+ 1500 SynShop Las Vegas
+ 1503 This is really cool. - Jack Conway
+ 1505 Victor Suarez, Argentina
+ 1507 Renesas Electronics America
+ 1509 Team
+ 1513 A. Lamborn KD0ZFY
+ 1514 olifink
+ 1520 mike at sustainable-opportunities dot com
+ 1521 luis almeida, Teresina - Brazil
+ 1523 Muhammad Jamaludin
+ 1524 Sdlion
+ 1525 Charles Rogers
+ 1526 Diego M. Aires, Brazil
+ 1529 muwatt.com
+ 1532 Proud supporter of microPython
+ 1535 Jesus J. de Felipe
+ 1536 slminneman.com -- Wow, an acknowledgement? ...really?
+ 1538 Mike (Meski) Smith
+ 1541 Piero Steinger
+ 1545 Alex Rembish (https://rembish.org)
+ 1551 Sergey [BuG2BuG] Sobko, Russia
+ 1553 Serge Krier
+ 1556 Luuk Derksen
+ 1561 Jimmy Caille (CH)
+ 1562 Jesús Leganés Combarro "piranna"
+ 1564 Viacheslav Olegovich Savitskiy
+ 1565 Jamie Whitehorn
+ 1567 Bagge Carlson
+ 1568 Milan Cermak
+ 1569 Matthias Lemp
+ 1570 BOFG
+ 1571 Johan Elmerfjord, Sweden
+ 1573 Matt Finch • fnch.io
+ 1574 Jean-Francois Paris
+ 1575 Florian Franzen, Germany
+ 1576 doganowscy.com
+ 1579 Stan Yamane
+ 1580 William Cirillo
+ 1583 David Dibben
+ 1584 Nicolás, Amelia, Luli y alecu
+ 1586 Alex W
+ 1591 Livia Maria Dias Tavares
+ 1593 d freymann chicago il & his australian shepherd jaldi
+ 1594 Barnstorm Studio, LLC
+ 1595 Sashi Penta
+ 1597 tflhyl
+ 1598 clacktronics
+ 1599 j3hyde
+ 1600 Rik Williams
+ 1602 Valeriy Van, Ukraine, w7software.com
+ 1603 Louis Taylor - https://github.com/kragniz
+ 1606 What's the derivative of (6.022 x 10^23)x? That's A(n)mol
+ 1611 Bailey & Brayden Yoong Policarpio
+ 1613 William Bettridge-Radford
+ 1617 Urbane Jackson
+ 1618 Henius
+ 1622 Alister Galpin, New Zealand
+ 1623 Marco Bertoldi
+ 1627 Julian Pistorius
+ 1628 www.neotral.com
+ 1632 ChrisB
+ 1633 Norbini
+ 1634 Eric Rand at Brownhatsecurity.com
+ 1636 Benjamin Eberle
+ 1637 MG Projects bvba, Geert Maertens, Belgium
+ 1640 Robson dos Santos França (Brasil)
+ 1642 Udine
+ 1643 Simon Critchley
+ 1644 Sven Haiges, Germany
+ 1646 "silicium" ("silicium_one", if "silicium" is busy)
+ 1648 Andy O'Malia, @andyomalia
+ 1650 RedCamelApps.com
+ 1652 Christoph Heer
+ 1653 AlisonW
+ 1654 Yannick Allard (Belgium) supported this project.
+ 1655 Andy Pointon, UK
+ 1660 Diego Cantalapiedra
+ 1664 Pepillou
+ 1670 Sonny Cannon
+ 1671 Rick W
+ 1672 David Chan, USA
+ 1674 Philip Rowlands
+ 1675 dieresys
+ 1676 T.R. Fullhart
+ 1683 Oleg Sidorkin
+ 1686 Tatsuro Yasukawa
+ 1687 Brad Smith, Somerville MA, USA
+ 1688 kristoffervikhansen.com
+ 1690 Nice Project de W6AKB Alan Biocca
+ 1691 Hiss Hisss Hissss Hiss Hiss Hissssssss
+ 1692 Alan Kennedy
+ 1698 ElChessu
+ 1701 Flower Craswell
+ 1702 David Fontenot
+ 1707 To innovation & creativity. Tony J Winter
+ 1708 Joakim Hentula
+ 1711 Michael Schaefer
+ 1713 Brody Radford ~ www.brodyradford.com
+ 1714 Charles Durrant
+ 1715 Rodrigo S.
+ 1718 Dima Shylo
+ 1719 Jiahao James Jian
+ 1722 Helen Wilson, Christ's Hospital
+ 1726 Martin Aule, http://hackest.org/
+ 1727 İsmail Etem Tezcan, Rasteda
+ 1728 Charlie "Blackfrog" Sizer
+ 1729 Matloob Qureshi
+ 1730 Travis Saul http://travissaul.com
+ 1731 Michael Cavins
+ 1733 Peter Köllensperger, Norway
+ 1734 Anne Harrison
+ 1736 Peter Bradeen
+ 1739 Fredrik Luthander
+ 1740 Nick LaRosa
+ 1744 Aladuino
+ 1745 dgrebb
+ 1746 Truls Unstad
+ 1748 Jesus Saves
+ 1750 Andy Stannard (@rockmonkey)
+ 1751 Daniel Atkinson
+ 1755 John Potter
+ 1758 Ian V
+ 1760 David Leinbach
+ 1761 nemec-automation.com
+ 1765 Supported by JoW with Hardwired TCP/IP from www.WIZnet.eu
+ 1767 misskniss, Boise Idaho. It is our responsibility to code the freedom we want to see in the world.
+ 1768 Jeff Vahue - Knowlogic Software Corp.
+ 1769 Pat Molloy
+ 1770 Greg Maxwell gregmaxwell-at-mac-dot-com
+ 1771 Rich Robinson
+ 1773 Ken Corey @ flippinbits.com
+ 1782 Acknowledged
+ 1785 Optimized Tomfoolery
+ 1791 Nontakan Nuntachit, Thailand
+ 1794 Rasit Eskicioglu - Canada
+ 1795 Simon Elliston Ball
+ 1796 pfh
+ 1798 John W. C. McNabb
+ 1799 Frank Sanborn
+ 1803 Morgan Hough
+ 1804 Sorcha Bowler
+ 1805 http://www.WayneKeenan.info
+ 1806 HBEE, hbee.eu
+ 1807 Deadlight
+ 1809 www.danenet.org
+ 1811 Sergey Nebolsin
+ 1813 Threv
+ 1817 dynsne
+ 1818 David Wright
+ 1819 John Warren
+ 1821 I wanted Erlang! (╯°□°)╯︵ ┻━┻
+ 1825 Howard R Hansen
+ 1828 Kevin Schumacher
+ 1833 Matthias Erll, Sweden
+ 1836 Matt Graham
+ 1837 thedawn
+ 1838 Ruby Feinstein
+ 1839 Gustavo Muñoz (timbergus)
+ 1840 Ian Paczek
+ 1841 Köteles Károly, Hungary
+ 1843 Tobias Sette Ferreira
+ 1846 x4FF3 <3 microPython
+ 1847 Enrico Faulhaber (Germany)
+ 1850 jolan00
+ 1854 Red Harbinger Inc
+ 1855 Noman
+ 1858 @DerLinkshaender
+ 1863 Jon Woodcock
+ 1864 Elmo, hakkerikartano.fi
+ 1865 Imaginals
+ 1866 Sam Hathaway and Rachel Stevens
+ 1874 Remo Sanges, SZN, Italy
+ 1875 Devraj Mukherjee
+ 1876 an Embedded fan
+ 1877 Peter Huisers
+ 1878 Kin-Wai Lee (Malaysia)
+ 1879 Samuel Hawksby-Robinson
+ 1881 R. Stock
+ 1886 Randy of Capistrano street backed Damien's MicroPython!
+ 1887 Rogério Bulha Siqueira - www.esd-talk.com - Brazil
+ 1889 NickE is happy to support such a worthy project!
+ 1892 John Boudreaux
+ 1894 Riverfreeloader
+ 1895 Jose Marcelino http://metavurt.net
+ 1896 T Britto-Borges
+ 1899 DannyWhitsonUSA
+ 1904 José Iván Ferrer Ruiz.
+ 1905 Tom Loredo
+ 1906 Gregory Perry USA
+ 1908 josephoberholtzer.com
+ 1910 Michael Klos, USA
+ 1912 Adam Mildenberger
+ 1913 R Anderson
+ 1914 Nikesh, USA
+ 1915 Bogdan Chivoiu, Romania
+ 1916 Scott C. Lemon, USA
+ 1918 Konstantin Ufimtsev (@KestL)
+ 1919 Benny Khoo
+ 1922 Nicci Tofts
+ 1925 Joshua Coxwell
+ 1926 Franklin Hamilton
+ 1928 Peter Korcz
+ 1929 Leroy Douglas
+ 1930 A ナルと fan from Nigeria who likes smileys, here's one for good measure :)
+ 1931 Kimmo Lahtinen, Finland
+ 1932 http://staybles.co.uk
+ 1937 The Olivetti's: Emanuele Laura Nausicaa Sibilla Ettore
+ 1940 Pascal Hirsch
+ 1942 cbernander, Sweden
+ 1944 Enrico M.
+ 1947 Dinis Cruz
+ 1949 Jonathan Greig, http://embroidermodder.github.io
+ 1950 Andy Bower
+ 1952 Gerard Hickey
+ 1953 Fabrice BARRAL was here ...
+ 1955 Pieter Röhling
+ 1957 uomorando, Italy
+ 1959 Acacio Cruz
+
+The MicroPython project raised further funds through a second
+Kickstarter campaign that was primarily targeted at porting the
+code to the ESP8266 WiFi chip. The campaign ended on 2nd March
+2016 and gained the support of 1384 fantastic backers who believed
+in the project and the principles of Open Source code. Those
+backers who asked to be named are listed below, with an asterisk
+indicating that they also supported the first campaign.
+
+* 1 Gabriel, Seattle
+* 2 @robberwick
+* 6 Dave Hylands
+ 7 Les, UK
+ 8 Ryanteck LTD., UK
+ 10 karlsruhe, HU
+* 11 Turbinenreiter
+ 13 Ben Nuttall, UK
+* 14 Bryan Morrissey, MA, USA
+* 15 Jogy, Qatar
+* 16 BOB63,IT
+ 19 ReaBoyd
+* 20 Andrew, MK
+* 21 chrisq, NO
+ 22 Pascal RENOU, France
+ 23 Javier G, ES
+ 25 Forrest, US
+ 26 Filip Korling, Sweden
+ 27 roberthh - Rhineland
+* 28 Herbert Graef, Stuttgart, thanking the MicroPython Team for this great project
+* 29 johnsonfamily38, UK
+ 30 CympleCy
+ 31 OJ, PK
+ 32 Daniel, SVK
+ 33 Shabaz Mohammad
+* 35 Kenneth Henderick, BE
+* 37 Daniel Mouritzen, DK
+ 39 Torntrousers, UK
+* 44 Scanner
+ 45 Radomir Dopieralski
+ 46 Nick, UK
+* 47 Jon Hylands, Canada
+* 48 Ben Barwise Clacktronics
+ 50 Rob Kent, UK
+ 52 Carlos Pereira Atencio
+ 54 Andy, UK
+* 55 WMinarik, Canada
+ 57 Hauffe, Germany
+ 58 HyperTaz, IT
+* 61 Michael Kovacs, AT
+ 62 Erick Navarro, PE
+ 69 Karan,US
+* 71 Nick B, UK
+* 72 Anthony Lister, NZ
+* 73 Bryan Lyon
+ 76 Miguel Angel Ajo, ES
+* 78 Sebastian, Regensburg (GER)
+* 80 iv3unm
+ 81 Thierry BÉNET, FR
+ 84 Jannis, Germany
+ 86 Nathan Jeffrey
+ 88 Cory Benfield, UK
+ 90 Carlo, IT
+* 91 Wojciech Bederski (@wuub)
+ 92 Steve Holden, UK
+ 93 Tristan Roddis, UK
+ 94 Balder, Sweden
+* 95 Rhys, UK
+ 96 Rowan, UK
+* 97 Gary Martin, Edinburgh
+* 100 Mikael Eiman
+* 101 torwag
+* 102 Craig Barnes, UK
+ 103 Andrea Grandi, UK
+ 105 Piers, UK
+* 109 Wayne Keenan
+ 110 makuk66
+ 111 Hamine,DZ
+ 112 Arahavica,JP
+* 113 Bill Eubanks, USA
+ 114 Jonathan, UK
+ 115 ghickman
+* 117 Christian Lange, Germany
+ 119 Jonty Wareing
+ 121 TheHetman
+ 123 Víctor R. Ruiz, Spain
+* 124 Laurynas Paukste, Norway
+* 125 Taki
+ 126 André Milette, Canada
+* 127 Ron Cromberge,NL
+ 128 IJ, Thailand
+* 130 IGOR VIZIR
+ 132 Bill Saturno
+ 134 scibi
+ 136 Timbo, AU
+ 137 Raphael Vogel, DE
+* 139 jasonkirk, US
+ 141 Linköping, Sweden
+* 142 Dugres
+ 144 DarioS, UK
+ 146 NelisW
+* 148 _Mark_
+* 149 Folke Berglund, Sweden
+ 150 Deniz Dag/Belgium
+ 152 Jacques Thomas
+ 153 Dag Henrik, Norway
+* 154 Alexander Steppke
+ 158 stavros.io
+* 161 Seong-Woo Kim, KR
+ 162 Aaron H, Seattle
+ 164 Iwan, CZ
+ 165 Jenning, DE
+ 167 Oliver Z, Germany
+* 168 Chris Mason, Australia
+ 169 Fabio P. Italy
+ 171 Jonathan, Ireland
+ 173 Philipp B., DE
+ 174 Mancho, IT
+ 175 Mikkel Sørensen, DK
+ 176 Raphael Lullis
+* 177 Tim, China
+ 179 JasperS, NL
+ 180 Scott, AU
+ 181 Roland Kay, UK
+ 182 Adam Baxter
+ 184 Hugo Herter
+ 185 Simon AM, Malta
+ 186 Leif Denby
+ 190 Maxious
+* 192 Guido, GER
+* 193 Pierre Rousseau, Canada
+ 195 Pete Hinch
+* 198 KoalaBear,USA. TRUMPED 2016!
+* 200 Pimoroni, UK
+ 201 jpwsutton, UK
+ 203 Felix, Sweden
+ 204 Dmitri Don, Tallinn Estonia
+ 205 PeteDemiSwede, UK
+* 207 Serge GUILLAUME
+ 208 Gurtubay, ES
+ 209 Geir-Olav, NO
+ 210 RayDeo, Germany
+ 215 DIYAbility
+ 216 Josef Dunbar, USA
+* 217 Enrico, BE/IT
+ 219 Damian Moore, UK
+ 220 Wayne and Layne, LLC
+ 221 The Old Crow, USA
+ 224 Hackscribble, UK
+* 225 Alex March, UK
+ 226 @rdslw
+ 227 Mike, Canada
+* 228 Adrian Smith
+ 229 Dinu Gherman, Germany
+ 230 Tinamous.com
+* 231 Nikesh, US
+* 232 chrisallick.com
+ 234 Daniel Von Fange
+* 235 Michal Muhlpachr, CZ
+* 236 Petr Viktorin
+ 237 Ryan Aldredge
+ 238 Patrik Wallström, SE
+* 239 MobiusNexus
+ 240 Stray, US
+* 241 BOFG, no
+ 244 Issac Kelly
+* 247 David Prime
+ 249 James Marsh, UK
+* 250 BezouwenR
+ 252 Avinash Magdum, India
+ 253 Greg Abbas, Menlo Park CA
+ 254 Jorge, ES
+ 256 JohanP, swe
+* 258 Ben Doan
+ 259 Jan van Haarst, NL
+* 263 JoshT, Los Angeles
+ 264 cstuder, Switzerland
+ 266 Jon Armani
+* 270 Liam Welsh
+ 271 Jason Peacock
+ 272 Alejandro Lopez
+ 275 Dan O'Donovan, UK
+ 276 N1TWC
+ 277 Roland Tanglao, Vancouver
+ 278 Twpsyn
+ 280 Robert, ME-US
+* 282 Thomas, UK
+ 283 Jeff Schroeder, USA
+ 284 Paulus Schoutsen
+* 287 Neon22, NZ
+ 290 kbmeister
+ 291 Gary Hahn
+ 292 Dave Matsumoto, USA
+ 296 Sam Lee, SG
+ 304 Poul Borg, Denmark
+ 307 MightyPork
+ 308 Dale
+* 312 Anton Kraft, Germany
+ 315 Kism3t, UK
+ 317 NateM
+* 318 N&T, Calvijn Meerpaal, NL
+ 322 Andreas Monitzer
+ 323 Rikard, SE
+ 328 Olaf, DE
+* 329 John Boudreaux
+ 330 DOCE, Germany
+ 331 feilipu
+ 332 Stefan Schwetschke
+ 333 Wayneji, NZ
+ 337 Alain de Lamirande, Canada
+ 338 Hori, TW
+ 340 Azmodie, UK
+ 341 Lygon, UK
+* 342 JRM in STL, USA
+ 344 R Colistete-Jr., BR
+* 345 ChristianG, DE
+ 347 Nis Sarup, DK.
+ 350 Nickedynick
+ 351 Dazza, Oz
+ 352 lispmeister, NL
+ 355 Tomas Lubkowitz, SE
+ 357 Mark, UK
+* 358 Team ME
+ 363 Papahabla
+ 364 Greg Chevalley
+ 365 Maic Striepe, Germany
+ 369 Ian McMahon
+ 371 A. DARGA, Fr
+ 372 Ernesto Maranesi, BR
+ 373 Steve Lyon
+ 374 James Cloos
+ 375 Bas Zeppenfeldt, The Netherlands
+ 378 Pycom Ltd
+ 380 Wade Christensen, USA
+ 382 Justin Wing Chung Hui, UK
+ 383 C Paulson
+ 384 Ian Tickle
+ 386 Danny, Seattle
+ 388 Erik Moe, Chicago, IL
+* 389 Eric B. Wertz, USA
+ 390 Michael. CH
+ 391 Christopher Baughman
+ 392 James Churchill
+ 393 Rob, DC
+ 395 Whee Min, Singapore
+* 396 Jason Doege, TX
+ 401 MrFish
+ 403 Thejesh GN
+ 404 Markus, Sweden
+ 405 AMR, Spain
+ 407 Svet, ES
+* 408 Thoralt, Germany
+ 409 Emil, Sweden
+ 410 David Moloney, ireland
+ 411 Marco S, DE
+ 415 Peter W., Austria
+ 417 emendo A/S
+* 419 Kalestis, Switzerland
+ 421 Ondra, CZ
+ 422 Elheffe
+ 423 thinkl33t, UK
+ 424 TonyF
+ 425 Herr Robert Linder, PA, USA
+* 426 Anders Astrom S(E|G)
+* 428 Jussi Ylanen, CT, USA
+ 431 Neil H., USA
+ 434 Rod Perez, MX
+ 435 Carol, US
+ 436 Gina Haeussge, DE
+ 438 Weilinger, GER
+* 439 Ron Ward, Australia
+ 441 Rex, UT, USA
+* 444 Slush, CZ
+ 445 Bruce, Florida
+* 448 Patrick Di Justo
+ 449 ScubaBearLA
+ 450 Mike Causer, Sydney AU
+ 451 Joel Fries, USA
+* 452 Andrew Bernstein, US
+ 454 EAS, Seattle, WA, USA
+* 456 Christopher J. Morrone, USA
+* 457 Anthony Gilley, Sweden
+ 458 Andre Breiler, DE
+* 460 Fuffkin, UK
+* 461 adent, CZ
+ 462 Samuel Pickard
+ 463 Mirko, Germany
+* 464 Ramin/US
+ 465 Mike, Grenoble
+ 466 Rolf, DE
+* 467 Dave Haynes
+* 469 Mac Ha, Vietnam
+* 470 Enno, DE
+* 473 Smudo, DE
+* 474 Duncan, Scotland
+ 475 Chris, UK
+ 476 Peter Groen, NL
+ 478 Gertjan Geerling, Nijmegen
+* 479 Benjamin Eberle
+* 480 Mechanical Men Sweden
+* 482 Rémi de Chazelles, FR
+ 483 mager, Bremen
+ 484 jurekh, NL
+* 485 Craig Burkhead
+ 487 JohanHartman, SouthAfrica
+* 489 Viktor, NL
+ 491 Jean-Denis Carre
+ 492 Jesse, Canada
+ 493 Alex C. MacDonald, USA
+* 494 GustavoV, MX
+ 495 Sebastian, Berlin
+ 497 Bernard, Feluy
+* 500 Ron H, USA
+ 501 Gregg "Cabe" Bond, UK
+ 502 Colin, NI
+ 504 Robin, USA
+* 507 pkropf
+* 510 6LhasaCo Canada
+ 511 Tom Sepe, USA
+ 513 Andrew McKenna
+ 515 tom46037
+ 516 G2, USA
+* 517 Pauline Middelink, NL
+* 518 Brush Technology, Ltd
+ 520 Pierre Meyitang, USA
+ 521 Stephanie Maks, Canada
+ 526 John McClain
+* 527 Sigadore, US
+ 528 Richard Hudspeth, US
+ 530 Martin, Austria
+ 531 Stephen Eaton, Australia
+* 533 RJCE, UK
+ 535 Teiste, Finland
+ 536 Pio, UK
+ 537 DirtyHarry, DE
+* 540 Dom G. UK
+* 541 Nial, UK
+ 543 Andreas, AUT
+ 545 WisdomWolf
+* 549 MrMx,ES
+ 552 Daniel Soto, Landscape.
+ 554 Claus Fischer, DK
+ 557 Aleksi Määttä
+ 560 Justin Wilcott, USA
+ 562 LoneTone, UK
+ 567 Cameron, US
+ 568 Dirck, Germany
+ 569 Michael Keirnan
+ 571 Harry, CN
+* 572 Ward Wouts
+ 573 Dan Anaya, USA
+ 574 Ben Bennett
+ 575 nirvana2165, US
+ 576 PDG, BZH
+* 581 Visit, Thailand
+ 582 John Carr, UK
+* 583 Klankschap
+ 587 jacky,FR
+ 588 JD Marsters
+ 591 Ryan Jarvis, US
+ 595 Claudio Hediger, CH
+* 597 Bambam, Sweden
+ 598 Timothé, FR
+* 599 Luís Manuel, Portugal
+ 601 Eric, DE
+ 602 Olaf, Cambridge, UK
+* 603 Tim, Dubai
+ 604 Tyndell, US
+ 606 Ciellt AB, SE
+ 607 Ömer Boratav
+ 609 Guy Molinari, US
+ 614 Freek Dijkstra
+ 615 Carlos Camargo CO
+ 616 Michael Nemecky, Norway
+ 618 Ovidiu G.
+ 619 arobg, USA
+* 621 Geoff Shilling, US
+ 623 EliotB, NZ
+ 624 slos UK
+ 625 Montreal, CA
+* 626 Peter Korcz
+ 627 Kodi
+ 628 Jim, Valdosta, USA
+ 629 Sander Boele, NL
+ 630 Max Lupo
+ 631 Daniel.B, Newcastle Australia
+ 632 Andrés Suárez García, Vigo (Spain)
+ 633 Rens, NL
+ 634 Max Petrich, DE
+ 635 Fabian Affolter, CH
+ 636 Cadair
+* 637 Mike Karliner
+ 638 Daniel T, UK
+ 639 Mark Campbell, UK
+ 640 James S, Australia
+ 641 PBTX!
+* 642 amaza,SP
+ 644 se4mus
+* 645 Alexander Steffen
+* 647 Jim Richards Maine, USA
+ 649 Doug D, US
+ 650 Keaton Walker
+* 651 Scott Winder, USA
+ 653 Jeff Fischer, USA
+ 654 Andrej Mosat
+ 655 Mohd Faizal Mansor, Malaysia
+ 657 Mike "Cutter" Shievitz, US
+* 658 Daniel Andersson, SE
+ 659 Alexander, NL
+ 660 François, CH
+* 661 AndrewS, UK
+ 662 Denisae, PT
+ 663 KC8KZN
+ 664 Angelo, Wales
+ 665 BlueberryE, Germany
+ 667 fvlmurat
+ 668 Adam Wilson
+ 675 Ulrich Norbisrath (http://ulno.net)
+ 676 Daniel, Portland OR
+* 677 Andreas Lindquist, SE
+ 680 Jason, NL
+ 682 lapawa, GER
+ 683 John Batty, UK
+ 685 Addy, Netherlands
+ 686 Marc, CA
+ 690 APapantonatos
+ 691 gmorell, US
+* 692 Jamie Mackenzie, Adelaide, SA
+* 693 Dave Dean, US
+ 697 woojay, US
+ 698 Webabot, NY
+* 699 Jason Fehr, Canada
+ 700 Hadi (AU)
+* 701 Abraham Arce
+* 703 Must Be Art
+ 712 Thanks for the great work!/datax-holding/Stuttgart
+* 714 Thomas Pr., BE
+ 715 Black Country Atelier BCA
+ 718 Don W, Arlington VA
+ 721 Xavier C. (EU)
+ 722 Chad P. Lung, U.S.A
+ 726 Alexander Lash (@lexlash)
+ 727 Sven, MX
+ 728 Terence, PL
+* 730 Mauro De Giorgi, USA
+ 735 Jay Ward, Canada
+ 736 Fabian Topfstedt, AT
+ 739 sjoerdDOTcom
+ 740 David, Australia
+ 743 Michael Niewiera, Germany
+ 745 cbenhagen
+ 746 berserck, CH
+ 748 Lars Hansson, Sweden
+ 750 Landrash
+ 751 Richard B., CT USA
+ 752 Neil Chandler, UK
+* 753 John Griessen US
+* 755 Caminiti, Mexico
+ 757 Mikael Trieb, Sweden
+ 760 S1GM9, MX
+ 761 Dave C, US
+* 763 Su Zhou, China
+ 765 Caitlyn - USA
+ 769 Will, NZ
+ 770 CJB,UK
+ 771 Victor Claessen, NL
+ 772 Antal, CH
+ 773 Tokyo, Japan
+* 774 Join Business & Technology AB, Sweden
+ 777 Overspeed Innovation
+* 778 Bruce, Chanute KS
+ 779 TOPALIS, RO
+ 780 klaas2
+ 781 Matthias Schmitz, Berlin
+ 783 Jan Studený wishes "Python everywhere"
+ 788 Ian, USA
+ 789 Mark K, UK
+ 791 DerFlob, Germany
+ 792 Staffan Johansson, Sweden
+ 793 Stefan W., DE
+ 795 Mark S. Harris, Small Dog Electronics
+ 796 Kittikun, TH
+* 798 aerialist, Japan
+ 799 Sweta
+* 800 Mark Shuttleworth
+ 802 Kim Thostrup
+ 803 Andy Fundinger
+ 810 Matt Vallevand, Detroit MI
+ 813 Jim McDonald
+ 816 Rob Dobson
+ 817 Rafał Zieliński, PL
+* 818 Shaun Walker, AUS
+ 819 Timothy R, Belgium
+ 820 clem
+ 825 JuanB, ES
+ 826 Randall Gaz, Colorado USA
+ 827 Dick van Ginkel, The Netherlands
+ 829 Jan-Pieter Van Impe
+ 831 David Kirkpatrick, AU
+ 832 Ravi Teja, India
+ 833 AkosLukacs, HU
+ 834 Dave Desson, CAN
+ 837 LWQ.CZ, CZ
+ 838 Robert W., Issaquah, WA
+ 839 Daniel Hrynczenko
+ 840 Martin Filtenborg, DK
+ 841 InnHuchen, Ger
+ 845 Raju Pillai,India
+ 847 cfus/DE
+* 851 Juli H.
+ 853 David Monterroso Cabello , SP
+ 857 24x8, LLC, US
+ 860 Sebastian, DE
+ 861 pajusmar
+ 864 Ronnie, UK
+* 867 Travis Travelstead, USA
+* 870 Woodat, US/UK
+ 872 Gary Bake, UK
+ 873 Ernesto Martinez
+* 874 Scottt, USA
+ 876 Ronnie Kizzle, LA
+ 880 Harish, Singapore
+ 882 Wacht, Pittsburgh
+ 883 PatrickF, US
+ 886 Paolo, IT
+ 888 Defragster
+ 889 Rachel Rayns, UK
+* 890 Peak Data LLC
+ 891 Mindwarp, AU
+ 892 Vincent Smedley, UK
+* 894 Bailey & Brayden
+ 898 Jacek Artymiak, UK
+ 900 John Hudson, USA
+* 901 ReneS, NL
+* 902 B Stevens
+ 903 Cptnslick, US
+ 904 janlj@me.com
+ 905 Fabricio Biazzotto
+ 906 Lenz Hirsch
+ 907 SerSher, RU
+ 908 Florian, DE
+ 909 Mathias Svendsen, DK
+* 910 Jeremiah Dey-Oh
+ 911 Allan Joseph Medwick
+ 913 Matt, Australia
+ 914 Christian Pedersen
+* 915 SPIN
+ 916 Denis M., Russia
+ 917 Ahmed Alboori, Saudi Arabia
+ 918 Luciano, Italy
+ 919 Ragdehl
+* 921 Artur, HU
+ 922 Greg, NC - USA
+ 924 Gurzixo
+* 927 Gregg, Oregon
+ 928 cwschroeder, BY
+ 929 W. Bush - NY, USA.
+ 932 ddparker
+ 933 Enkion
+* 934 Eric G. Barron
+ 936 thomasDOTwtf
+ 940 mifous, cucurbitae.eu
+ 942 VFL68, FR
+ 943 Casey, Hong Kong
+* 945 Kean Electronics
+ 946 Nima, UK
+ 947 Klosinski, USA
+ 948 PieWiE, NL
+* 949 Rui Carmo, PT
+* 950 basbrun.com
+ 951 Aashu, UK
+* 952 vk2nq - Brian
+ 954 gojimmypi
+ 955 Jack, USA
+* 957 @SteveBattle
+* 958 Beshr, Sweden
+ 962 PeterR, UK
+ 964 Russell Calbert
+ 965 LAurent_B, Fr
+ 967 Qazi, USA
+ 971 Jonas, FR
+ 973 PK Shiu
+* 974 sea_kev
+ 976 Radhika, USA
+ 977 Chris Gibson, US
+* 978 Mike, AU
+* 979 Geeky Pete
+ 981 Timmy the wonderdog
+ 983 An Ostler it IT
+ 984 Frank Ray Robles
+ 985 Kurtsik
+ 987 Johan, SE
+ 988 NJBerland, Norway
+ 992 Leon Noel - @leonnoel
+ 994 Kjell, SE
+ 995 boriskourt
+ 997 Bartek B., CANADA
+ 999 Thomas Wiradikusuma, Indonesia
+ 1000 Trey, NOLA
+ 1002 Jori, FI
+ 1005 nmmarkin
+ 1006 Mattias Fornander
+ 1007 Panayot Daskalov, Bulgaria
+*1009 AndyP, UK
+ 1011 TSD
+ 1013 Chris, Berlin
+ 1017 Gareth Edwards, UK
+ 1018 Trixam,DE
+ 1019 César from Makespace Madrid, Spain
+ 1020 Prajwal, Australia
+*1024 Fred Dart - FTDI
+ 1025 bsx
+*1026 Regis, FR
+ 1027 Adrian Hill
+ 1029 Alice, UK
+ 1030 Erkan Shakir, BG
+ 1031 Alexander, EE
+ 1033 Patric, Luxembourg
+ 1034 For my beloved mother, Colleen Clancy.
+ 1035 NigelB
+ 1037 François, Aus/Fr
+*1039 Thanura Siribaddana, Australia
+ 1041 Harald, USA
+ 1042 Jeremy Utting, NZ
+ 1043 bejuryu, KR
+*1044 Daniel Wood, UK
+ 1046 C. J. Blocker
+*1047 Rodrigo Benenson, Germany
+ 1048 Håvard Gulldahl
+ 1049 SeB, Belgium
+ 1054 Ryan Miller, Austin TX
+ 1055 Gianluca Cancelmi
+ 1057 Francesco, IT
+ 1058 RockTractor!
+ 1060 Bill G., Atlanta GA USA
+ 1061 joenotjoe
+ 1064 ATrivedi, USA
+ 1067 Jim Chandler, UK
+ 1068 Aria Sabeti
+ 1069 Noah Rosamilia, USA
+ 1070 GAKgDavid, CA
+ 1072 Markus, Austria
+*1073 Tarwin, MUC
+*1077 Balazs Kinszler, HU
+*1080 pfh
+*1082 Ovidiu Hossu, SG
+*1083 mmhanif, NJ
+*1084 Wincent Balin, DE
+*1086 Anatoly Verkhovsky
+*1087 Greg, Plano
+*1089 Angelo Compagnucci
+ 1090 Ryan Shaw (ryannathans), AU
+ 1092 Dries007, BE
+*1093 Dave Snowdon, UK
+*1094 halfpress
+*1096 DeuxVis, FR
+*1097 Your Creative Solutions
+ 1099 Emanuele Goldoni, IT
+*1100 Tendayi Mawushe
+ 1101 Rob, Tikitere
+*1102 SolidStateSoul
+*1103 Michael, GER
+*1106 Paul, San Francisco
+*1107 Oddvar Lovaas
+*1108 Doc Savage, Man of Bronze
+ 1109 Stijn Debrouwere
+ 1111 Ark Nieckarz, USA
+*1112 ECS87.com, USA
+*1114 Gary P. Wolfe, USA
+ 1117 Tom Hodson
+*1118 @arikb (twitter)
+ 1123 Piotr Gryko UK
+*1125 Cantalaweb, Spain
+ 1126 Edward of Clovis
+ 1127 Jim G
+*1128 billbr, Loveland, CO, USA
+ 1129 dalanmiller
+*1130 StephenH, UK
+*1132 Thomas Sarlandie - @sarfata
+ 1133 Doug Rohm, US
+*1134 Eric Floehr, Ohio, USA
+*1135 Sven Haiges
+ 1136 relix42
+*1137 Ralf Nyren
+*1138 nickgb
+ 1139 zwack, DE
+ 1140 Michal B., PL
+ 1141 Matt, Australia
+ 1143 slv, Mi2
+ 1144 Pawel, CH
+*1145 James Saffery
+*1147 nekomatic
+*1149 @nt1, Earth
+*1150 Alister Galpin, NZ
+ 1151 Jayemel, UK
+ 1152 Koalabs
+ 1153 James Myatt, UK
+*1154 DanS, Norway
+ 1155 Sandeep, US
+*1156 Anil Kavipurapu
+*1158 Frederik Werner, DE
+ 1160 Erik J, Canada
+ 1164 bluezebra, Ireland
+ 1168 Birk, DE
+ 1169 Gabi, FR
+*1173 mliberty, USA
+ 1174 Jamie Smith, Scotland
+ 1175 Sebastian, Germany
+*1176 John Cooper, UK
+ 1177 Moritz, DE
+ 1178 Kevin, DE
+*1179 Ming Leung, Canada
+ 1180 Laird Popkin
+ 1181 tasmaniac, GA
+*1183 RichardW, UK
+*1187 Thomas Quinlan, London, UK
+ 1188 LGnap, BE
+*1189 bloater, Edinburgh UK
+ 1192 pakt, SE
+ 1194 Sandsmark, NO
+*1195 Gert Menke
+ 1197 Emsi88, SK
+ 1199 GTtronics HK Ltd.
+ 1200 Jo, Bergen
+*1202 MarkS, Australia
+ 1203 Igor, HR
+ 1204 Lord Nightmare
+ 1205 Great Uncle Bulgaria, UK
+*1206 salomonderossi
+ 1208 Master_Ipse, DE
+ 1209 Luis G.F, ES
+ 1211 Harald, FO
+*1212 Kimmo, Finland
+*1213 P. Perreijn, Netherlands
+ 1214 jcea, Spain
+ 1215 simon holmes à court
+ 1217 Bill M, Newcastle
+*1218 snowball
+*1221 Georges, CDN
+ 1222 JPLa
+ 1225 Erik Gullberg, Sweden
+ 1226 Matthias Fuchs, IN, Germany
+ 1229 Majed, CA
+ 1230 Michiel, Reeuwijk
+ 1231 Clive, Essex UK
+ 1232 Jan Kalina, CZ
+ 1234 MBBest, Australia
+*1235 Reinoud de Lange, NL
+ 1237 Jeffrey Park, South Korea
+ 1238 David Olson
+ 1239 Nathan Battan
+ 1240 Marcus, TW
+ 1241 randyrrt, USA
+ 1242 Holger, Germany
+ 1243 Dmitri Chapkine, FRANCE
+ 1244 Ceyhun Kapucu, TR
+ 1245 Hong Kong
+*1246 gPozo, US
+ 1247 Peter M, Sweden
+*1249 Duncan, Cambridge
+*1251 Schaeferling, DE
+ 1252 Christian Prior, DE
+*1256 ovig
+ 1257 Kerry Channing, UK
+ 1258 Exception42, GER
+*1259 nchalikias
+ 1261 Kittie, US
+ 1263 Alex, Norway
+ 1264 wats0n, TW
+*1265 Henner
+*1266 Mike M, AZ, USA
+ 1268 Bobby Ly, USA
+*1269 Espen STO, Norway
+ 1270 arduware.cc
+ 1274 Christopher Flynn, NH USA
+*1275 Bruce Boyes, USA
+ 1276 DCH
+ 1278 McGinkel, Netherlands
+ 1279 Dieter, Wien
+ 1280 R. Tummers, NL
+ 1283 Pranav Maddula, USA
+ 1286 Dusan, SLovakia
+ 1290 Stephen Youndt
+*1291 Lertsenem, FR
+ 1292 NuclearTide, London
+ 1293 Ben Gift, USA
+ 1294 rmg
+ 1295 jmaybe, USA
+ 1296 Allan G, Georgia
+ 1297 Duncan Brassington, UK
+ 1300 Hans, NL
+ 1301 Valerio "valdez" Paolini, IT
+ 1303 Neotreat, DE
+ 1306 tomtoump
+ 1307 Edward B Cox, England
+ 1310 Oliver Steele
+ 1311 merps, AUS
+ 1313 n8henrie, USA
+*1314 YGA-KSD n7/ULB, FR-BE
+ 1317 Adrian, Romania
+*1318 Luca "Loop", ITA
+*1319 Michael Twomey, Ireland
+ 1321 Trey Aughenbaugh
+ 1322 Marcel Hecko, SK
+ 1323 Hugo Neira, CL
+ 1326 JH, US
+*1330 Luthander, SE
+ 1331 Rickard Dahlstrand, Sweden
+ 1333 Olivier M., France
+ 1334 DWVL, UK
+ 1335 MRZANE, Sweden
+ 1336 Benedikt, DE
+*1338 Tiegeng, US
+*1339 arthoo Eindhoven Nederland
+ 1340 Magnus Gustavsson, Sweden
+ 1341 Jan Bednařík
+ 1344 Mike McGary: US
+ 1346 mp3tobi
+*1350 Cyberhippy
+ 1351 Sandro, PT
+ 1355 Kwabena W. Agyeman
+ 1357 Ryan Young
+*1358 Chiang Mai, Thailand
+ 1359 AKLitman, USA
+ 1360 JASK Enterprises, Ltd-John
+*1361 Tom Gidden, UK
+ 1362 AdamT, USA
+ 1363 Jose de la Campa, BOL
+ 1365 Steve Laguna, U.S.A
+*1368 Walrusklasse, NL
+ 1370 Timofei Korostelev, Belarus
+ 1374 Janos,HU
+*1375 Paul Cunnane
+ 1377 IanE, UK
+ 1378 Hans, NL
+ 1379 Jose Angel Jimenez Vadillo, Spain
+*1380 PaulT, Lancs
+ 1383 Lutz; DE
+ 1385 AnRkey
+ 1387 Fredrik, FIN
+ 1388 Matt W (funkyHat)
+ 1389 Zeev Rotshtein, Israel
+ 1391 joostd, NL
+ 1392 Lukasz Blaszczyk, USA
+*1397 Wei-Ning Huang, TW
+ 1398 myu
+*1399 Thorsten, Germany
+ 1401 sm0ihr
+ 1403 Xiaotian, Seattle US
+*1406 -gt-, Czech Republic
+ 1407 Mike Y. Diallo, US
+ 1409 ubii, US
diff --git a/components/language/micropython/CODECONVENTIONS.md b/components/language/micropython/CODECONVENTIONS.md
new file mode 100644
index 00000000..78fb912a
--- /dev/null
+++ b/components/language/micropython/CODECONVENTIONS.md
@@ -0,0 +1,235 @@
+Git commit conventions
+======================
+
+Each commit message should start with a directory or full file path
+prefix, so it was clear which part of codebase a commit affects. If
+a change affects one file, it's better to use path to a file. If it
+affects few files in a subdirectory, using subdirectory as a prefix
+is ok. For longish paths, it's acceptable to drop intermediate
+components, which still should provide good context of a change.
+It's also ok to drop file extensions.
+
+Besides prefix, first line of a commit message should describe a
+change clearly and to the point, and be a grammatical sentence with
+final full stop. First line should fit within 72 characters. Examples
+of good first line of commit messages:
+
+ py/objstr: Add splitlines() method.
+ py: Rename FOO to BAR.
+ docs/machine: Fix typo in reset() description.
+ ports: Switch to use lib/foo instead of duplicated code.
+
+After the first line add an empty line and in the following lines describe
+the change in a detail, if needed, with lines fitting within 75 characters
+(with an exception for long items like URLs which cannot be broken). Any
+change beyond 5 lines would likely require such detailed description.
+
+To get good practical examples of good commits and their messages, browse
+the `git log` of the project.
+
+When committing you are encouraged to sign-off your commit by adding
+"Signed-off-by" lines and similar, eg using "git commit -s". If you don't
+explicitly sign-off in this way then the commit message, which includes your
+name and email address in the "Author" line, implies your sign-off. In either
+case, of explicit or implicit sign-off, you are certifying and signing off
+against the following:
+
+* That you wrote the change yourself, or took it from a project with
+ a compatible license (in the latter case the commit message, and possibly
+ source code should provide reference where the implementation was taken
+ from and give credit to the original author, as required by the license).
+* That you are allowed to release these changes to an open-source project
+ (for example, changes done during paid work for a third party may require
+ explicit approval from that third party).
+* That you (or your employer) agree to release the changes under
+ MicroPython's license, which is the MIT license. Note that you retain
+ copyright for your changes (for smaller changes, the commit message
+ conveys your copyright; if you make significant changes to a particular
+ source module, you're welcome to add your name to the file header).
+* Your contribution including commit message will be publicly and
+ indefinitely available for anyone to access, including redistribution
+ under the terms of the project's license.
+* Your signature for all of the above, which is the "Signed-off-by" line
+ or the "Author" line in the commit message, includes your full real name and
+ a valid and active email address by which you can be contacted in the
+ foreseeable future.
+
+Code auto-formatting
+====================
+
+Both C and Python code are auto-formatted using the `tools/codeformat.py`
+script. This uses [uncrustify](https://github.com/uncrustify/uncrustify) to
+format C code and [black](https://github.com/psf/black) to format Python code.
+After making changes, and before committing, run this tool to reformat your
+changes to the correct style. Without arguments this tool will reformat all
+source code (and may take some time to run). Otherwise pass as arguments to
+the tool the files that changed and it will only reformat those.
+
+Python code conventions
+=======================
+
+Python code follows [PEP 8](https://legacy.python.org/dev/peps/pep-0008/) and
+is auto-formatted using [black](https://github.com/psf/black) with a line-length
+of 99 characters.
+
+Naming conventions:
+- Module names are short and all lowercase; eg pyb, stm.
+- Class names are CamelCase, with abbreviations all uppercase; eg I2C, not
+ I2c.
+- Function and method names are all lowercase with words separated by
+ a single underscore as necessary to improve readability; eg mem_read.
+- Constants are all uppercase with words separated by a single underscore;
+ eg GPIO_IDR.
+
+C code conventions
+==================
+
+C code is auto-formatted using [uncrustify](https://github.com/uncrustify/uncrustify)
+and the corresponding configuration file `tools/uncrustify.cfg`, with a few
+minor fix-ups applied by `tools/codeformat.py`. When writing new C code please
+adhere to the existing style and use `tools/codeformat.py` to check any changes.
+The main conventions, and things not enforceable via the auto-formatter, are
+described below.
+
+White space:
+- Expand tabs to 4 spaces.
+- Don't leave trailing whitespace at the end of a line.
+- For control blocks (if, for, while), put 1 space between the
+ keyword and the opening parenthesis.
+- Put 1 space after a comma, and 1 space around operators.
+
+Braces:
+- Use braces for all blocks, even no-line and single-line pieces of
+ code.
+- Put opening braces on the end of the line it belongs to, not on
+ a new line.
+- For else-statements, put the else on the same line as the previous
+ closing brace.
+
+Header files:
+- Header files should be protected from multiple inclusion with #if
+ directives. See an existing header for naming convention.
+
+Names:
+- Use underscore_case, not camelCase for all names.
+- Use CAPS_WITH_UNDERSCORE for enums and macros.
+- When defining a type use underscore_case and put '_t' after it.
+
+Integer types: MicroPython runs on 16, 32, and 64 bit machines, so it's
+important to use the correctly-sized (and signed) integer types. The
+general guidelines are:
+- For most cases use mp_int_t for signed and mp_uint_t for unsigned
+ integer values. These are guaranteed to be machine-word sized and
+ therefore big enough to hold the value from a MicroPython small-int
+ object.
+- Use size_t for things that count bytes / sizes of objects.
+- You can use int/uint, but remember that they may be 16-bits wide.
+- If in doubt, use mp_int_t/mp_uint_t.
+
+Comments:
+- Be concise and only write comments for things that are not obvious.
+- Use `// ` prefix, NOT `/* ... */`. No extra fluff.
+
+Memory allocation:
+- Use m_new, m_renew, m_del (and friends) to allocate and free heap memory.
+ These macros are defined in py/misc.h.
+
+Examples
+--------
+
+Braces, spaces, names and comments:
+
+ #define TO_ADD (123)
+
+ // This function will always recurse indefinitely and is only used to show
+ // coding style
+ int foo_function(int x, int some_value) {
+ if (x < some_value) {
+ foo(some_value, x);
+ } else {
+ foo(x + TO_ADD, some_value - 1);
+ }
+
+ for (int my_counter = 0; my_counter < x; ++my_counter) {
+ }
+ }
+
+Type declarations:
+
+ typedef struct _my_struct_t {
+ int member;
+ void *data;
+ } my_struct_t;
+
+Documentation conventions
+=========================
+
+MicroPython generally follows CPython in documentation process and
+conventions. reStructuredText syntax is used for the documention.
+
+Specific conventions/suggestions:
+
+* Use `*` markup to refer to arguments of a function, e.g.:
+
+```
+.. method:: poll.unregister(obj)
+
+ Unregister *obj* from polling.
+```
+
+* Use following syntax for cross-references/cross-links:
+
+```
+:func:`foo` - function foo in current module
+:func:`module1.foo` - function foo in module "module1"
+ (similarly for other referent types)
+:class:`Foo` - class Foo
+:meth:`Class.method1` - method1 in Class
+:meth:`~Class.method1` - method1 in Class, but rendered just as "method1()",
+ not "Class.method1()"
+:meth:`title ` - reference method1, but render as "title" (use only
+ if really needed)
+:mod:`module1` - module module1
+
+`symbol` - generic xref syntax which can replace any of the above in case
+ the xref is unambiguous. If there's ambiguity, there will be a warning
+ during docs generation, which need to be fixed using one of the syntaxes
+ above
+```
+
+* Cross-referencing arbitrary locations
+~~~
+.. _xref_target:
+
+Normal non-indented text.
+
+This is :ref:`reference `.
+
+(If xref target is followed by section title, can be just
+:ref:`xref_target`).
+~~~
+
+* Linking to external URL:
+```
+`link text `_
+```
+
+* Referencing builtin singleton objects:
+```
+``None``, ``True``, ``False``
+```
+
+* Use following syntax to create common description for more than one element:
+~~~
+.. function:: foo(x)
+ bar(y)
+
+ Description common to foo() and bar().
+~~~
+
+
+More detailed guides and quickrefs:
+
+* http://www.sphinx-doc.org/en/stable/rest.html
+* http://www.sphinx-doc.org/en/stable/markup/inline.html
+* http://docutils.sourceforge.net/docs/user/rst/quickref.html
diff --git a/components/language/micropython/CODEOFCONDUCT.md b/components/language/micropython/CODEOFCONDUCT.md
new file mode 100644
index 00000000..07cf8771
--- /dev/null
+++ b/components/language/micropython/CODEOFCONDUCT.md
@@ -0,0 +1,53 @@
+MicroPython Code of Conduct
+===========================
+
+The MicroPython community is made up of members from around the globe with a
+diverse set of skills, personalities, and experiences. It is through these
+differences that our community experiences great successes and continued growth.
+When you're working with members of the community, this Code of Conduct will
+help steer your interactions and keep MicroPython a positive, successful, and
+growing community.
+
+Members of the MicroPython community are open, considerate, and respectful.
+Behaviours that reinforce these values contribute to a positive environment, and
+include: acknowledging time and effort, being respectful of differing viewpoints
+and experiences, gracefully accepting constructive criticism, and using
+welcoming and inclusive language.
+
+Every member of our community has the right to have their identity respected.
+The MicroPython community is dedicated to providing a positive experience for
+everyone, regardless of age, gender identity and expression, sexual orientation,
+disability, physical appearance, body size, ethnicity, nationality, race, or
+religion (or lack thereof), education, or socio-economic status.
+
+Unacceptable behaviour includes: harassment, trolling, deliberate intimidation,
+violent threats or language directed against another person; insults, put downs,
+or jokes that are based upon stereotypes, that are exclusionary, or that hold
+others up for ridicule; unwelcome sexual attention or advances; sustained
+disruption of community discussions; publishing others' private information
+without explicit permission; and other conduct that is inappropriate for a
+professional audience including people of many different backgrounds.
+
+This code of conduct covers all online and offline presence related to the
+MicroPython project, including GitHub and the forum. If a participant engages
+in behaviour that violates this code of conduct, the MicroPython team may take
+action as they deem appropriate, including warning the offender or expulsion
+from the community. Community members asked to stop any inappropriate behaviour
+are expected to comply immediately.
+
+Thank you for helping make this a welcoming, friendly community for everyone.
+
+If you believe that someone is violating the code of conduct, or have any other
+concerns, please contact a member of the MicroPython team by emailing
+contact@micropython.org.
+
+License
+-------
+
+This Code of Conduct is licensed under the Creative Commons
+Attribution-ShareAlike 3.0 Unported License.
+
+Attributions
+------------
+
+Based on the Python code of conduct found at https://www.python.org/psf/conduct/
diff --git a/components/language/micropython/CONTRIBUTING.md b/components/language/micropython/CONTRIBUTING.md
new file mode 100644
index 00000000..73004ac5
--- /dev/null
+++ b/components/language/micropython/CONTRIBUTING.md
@@ -0,0 +1,8 @@
+When reporting an issue and especially submitting a pull request, please
+make sure that you are acquainted with Contributor Guidelines:
+
+https://github.com/micropython/micropython/wiki/ContributorGuidelines
+
+as well as the Code Conventions, which includes details of how to commit:
+
+https://github.com/micropython/micropython/blob/master/CODECONVENTIONS.md
diff --git a/components/language/micropython/LICENSE b/components/language/micropython/LICENSE
new file mode 100644
index 00000000..2b9a64b8
--- /dev/null
+++ b/components/language/micropython/LICENSE
@@ -0,0 +1,85 @@
+The MIT License (MIT)
+
+Copyright (c) 2013-2022 Damien P. George
+
+Permission is hereby granted, free of charge, to any person obtaining a copy
+of this software and associated documentation files (the "Software"), to deal
+in the Software without restriction, including without limitation the rights
+to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+copies of the Software, and to permit persons to whom the Software is
+furnished to do so, subject to the following conditions:
+
+The above copyright notice and this permission notice shall be included in
+all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+THE SOFTWARE.
+
+--------------------------------------------------------------------------------
+
+Unless specified otherwise (see below), the above license and copyright applies
+to all files in this repository.
+
+Individual files may include additional copyright holders.
+
+The various ports of MicroPython may include third-party software that is
+licensed under different terms. These licenses are summarised in the tree
+below, please refer to these files and directories for further license and
+copyright information. Note that (L)GPL-licensed code listed below is only
+used during the build process and is not part of the compiled source code.
+
+/ (MIT)
+ /drivers
+ /cc3000 (BSD-3-clause)
+ /cc3100 (BSD-3-clause)
+ /wiznet5k (BSD-3-clause)
+ /lib
+ /asf4 (Apache-2.0)
+ /axtls (BSD-3-clause)
+ /config
+ /scripts
+ /config (GPL-2.0-or-later)
+ /Rules.mak (GPL-2.0)
+ /berkeley-db-1xx (BSD-4-clause)
+ /btstack (See btstack/LICENSE)
+ /cmsis (BSD-3-clause)
+ /crypto-algorithms (NONE)
+ /libhydrogen (ISC)
+ /littlefs (BSD-3-clause)
+ /lwip (BSD-3-clause)
+ /mynewt-nimble (Apache-2.0)
+ /nrfx (BSD-3-clause)
+ /nxp_driver (BSD-3-Clause)
+ /oofatfs (BSD-1-clause)
+ /pico-sdk (BSD-3-clause)
+ /re15 (BSD-3-clause)
+ /stm32lib (BSD-3-clause)
+ /tinytest (BSD-3-clause)
+ /tinyusb (MIT)
+ /uzlib (Zlib)
+ /logo (uses OFL-1.1)
+ /ports
+ /cc3200
+ /hal (BSD-3-clause)
+ /simplelink (BSD-3-clause)
+ /FreeRTOS (GPL-2.0 with FreeRTOS exception)
+ /stm32
+ /usbd*.c (MCD-ST Liberty SW License Agreement V2)
+ /stm32_it.* (MIT + BSD-3-clause)
+ /system_stm32*.c (MIT + BSD-3-clause)
+ /boards
+ /startup_stm32*.s (BSD-3-clause)
+ /*/stm32*.h (BSD-3-clause)
+ /usbdev (MCD-ST Liberty SW License Agreement V2)
+ /usbhost (MCD-ST Liberty SW License Agreement V2)
+ /teensy
+ /core (PJRC.COM)
+ /zephyr
+ /src (Apache-2.0)
+ /tools
+ /dfu.py (LGPL-3.0-only)
diff --git a/components/language/micropython/README.md b/components/language/micropython/README.md
new file mode 100644
index 00000000..920f10a5
--- /dev/null
+++ b/components/language/micropython/README.md
@@ -0,0 +1,188 @@
+[](https://github.com/micropython/micropython/actions?query=branch%3Amaster+event%3Apush) [](https://codecov.io/gh/micropython/micropython)
+
+The MicroPython project
+=======================
+
+
+
+
+This is the MicroPython project, which aims to put an implementation
+of Python 3.x on microcontrollers and small embedded systems.
+You can find the official website at [micropython.org](http://www.micropython.org).
+
+WARNING: this project is in beta stage and is subject to changes of the
+code-base, including project-wide name changes and API changes.
+
+MicroPython implements the entire Python 3.4 syntax (including exceptions,
+`with`, `yield from`, etc., and additionally `async`/`await` keywords from
+Python 3.5). The following core datatypes are provided: `str` (including
+basic Unicode support), `bytes`, `bytearray`, `tuple`, `list`, `dict`, `set`,
+`frozenset`, `array.array`, `collections.namedtuple`, classes and instances.
+Builtin modules include `sys`, `time`, and `struct`, etc. Select ports have
+support for `_thread` module (multithreading). Note that only a subset of
+Python 3 functionality is implemented for the data types and modules.
+
+MicroPython can execute scripts in textual source form or from precompiled
+bytecode, in both cases either from an on-device filesystem or "frozen" into
+the MicroPython executable.
+
+See the repository http://github.com/micropython/pyboard for the MicroPython
+board (PyBoard), the officially supported reference electronic circuit board.
+
+Major components in this repository:
+- py/ -- the core Python implementation, including compiler, runtime, and
+ core library.
+- mpy-cross/ -- the MicroPython cross-compiler which is used to turn scripts
+ into precompiled bytecode.
+- ports/unix/ -- a version of MicroPython that runs on Unix.
+- ports/stm32/ -- a version of MicroPython that runs on the PyBoard and similar
+ STM32 boards (using ST's Cube HAL drivers).
+- ports/minimal/ -- a minimal MicroPython port. Start with this if you want
+ to port MicroPython to another microcontroller.
+- tests/ -- test framework and test scripts.
+- docs/ -- user documentation in Sphinx reStructuredText format. Rendered
+ HTML documentation is available at http://docs.micropython.org.
+
+Additional components:
+- ports/bare-arm/ -- a bare minimum version of MicroPython for ARM MCUs. Used
+ mostly to control code size.
+- ports/teensy/ -- a version of MicroPython that runs on the Teensy 3.1
+ (preliminary but functional).
+- ports/pic16bit/ -- a version of MicroPython for 16-bit PIC microcontrollers.
+- ports/cc3200/ -- a version of MicroPython that runs on the CC3200 from TI.
+- ports/esp8266/ -- a version of MicroPython that runs on Espressif's ESP8266 SoC.
+- ports/esp32/ -- a version of MicroPython that runs on Espressif's ESP32 SoC.
+- ports/nrf/ -- a version of MicroPython that runs on Nordic's nRF51 and nRF52 MCUs.
+- extmod/ -- additional (non-core) modules implemented in C.
+- tools/ -- various tools, including the pyboard.py module.
+- examples/ -- a few example Python scripts.
+
+The subdirectories above may include READMEs with additional info.
+
+"make" is used to build the components, or "gmake" on BSD-based systems.
+You will also need bash, gcc, and Python 3.3+ available as the command `python3`
+(if your system only has Python 2.7 then invoke make with the additional option
+`PYTHON=python2`).
+
+The MicroPython cross-compiler, mpy-cross
+-----------------------------------------
+
+Most ports require the MicroPython cross-compiler to be built first. This
+program, called mpy-cross, is used to pre-compile Python scripts to .mpy
+files which can then be included (frozen) into the firmware/executable for
+a port. To build mpy-cross use:
+
+ $ cd mpy-cross
+ $ make
+
+The Unix version
+----------------
+
+The "unix" port requires a standard Unix environment with gcc and GNU make.
+x86 and x64 architectures are supported (i.e. x86 32- and 64-bit), as well
+as ARM and MIPS. Making full-featured port to another architecture requires
+writing some assembly code for the exception handling and garbage collection.
+Alternatively, fallback implementation based on setjmp/longjmp can be used.
+
+To build (see section below for required dependencies):
+
+ $ cd ports/unix
+ $ make submodules
+ $ make
+
+Then to give it a try:
+
+ $ ./micropython
+ >>> list(5 * x + y for x in range(10) for y in [4, 2, 1])
+
+Use `CTRL-D` (i.e. EOF) to exit the shell.
+Learn about command-line options (in particular, how to increase heap size
+which may be needed for larger applications):
+
+ $ ./micropython -h
+
+Run complete testsuite:
+
+ $ make test
+
+Unix version comes with a builtin package manager called upip, e.g.:
+
+ $ ./micropython -m upip install micropython-pystone
+ $ ./micropython -m pystone
+
+Browse available modules on
+[PyPI](https://pypi.python.org/pypi?%3Aaction=search&term=micropython).
+Standard library modules come from
+[micropython-lib](https://github.com/micropython/micropython-lib) project.
+
+External dependencies
+---------------------
+
+Building MicroPython ports may require some dependencies installed.
+
+For Unix port, `libffi` library and `pkg-config` tool are required. On
+Debian/Ubuntu/Mint derivative Linux distros, install `build-essential`
+(includes toolchain and make), `libffi-dev`, and `pkg-config` packages.
+
+Other dependencies can be built together with MicroPython. This may
+be required to enable extra features or capabilities, and in recent
+versions of MicroPython, these may be enabled by default. To build
+these additional dependencies, in the port directory you're
+interested in (e.g. `ports/unix/`) first execute:
+
+ $ make submodules
+
+This will fetch all the relevant git submodules (sub repositories) that
+the port needs. Use the same command to get the latest versions of
+submodules as they are updated from time to time. After that execute:
+
+ $ make deplibs
+
+This will build all available dependencies (regardless whether they
+are used or not). If you intend to build MicroPython with additional
+options (like cross-compiling), the same set of options should be passed
+to `make deplibs`. To actually enable/disable use of dependencies, edit
+`ports/unix/mpconfigport.mk` file, which has inline descriptions of the options.
+For example, to build SSL module (required for `upip` tool described above,
+and so enabled by default), `MICROPY_PY_USSL` should be set to 1.
+
+For some ports, building required dependences is transparent, and happens
+automatically. But they still need to be fetched with the `make submodules`
+command.
+
+The STM32 version
+-----------------
+
+The "stm32" port requires an ARM compiler, arm-none-eabi-gcc, and associated
+bin-utils. For those using Arch Linux, you need arm-none-eabi-binutils,
+arm-none-eabi-gcc and arm-none-eabi-newlib packages. Otherwise, try here:
+https://developer.arm.com/tools-and-software/open-source-software/developer-tools/gnu-toolchain/gnu-rm
+
+To build:
+
+ $ cd ports/stm32
+ $ make submodules
+ $ make
+
+You then need to get your board into DFU mode. On the pyboard, connect the
+3V3 pin to the P1/DFU pin with a wire (on PYBv1.0 they are next to each other
+on the bottom left of the board, second row from the bottom).
+
+Then to flash the code via USB DFU to your device:
+
+ $ make deploy
+
+This will use the included `tools/pydfu.py` script. If flashing the firmware
+does not work it may be because you don't have the correct permissions, and
+need to use `sudo make deploy`.
+See the README.md file in the ports/stm32/ directory for further details.
+
+Contributing
+------------
+
+MicroPython is an open-source project and welcomes contributions. To be
+productive, please be sure to follow the
+[Contributors' Guidelines](https://github.com/micropython/micropython/wiki/ContributorGuidelines)
+and the [Code Conventions](https://github.com/micropython/micropython/blob/master/CODECONVENTIONS.md).
+Note that MicroPython is licenced under the MIT license, and all contributions
+should follow this license.
diff --git a/components/language/micropython/docs/Makefile b/components/language/micropython/docs/Makefile
new file mode 100644
index 00000000..05709617
--- /dev/null
+++ b/components/language/micropython/docs/Makefile
@@ -0,0 +1,191 @@
+# Makefile for Sphinx documentation
+#
+
+# You can set these variables from the command line.
+PYTHON = python3
+SPHINXOPTS = -W --keep-going
+SPHINXBUILD = sphinx-build
+PAPER =
+BUILDDIR = build/$(MICROPY_PORT)
+CPYDIFFDIR = ../tools
+CPYDIFF = gen-cpydiff.py
+GENRSTDIR = genrst
+# Run "make FORCE= ..." to avoid rebuilding from scratch (and risk
+# producing incorrect docs).
+FORCE = -E
+
+# User-friendly check for sphinx-build
+ifeq ($(shell which $(SPHINXBUILD) >/dev/null 2>&1; echo $$?), 1)
+$(error The '$(SPHINXBUILD)' command was not found. Make sure you have Sphinx installed, then set the SPHINXBUILD environment variable to point to the full path of the '$(SPHINXBUILD)' executable. Alternatively you can add the directory with the executable to your PATH. If you don't have Sphinx installed, grab it from http://sphinx-doc.org/)
+endif
+
+# Internal variables.
+PAPEROPT_a4 = -D latex_paper_size=a4
+PAPEROPT_letter = -D latex_paper_size=letter
+ALLSPHINXOPTS = -d $(BUILDDIR)/doctrees $(PAPEROPT_$(PAPER)) $(SPHINXOPTS) .
+# the i18n builder cannot share the environment and doctrees with the others
+I18NSPHINXOPTS = $(PAPEROPT_$(PAPER)) $(SPHINXOPTS) .
+
+.PHONY: help clean html dirhtml singlehtml pickle json htmlhelp qthelp devhelp epub latex latexpdf text man changes linkcheck doctest gettext
+
+help:
+ @echo "Please use \`make ' where is one of"
+ @echo " html to make standalone HTML files"
+ @echo " dirhtml to make HTML files named index.html in directories"
+ @echo " singlehtml to make a single large HTML file"
+ @echo " pickle to make pickle files"
+ @echo " json to make JSON files"
+ @echo " htmlhelp to make HTML files and a HTML help project"
+ @echo " qthelp to make HTML files and a qthelp project"
+ @echo " devhelp to make HTML files and a Devhelp project"
+ @echo " epub to make an epub"
+ @echo " latex to make LaTeX files, you can set PAPER=a4 or PAPER=letter"
+ @echo " latexpdf to make LaTeX files and run them through pdflatex"
+ @echo " latexpdfja to make LaTeX files and run them through platex/dvipdfmx"
+ @echo " text to make text files"
+ @echo " man to make manual pages"
+ @echo " texinfo to make Texinfo files"
+ @echo " info to make Texinfo files and run them through makeinfo"
+ @echo " gettext to make PO message catalogs"
+ @echo " changes to make an overview of all changed/added/deprecated items"
+ @echo " xml to make Docutils-native XML files"
+ @echo " pseudoxml to make pseudoxml-XML files for display purposes"
+ @echo " linkcheck to check all external links for integrity"
+ @echo " doctest to run all doctests embedded in the documentation (if enabled)"
+ @echo " cpydiff to generate the MicroPython differences from CPython"
+
+clean:
+ rm -rf $(BUILDDIR)/*
+ rm -f $(GENRSTDIR)/*
+
+cpydiff:
+ @echo "Generating MicroPython Differences."
+ rm -f $(GENRSTDIR)/*
+ cd $(CPYDIFFDIR) && $(PYTHON) $(CPYDIFF)
+
+html: cpydiff
+ $(SPHINXBUILD) $(FORCE) -b html $(ALLSPHINXOPTS) $(BUILDDIR)/html
+ @echo
+ @echo "Build finished. The HTML pages are in $(BUILDDIR)/html."
+
+dirhtml:
+ $(SPHINXBUILD) -b dirhtml $(ALLSPHINXOPTS) $(BUILDDIR)/dirhtml
+ @echo
+ @echo "Build finished. The HTML pages are in $(BUILDDIR)/dirhtml."
+
+singlehtml:
+ $(SPHINXBUILD) -b singlehtml $(ALLSPHINXOPTS) $(BUILDDIR)/singlehtml
+ @echo
+ @echo "Build finished. The HTML page is in $(BUILDDIR)/singlehtml."
+
+pickle:
+ $(SPHINXBUILD) -b pickle $(ALLSPHINXOPTS) $(BUILDDIR)/pickle
+ @echo
+ @echo "Build finished; now you can process the pickle files."
+
+json:
+ $(SPHINXBUILD) -b json $(ALLSPHINXOPTS) $(BUILDDIR)/json
+ @echo
+ @echo "Build finished; now you can process the JSON files."
+
+htmlhelp:
+ $(SPHINXBUILD) -b htmlhelp $(ALLSPHINXOPTS) $(BUILDDIR)/htmlhelp
+ @echo
+ @echo "Build finished; now you can run HTML Help Workshop with the" \
+ ".hhp project file in $(BUILDDIR)/htmlhelp."
+
+qthelp:
+ $(SPHINXBUILD) -b qthelp $(ALLSPHINXOPTS) $(BUILDDIR)/qthelp
+ @echo
+ @echo "Build finished; now you can run "qcollectiongenerator" with the" \
+ ".qhcp project file in $(BUILDDIR)/qthelp, like this:"
+ @echo "# qcollectiongenerator $(BUILDDIR)/qthelp/MicroPython.qhcp"
+ @echo "To view the help file:"
+ @echo "# assistant -collectionFile $(BUILDDIR)/qthelp/MicroPython.qhc"
+
+devhelp:
+ $(SPHINXBUILD) -b devhelp $(ALLSPHINXOPTS) $(BUILDDIR)/devhelp
+ @echo
+ @echo "Build finished."
+ @echo "To view the help file:"
+ @echo "# mkdir -p $$HOME/.local/share/devhelp/MicroPython"
+ @echo "# ln -s $(BUILDDIR)/devhelp $$HOME/.local/share/devhelp/MicroPython"
+ @echo "# devhelp"
+
+epub:
+ $(SPHINXBUILD) -b epub $(ALLSPHINXOPTS) $(BUILDDIR)/epub
+ @echo
+ @echo "Build finished. The epub file is in $(BUILDDIR)/epub."
+
+latex: cpydiff
+ $(SPHINXBUILD) -b latex $(ALLSPHINXOPTS) $(BUILDDIR)/latex
+ @echo
+ @echo "Build finished; the LaTeX files are in $(BUILDDIR)/latex."
+ @echo "Run \`make' in that directory to run these through (pdf)latex" \
+ "(use \`make latexpdf' here to do that automatically)."
+
+latexpdf: cpydiff
+ $(SPHINXBUILD) $(FORCE) -b latex $(ALLSPHINXOPTS) $(BUILDDIR)/latex
+ @echo "Running LaTeX files through pdflatex..."
+ $(MAKE) -C $(BUILDDIR)/latex all-pdf
+ @echo "pdflatex finished; the PDF files are in $(BUILDDIR)/latex."
+
+latexpdfja: cpydiff
+ $(SPHINXBUILD) -b latex $(ALLSPHINXOPTS) $(BUILDDIR)/latex
+ @echo "Running LaTeX files through platex and dvipdfmx..."
+ $(MAKE) -C $(BUILDDIR)/latex all-pdf-ja
+ @echo "pdflatex finished; the PDF files are in $(BUILDDIR)/latex."
+
+text:
+ $(SPHINXBUILD) -b text $(ALLSPHINXOPTS) $(BUILDDIR)/text
+ @echo
+ @echo "Build finished. The text files are in $(BUILDDIR)/text."
+
+man:
+ $(SPHINXBUILD) -b man $(ALLSPHINXOPTS) $(BUILDDIR)/man
+ @echo
+ @echo "Build finished. The manual pages are in $(BUILDDIR)/man."
+
+texinfo:
+ $(SPHINXBUILD) -b texinfo $(ALLSPHINXOPTS) $(BUILDDIR)/texinfo
+ @echo
+ @echo "Build finished. The Texinfo files are in $(BUILDDIR)/texinfo."
+ @echo "Run \`make' in that directory to run these through makeinfo" \
+ "(use \`make info' here to do that automatically)."
+
+info:
+ $(SPHINXBUILD) -b texinfo $(ALLSPHINXOPTS) $(BUILDDIR)/texinfo
+ @echo "Running Texinfo files through makeinfo..."
+ make -C $(BUILDDIR)/texinfo info
+ @echo "makeinfo finished; the Info files are in $(BUILDDIR)/texinfo."
+
+gettext:
+ $(SPHINXBUILD) -b gettext $(I18NSPHINXOPTS) $(BUILDDIR)/locale
+ @echo
+ @echo "Build finished. The message catalogs are in $(BUILDDIR)/locale."
+
+changes:
+ $(SPHINXBUILD) -b changes $(ALLSPHINXOPTS) $(BUILDDIR)/changes
+ @echo
+ @echo "The overview file is in $(BUILDDIR)/changes."
+
+linkcheck:
+ $(SPHINXBUILD) -b linkcheck $(ALLSPHINXOPTS) $(BUILDDIR)/linkcheck
+ @echo
+ @echo "Link check complete; look for any errors in the above output " \
+ "or in $(BUILDDIR)/linkcheck/output.txt."
+
+doctest:
+ $(SPHINXBUILD) -b doctest $(ALLSPHINXOPTS) $(BUILDDIR)/doctest
+ @echo "Testing of doctests in the sources finished, look at the " \
+ "results in $(BUILDDIR)/doctest/output.txt."
+
+xml:
+ $(SPHINXBUILD) -b xml $(ALLSPHINXOPTS) $(BUILDDIR)/xml
+ @echo
+ @echo "Build finished. The XML files are in $(BUILDDIR)/xml."
+
+pseudoxml:
+ $(SPHINXBUILD) -b pseudoxml $(ALLSPHINXOPTS) $(BUILDDIR)/pseudoxml
+ @echo
+ @echo "Build finished. The pseudo-XML files are in $(BUILDDIR)/pseudoxml."
diff --git a/components/language/micropython/docs/README.md b/components/language/micropython/docs/README.md
new file mode 100644
index 00000000..1591911c
--- /dev/null
+++ b/components/language/micropython/docs/README.md
@@ -0,0 +1,53 @@
+MicroPython Documentation
+=========================
+
+The MicroPython documentation can be found at:
+http://docs.micropython.org/en/latest/
+
+The documentation you see there is generated from the files in the docs tree:
+https://github.com/micropython/micropython/tree/master/docs
+
+Building the documentation locally
+----------------------------------
+
+If you're making changes to the documentation, you may want to build the
+documentation locally so that you can preview your changes.
+
+Install Sphinx, and optionally (for the RTD-styling), sphinx_rtd_theme,
+preferably in a virtualenv:
+
+ pip install sphinx
+ pip install sphinx_rtd_theme
+
+In `micropython/docs`, build the docs:
+
+ make html
+
+You'll find the index page at `micropython/docs/build/html/index.html`.
+
+Having readthedocs.org build the documentation
+----------------------------------------------
+
+If you would like to have docs for forks/branches hosted on GitHub, GitLab or
+BitBucket an alternative to building the docs locally is to sign up for a free
+https://readthedocs.org account. The rough steps to follow are:
+1. sign-up for an account, unless you already have one
+2. in your account settings: add GitHub as a connected service (assuming
+you have forked this repo on github)
+3. in your account projects: import your forked/cloned micropython repository
+into readthedocs
+4. in the project's versions: add the branches you are developing on or
+for which you'd like readthedocs to auto-generate docs whenever you
+push a change
+
+PDF manual generation
+---------------------
+
+This can be achieved with:
+
+ make latexpdf
+
+but require rather complete install of LaTeX with various extensions. On
+Debian/Ubuntu, try (500MB+ download):
+
+ apt-get install texlive-latex-recommended texlive-latex-extra
diff --git a/components/language/micropython/docs/conf.py b/components/language/micropython/docs/conf.py
new file mode 100644
index 00000000..a21e8d5f
--- /dev/null
+++ b/components/language/micropython/docs/conf.py
@@ -0,0 +1,301 @@
+#!/usr/bin/env python3
+# -*- coding: utf-8 -*-
+#
+# MicroPython documentation build configuration file, created by
+# sphinx-quickstart on Sun Sep 21 11:42:03 2014.
+#
+# This file is execfile()d with the current directory set to its
+# containing dir.
+#
+# Note that not all possible configuration values are present in this
+# autogenerated file.
+#
+# All configuration values have a default; values that are commented out
+# serve to show the default.
+
+import sys
+import os
+
+# If extensions (or modules to document with autodoc) are in another directory,
+# add these directories to sys.path here. If the directory is relative to the
+# documentation root, use os.path.abspath to make it absolute, like shown here.
+sys.path.insert(0, os.path.abspath('.'))
+
+# The members of the html_context dict are available inside topindex.html
+micropy_version = os.getenv('MICROPY_VERSION') or 'latest'
+micropy_all_versions = (os.getenv('MICROPY_ALL_VERSIONS') or 'latest').split(',')
+url_pattern = '%s/en/%%s' % (os.getenv('MICROPY_URL_PREFIX') or '/',)
+html_context = {
+ 'cur_version':micropy_version,
+ 'all_versions':[
+ (ver, url_pattern % ver) for ver in micropy_all_versions
+ ],
+ 'downloads':[
+ ('PDF', url_pattern % micropy_version + '/micropython-docs.pdf'),
+ ],
+}
+
+
+# -- General configuration ------------------------------------------------
+
+# If your documentation needs a minimal Sphinx version, state it here.
+#needs_sphinx = '1.0'
+
+# Add any Sphinx extension module names here, as strings. They can be
+# extensions coming with Sphinx (named 'sphinx.ext.*') or your custom
+# ones.
+extensions = [
+ 'sphinx.ext.autodoc',
+ 'sphinx.ext.doctest',
+ 'sphinx.ext.intersphinx',
+ 'sphinx.ext.todo',
+ 'sphinx.ext.coverage',
+]
+
+# Add any paths that contain templates here, relative to this directory.
+templates_path = ['templates']
+
+# The suffix of source filenames.
+source_suffix = '.rst'
+
+# The encoding of source files.
+#source_encoding = 'utf-8-sig'
+
+# The master toctree document.
+master_doc = 'index'
+
+# General information about the project.
+project = 'MicroPython'
+copyright = '- The MicroPython Documentation is Copyright © 2014-2022, Damien P. George, Paul Sokolovsky, and contributors'
+
+# The version info for the project you're documenting, acts as replacement for
+# |version| and |release|, also used in various other places throughout the
+# built documents.
+#
+# We don't follow "The short X.Y version" vs "The full version, including alpha/beta/rc tags"
+# breakdown, so use the same version identifier for both to avoid confusion.
+version = release = '1.19'
+
+# The language for content autogenerated by Sphinx. Refer to documentation
+# for a list of supported languages.
+#language = None
+
+# There are two options for replacing |today|: either, you set today to some
+# non-false value, then it is used:
+#today = ''
+# Else, today_fmt is used as the format for a strftime call.
+#today_fmt = '%B %d, %Y'
+
+# List of patterns, relative to source directory, that match files and
+# directories to ignore when looking for source files.
+exclude_patterns = ['build', '.venv']
+
+# The reST default role (used for this markup: `text`) to use for all
+# documents.
+default_role = 'any'
+
+# If true, '()' will be appended to :func: etc. cross-reference text.
+#add_function_parentheses = True
+
+# If true, the current module name will be prepended to all description
+# unit titles (such as .. function::).
+#add_module_names = True
+
+# If true, sectionauthor and moduleauthor directives will be shown in the
+# output. They are ignored by default.
+#show_authors = False
+
+# The name of the Pygments (syntax highlighting) style to use.
+pygments_style = 'sphinx'
+
+# A list of ignored prefixes for module index sorting.
+#modindex_common_prefix = []
+
+# If true, keep warnings as "system message" paragraphs in the built documents.
+#keep_warnings = False
+
+# Global include files. Sphinx docs suggest using rst_epilog in preference
+# of rst_prolog, so we follow. Absolute paths below mean "from the base
+# of the doctree".
+rst_epilog = """
+.. include:: /templates/replace.inc
+"""
+
+# -- Options for HTML output ----------------------------------------------
+
+# on_rtd is whether we are on readthedocs.org
+on_rtd = os.environ.get('READTHEDOCS', None) == 'True'
+
+if not on_rtd: # only import and set the theme if we're building docs locally
+ try:
+ import sphinx_rtd_theme
+ html_theme = 'sphinx_rtd_theme'
+ html_theme_path = [sphinx_rtd_theme.get_html_theme_path(), '.']
+ except:
+ html_theme = 'default'
+ html_theme_path = ['.']
+else:
+ html_theme_path = ['.']
+
+# Theme options are theme-specific and customize the look and feel of a theme
+# further. For a list of options available for each theme, see the
+# documentation.
+#html_theme_options = {}
+
+# Add any paths that contain custom themes here, relative to this directory.
+# html_theme_path = ['.']
+
+# The name for this set of Sphinx documents. If None, it defaults to
+# " v documentation".
+#html_title = None
+
+# A shorter title for the navigation bar. Default is the same as html_title.
+#html_short_title = None
+
+# The name of an image file (relative to this directory) to place at the top
+# of the sidebar.
+#html_logo = '../../logo/trans-logo.png'
+
+# The name of an image file (within the static path) to use as favicon of the
+# docs. This file should be a Windows icon file (.ico) being 16x16 or 32x32
+# pixels large.
+html_favicon = 'static/favicon.ico'
+
+# Add any paths that contain custom static files (such as style sheets) here,
+# relative to this directory. They are copied after the builtin static files,
+# so a file named "default.css" will overwrite the builtin "default.css".
+html_static_path = ['static']
+
+# Add any extra paths that contain custom files (such as robots.txt or
+# .htaccess) here, relative to this directory. These files are copied
+# directly to the root of the documentation.
+#html_extra_path = []
+
+# If not '', a 'Last updated on:' timestamp is inserted at every page bottom,
+# using the given strftime format.
+html_last_updated_fmt = '%d %b %Y'
+
+# If true, SmartyPants will be used to convert quotes and dashes to
+# typographically correct entities.
+#html_use_smartypants = True
+
+# Custom sidebar templates, maps document names to template names.
+#html_sidebars = {}
+
+# Additional templates that should be rendered to pages, maps page names to
+# template names.
+html_additional_pages = {"index": "topindex.html"}
+
+# If false, no module index is generated.
+#html_domain_indices = True
+
+# If false, no index is generated.
+#html_use_index = True
+
+# If true, the index is split into individual pages for each letter.
+#html_split_index = False
+
+# If true, links to the reST sources are added to the pages.
+#html_show_sourcelink = True
+
+# If true, "Created using Sphinx" is shown in the HTML footer. Default is True.
+#html_show_sphinx = True
+
+# If true, "(C) Copyright ..." is shown in the HTML footer. Default is True.
+#html_show_copyright = True
+
+# If true, an OpenSearch description file will be output, and all pages will
+# contain a tag referring to it. The value of this option must be the
+# base URL from which the finished HTML is served.
+#html_use_opensearch = ''
+
+# This is the file name suffix for HTML files (e.g. ".xhtml").
+#html_file_suffix = None
+
+# Output file base name for HTML help builder.
+htmlhelp_basename = 'MicroPythondoc'
+
+
+# -- Options for LaTeX output ---------------------------------------------
+
+latex_elements = {
+# The paper size ('letterpaper' or 'a4paper').
+#'papersize': 'letterpaper',
+
+# The font size ('10pt', '11pt' or '12pt').
+#'pointsize': '10pt',
+
+# Additional stuff for the LaTeX preamble.
+#'preamble': '',
+# Include 3 levels of headers in PDF ToC
+'preamble': '\setcounter{tocdepth}{2}',
+}
+
+# Grouping the document tree into LaTeX files. List of tuples
+# (source start file, target name, title,
+# author, documentclass [howto, manual, or own class]).
+latex_documents = [
+ (master_doc, 'MicroPython.tex', 'MicroPython Documentation',
+ 'Damien P. George, Paul Sokolovsky, and contributors', 'manual'),
+]
+
+# The name of an image file (relative to this directory) to place at the top of
+# the title page.
+#latex_logo = None
+
+# For "manual" documents, if this is true, then toplevel headings are parts,
+# not chapters.
+#latex_use_parts = False
+
+# If true, show page references after internal links.
+#latex_show_pagerefs = False
+
+# If true, show URL addresses after external links.
+#latex_show_urls = False
+
+# Documents to append as an appendix to all manuals.
+#latex_appendices = []
+
+# If false, no module index is generated.
+#latex_domain_indices = True
+
+
+# -- Options for manual page output ---------------------------------------
+
+# One entry per manual page. List of tuples
+# (source start file, name, description, authors, manual section).
+man_pages = [
+ ('index', 'micropython', 'MicroPython Documentation',
+ ['Damien P. George, Paul Sokolovsky, and contributors'], 1),
+]
+
+# If true, show URL addresses after external links.
+#man_show_urls = False
+
+
+# -- Options for Texinfo output -------------------------------------------
+
+# Grouping the document tree into Texinfo files. List of tuples
+# (source start file, target name, title, author,
+# dir menu entry, description, category)
+texinfo_documents = [
+ (master_doc, 'MicroPython', 'MicroPython Documentation',
+ 'Damien P. George, Paul Sokolovsky, and contributors', 'MicroPython', 'One line description of project.',
+ 'Miscellaneous'),
+]
+
+# Documents to append as an appendix to all manuals.
+#texinfo_appendices = []
+
+# If false, no module index is generated.
+#texinfo_domain_indices = True
+
+# How to display URL addresses: 'footnote', 'no', or 'inline'.
+#texinfo_show_urls = 'footnote'
+
+# If true, do not generate a @detailmenu in the "Top" node's menu.
+#texinfo_no_detailmenu = False
+
+
+# Example configuration for intersphinx: refer to the Python standard library.
+intersphinx_mapping = {'python': ('https://docs.python.org/3.5', None)}
diff --git a/components/language/micropython/docs/develop/cmodules.rst b/components/language/micropython/docs/develop/cmodules.rst
new file mode 100644
index 00000000..143057f7
--- /dev/null
+++ b/components/language/micropython/docs/develop/cmodules.rst
@@ -0,0 +1,266 @@
+.. _cmodules:
+
+MicroPython external C modules
+==============================
+
+When developing modules for use with MicroPython you may find you run into
+limitations with the Python environment, often due to an inability to access
+certain hardware resources or Python speed limitations.
+
+If your limitations can't be resolved with suggestions in :ref:`speed_python`,
+writing some or all of your module in C (and/or C++ if implemented for your port)
+is a viable option.
+
+If your module is designed to access or work with commonly available
+hardware or libraries please consider implementing it inside the MicroPython
+source tree alongside similar modules and submitting it as a pull request.
+If however you're targeting obscure or proprietary systems it may make
+more sense to keep this external to the main MicroPython repository.
+
+This chapter describes how to compile such external modules into the
+MicroPython executable or firmware image. Both Make and CMake build
+tools are supported, and when writing an external module it's a good idea to
+add the build files for both of these tools so the module can be used on all
+ports. But when compiling a particular port you will only need to use one
+method of building, either Make or CMake.
+
+An alternative approach is to use :ref:`natmod` which allows writing custom C
+code that is placed in a .mpy file, which can be imported dynamically in to
+a running MicroPython system without the need to recompile the main firmware.
+
+
+Structure of an external C module
+---------------------------------
+
+A MicroPython user C module is a directory with the following files:
+
+* ``*.c`` / ``*.cpp`` / ``*.h`` source code files for your module.
+
+ These will typically include the low level functionality being implemented and
+ the MicroPython binding functions to expose the functions and module(s).
+
+ Currently the best reference for writing these functions/modules is
+ to find similar modules within the MicroPython tree and use them as examples.
+
+* ``micropython.mk`` contains the Makefile fragment for this module.
+
+ ``$(USERMOD_DIR)`` is available in ``micropython.mk`` as the path to your
+ module directory. As it's redefined for each c module, is should be expanded
+ in your ``micropython.mk`` to a local make variable,
+ eg ``EXAMPLE_MOD_DIR := $(USERMOD_DIR)``
+
+ Your ``micropython.mk`` must add your modules source files relative to your
+ expanded copy of ``$(USERMOD_DIR)`` to ``SRC_USERMOD``, eg
+ ``SRC_USERMOD += $(EXAMPLE_MOD_DIR)/example.c``
+
+ If you have custom compiler options (like ``-I`` to add directories to search
+ for header files), these should be added to ``CFLAGS_USERMOD`` for C code
+ and to ``CXXFLAGS_USERMOD`` for C++ code.
+
+* ``micropython.cmake`` contains the CMake configuration for this module.
+
+ In ``micropython.cmake``, you may use ``${CMAKE_CURRENT_LIST_DIR}`` as the path to
+ the current module.
+
+ Your ``micropython.cmake`` should define an ``INTERFACE`` library and associate
+ your source files, compile definitions and include directories with it.
+ The library should then be linked to the ``usermod`` target.
+
+ .. code-block:: cmake
+
+ add_library(usermod_cexample INTERFACE)
+
+ target_sources(usermod_cexample INTERFACE
+ ${CMAKE_CURRENT_LIST_DIR}/examplemodule.c
+ )
+
+ target_include_directories(usermod_cexample INTERFACE
+ ${CMAKE_CURRENT_LIST_DIR}
+ )
+
+ target_link_libraries(usermod INTERFACE usermod_cexample)
+
+
+ See below for full usage example.
+
+
+Basic example
+-------------
+
+This simple module named ``cexample`` provides a single function
+``cexample.add_ints(a, b)`` which adds the two integer args together and returns
+the result. It can be found in the MicroPython source tree
+`in the examples directory `_
+and has a source file and a Makefile fragment with content as described above::
+
+ micropython/
+ └──examples/
+ └──usercmodule/
+ └──cexample/
+ ├── examplemodule.c
+ ├── micropython.mk
+ └── micropython.cmake
+
+
+Refer to the comments in these files for additional explanation.
+Next to the ``cexample`` module there's also ``cppexample`` which
+works in the same way but shows one way of mixing C and C++ code
+in MicroPython.
+
+
+Compiling the cmodule into MicroPython
+--------------------------------------
+
+To build such a module, compile MicroPython (see `getting started
+`_),
+applying 2 modifications:
+
+1. Set the build-time flag ``USER_C_MODULES`` to point to the modules
+ you want to include. For ports that use Make this variable should be a
+ directory which is searched automatically for modules. For ports that
+ use CMake this variable should be a file which includes the modules to
+ build. See below for details.
+
+2. Enable the modules by setting the corresponding C preprocessor macro to
+ 1. This is only needed if the modules you are building are not
+ automatically enabled.
+
+For building the example modules which come with MicroPython,
+set ``USER_C_MODULES`` to the ``examples/usercmodule`` directory for Make,
+or to ``examples/usercmodule/micropython.cmake`` for CMake.
+
+For example, here's how the to build the unix port with the example modules:
+
+.. code-block:: bash
+
+ cd micropython/ports/unix
+ make USER_C_MODULES=../../examples/usercmodule
+
+You may need to run ``make clean`` once at the start when including new
+user modules in the build. The build output will show the modules found::
+
+ ...
+ Including User C Module from ../../examples/usercmodule/cexample
+ Including User C Module from ../../examples/usercmodule/cppexample
+ ...
+
+For a CMake-based port such as rp2, this will look a little different (note
+that CMake is actually invoked by ``make``):
+
+.. code-block:: bash
+
+ cd micropython/ports/rp2
+ make USER_C_MODULES=../../examples/usercmodule/micropython.cmake
+
+Again, you may need to run ``make clean`` first for CMake to pick up the
+user modules. The CMake build output lists the modules by name::
+
+ ...
+ Including User C Module(s) from ../../examples/usercmodule/micropython.cmake
+ Found User C Module(s): usermod_cexample, usermod_cppexample
+ ...
+
+The contents of the top-level ``micropython.cmake`` can be used to control which
+modules are enabled.
+
+For your own projects it's more convenient to keep custom code out of the main
+MicroPython source tree, so a typical project directory structure will look
+like this::
+
+ my_project/
+ ├── modules/
+ │ ├── example1/
+ │ │ ├── example1.c
+ │ │ ├── micropython.mk
+ │ │ └── micropython.cmake
+ │ ├── example2/
+ │ │ ├── example2.c
+ │ │ ├── micropython.mk
+ │ │ └── micropython.cmake
+ │ └── micropython.cmake
+ └── micropython/
+ ├──ports/
+ ... ├──stm32/
+ ...
+
+When building with Make set ``USER_C_MODULES`` to the ``my_project/modules``
+directory. For example, building the stm32 port:
+
+.. code-block:: bash
+
+ cd my_project/micropython/ports/stm32
+ make USER_C_MODULES=../../../modules
+
+When building with CMake the top level ``micropython.cmake`` -- found directly
+in the ``my_project/modules`` directory -- should ``include`` all of the modules
+you want to have available:
+
+ .. code-block:: cmake
+
+ include(${CMAKE_CURRENT_LIST_DIR}/example1/micropython.cmake)
+ include(${CMAKE_CURRENT_LIST_DIR}/example2/micropython.cmake)
+
+Then build with:
+
+.. code-block:: bash
+
+ cd my_project/micropython/ports/esp32
+ make USER_C_MODULES=../../../../modules/micropython.cmake
+
+Note that the esp32 port needs the extra ``..`` for relative paths due to the
+location of its main ``CMakeLists.txt`` file. You can also specify absolute
+paths to ``USER_C_MODULES``.
+
+All modules specified by the ``USER_C_MODULES`` variable (either found in this
+directory when using Make, or added via ``include`` when using CMake) will be
+compiled, but only those which are enabled will be available for importing.
+User modules are usually enabled by default (this is decided by the developer
+of the module), in which case there is nothing more to do than set ``USER_C_MODULES``
+as described above.
+
+If a module is not enabled by default then the corresponding C preprocessor macro
+must be enabled. This macro name can be found by searching for the ``MP_REGISTER_MODULE``
+line in the module's source code (it usually appears at the end of the main source file).
+This macro should be surrounded by a ``#if X`` / ``#endif`` pair, and the configuration
+option ``X`` must be set to 1 using ``CFLAGS_EXTRA`` to make the module available. If
+there is no ``#if X`` / ``#endif`` pair then the module is enabled by default.
+
+For example, the ``examples/usercmodule/cexample`` module is enabled by default so
+has the following line in its source code:
+
+ .. code-block:: c
+
+ MP_REGISTER_MODULE(MP_QSTR_cexample, example_user_cmodule);
+
+Alternatively, to make this module disabled by default but selectable through
+a preprocessor configuration option, it would be:
+
+ .. code-block:: c
+
+ #if MODULE_CEXAMPLE_ENABLED
+ MP_REGISTER_MODULE(MP_QSTR_cexample, example_user_cmodule);
+ #endif
+
+In this case the module is enabled by adding ``CFLAGS_EXTRA=-DMODULE_CEXAMPLE_ENABLED=1``
+to the ``make`` command, or editing ``mpconfigport.h`` or ``mpconfigboard.h`` to add
+
+ .. code-block:: c
+
+ #define MODULE_CEXAMPLE_ENABLED (1)
+
+Note that the exact method depends on the port as they have different
+structures. If not done correctly it will compile but importing will
+fail to find the module.
+
+
+Module usage in MicroPython
+---------------------------
+
+Once built into your copy of MicroPython, the module
+can now be accessed in Python just like any other builtin module, e.g.
+
+.. code-block:: python
+
+ import cexample
+ print(cexample.add_ints(1, 3))
+ # should display 4
diff --git a/components/language/micropython/docs/develop/compiler.rst b/components/language/micropython/docs/develop/compiler.rst
new file mode 100644
index 00000000..20076574
--- /dev/null
+++ b/components/language/micropython/docs/develop/compiler.rst
@@ -0,0 +1,317 @@
+.. _compiler:
+
+The Compiler
+============
+
+The compilation process in MicroPython involves the following steps:
+
+* The lexer converts the stream of text that makes up a MicroPython program into tokens.
+* The parser then converts the tokens into an abstract syntax (parse tree).
+* Then bytecode or native code is emitted based on the parse tree.
+
+For purposes of this discussion we are going to add a simple language feature ``add1``
+that can be use in Python as:
+
+.. code-block:: bash
+
+ >>> add1 3
+ 4
+ >>>
+
+The ``add1`` statement takes an integer as argument and adds ``1`` to it.
+
+Adding a grammar rule
+----------------------
+
+MicroPython's grammar is based on the `CPython grammar `_
+and is defined in `py/grammar.h `_.
+This grammar is what is used to parse MicroPython source files.
+
+There are two macros you need to know to define a grammar rule: ``DEF_RULE`` and ``DEF_RULE_NC``.
+``DEF_RULE`` allows you to define a rule with an associated compile function,
+while ``DEF_RULE_NC`` has no compile (NC) function for it.
+
+A simple grammar definition with a compile function for our new ``add1`` statement
+looks like the following:
+
+.. code-block:: c
+
+ DEF_RULE(add1_stmt, c(add1_stmt), and(2), tok(KW_ADD1), rule(testlist))
+
+The second argument ``c(add1_stmt)`` is the corresponding compile function that should be implemented
+in ``py/compile.c`` to turn this rule into executable code.
+
+The third required argument can be ``or`` or ``and``. This specifies the number of nodes associated
+with a statement. For example, in this case, our ``add1`` statement is similar to ADD1 in assembly
+language. It takes one numeric argument. Therefore, the ``add1_stmt`` has two nodes associated with it.
+One node is for the statement itself, i.e the literal ``add1`` corresponding to ``KW_ADD1``,
+and the other for its argument, a ``testlist`` rule which is the top-level expression rule.
+
+.. note::
+ The ``add1`` rule here is just an example and not part of the standard
+ MicroPython grammar.
+
+The fourth argument in this example is the token associated with the rule, ``KW_ADD1``. This token should be
+defined in the lexer by editing ``py/lexer.h``.
+
+Defining the same rule without a compile function is achieved by using the ``DEF_RULE_NC`` macro
+and omitting the compile function argument:
+
+.. code-block:: c
+
+ DEF_RULE_NC(add1_stmt, and(2), tok(KW_ADD1), rule(testlist))
+
+The remaining arguments take on the same meaning. A rule without a compile function must
+be handled explicitly by all rules that may have this rule as a node. Such NC-rules are usually
+used to express sub-parts of a complicated grammar structure that cannot be expressed in a
+single rule.
+
+.. note::
+ The macros ``DEF_RULE`` and ``DEF_RULE_NC`` take other arguments. For an in-depth understanding of
+ supported parameters, see `py/grammar.h `_.
+
+Adding a lexical token
+----------------------
+
+Every rule defined in the grammar should have a token associated with it that is defined in ``py/lexer.h``.
+Add this token by editing the ``_mp_token_kind_t`` enum:
+
+.. code-block:: c
+ :emphasize-lines: 12
+
+ typedef enum _mp_token_kind_t {
+ ...
+ MP_TOKEN_KW_OR,
+ MP_TOKEN_KW_PASS,
+ MP_TOKEN_KW_RAISE,
+ MP_TOKEN_KW_RETURN,
+ MP_TOKEN_KW_TRY,
+ MP_TOKEN_KW_WHILE,
+ MP_TOKEN_KW_WITH,
+ MP_TOKEN_KW_YIELD,
+ MP_TOKEN_KW_ADD1,
+ ...
+ } mp_token_kind_t;
+
+Then also edit ``py/lexer.c`` to add the new keyword literal text:
+
+.. code-block:: c
+ :emphasize-lines: 12
+
+ STATIC const char *const tok_kw[] = {
+ ...
+ "or",
+ "pass",
+ "raise",
+ "return",
+ "try",
+ "while",
+ "with",
+ "yield",
+ "add1",
+ ...
+ };
+
+Notice the keyword is named depending on what you want it to be. For consistency, maintain the
+naming standard accordingly.
+
+.. note::
+ The order of these keywords in ``py/lexer.c`` must match the order of tokens in the enum
+ defined in ``py/lexer.h``.
+
+Parsing
+-------
+
+In the parsing stage the parser takes the tokens produced by the lexer and converts them to an abstract syntax tree (AST) or
+*parse tree*. The implementation for the parser is defined in `py/parse.c `_.
+
+The parser also maintains a table of constants for use in different aspects of parsing, similar to what a
+`symbol table `_
+does.
+
+Several optimizations like `constant folding `_
+on integers for most operations e.g. logical, binary, unary, etc, and optimizing enhancements on parenthesis
+around expressions are performed during this phase, along with some optimizations on strings.
+
+It's worth noting that *docstrings* are discarded and not accessible to the compiler.
+Even optimizations like `string interning `_ are
+not applied to *docstrings*.
+
+Compiler passes
+---------------
+
+Like many compilers, MicroPython compiles all code to MicroPython bytecode or native code. The functionality
+that achieves this is implemented in `py/compile.c `_.
+The most relevant method you should know about is this:
+
+.. code-block:: c
+
+ mp_obj_t mp_compile(mp_parse_tree_t *parse_tree, qstr source_file, bool is_repl) {
+ // Compile the input parse_tree to a raw-code structure.
+ mp_raw_code_t *rc = mp_compile_to_raw_code(parse_tree, source_file, is_repl);
+ // Create and return a function object that executes the outer module.
+ return mp_make_function_from_raw_code(rc, MP_OBJ_NULL, MP_OBJ_NULL);
+ }
+
+The compiler compiles the code in four passes: scope, stack size, code size and emit.
+Each pass runs the same C code over the same AST data structure, with different things
+being computed each time based on the results of the previous pass.
+
+First pass
+~~~~~~~~~~
+
+In the first pass, the compiler learns about the known identifiers (variables) and
+their scope, being global, local, closed over, etc. In the same pass the emitter
+(bytecode or native code) also computes the number of labels needed for the emitted
+code.
+
+.. code-block:: c
+
+ // Compile pass 1.
+ comp->emit = emit_bc;
+ comp->emit_method_table = &emit_bc_method_table;
+
+ uint max_num_labels = 0;
+ for (scope_t *s = comp->scope_head; s != NULL && comp->compile_error == MP_OBJ_NULL; s = s->next) {
+ if (s->emit_options == MP_EMIT_OPT_ASM) {
+ compile_scope_inline_asm(comp, s, MP_PASS_SCOPE);
+ } else {
+ compile_scope(comp, s, MP_PASS_SCOPE);
+
+ // Check if any implicitly declared variables should be closed over.
+ for (size_t i = 0; i < s->id_info_len; ++i) {
+ id_info_t *id = &s->id_info[i];
+ if (id->kind == ID_INFO_KIND_GLOBAL_IMPLICIT) {
+ scope_check_to_close_over(s, id);
+ }
+ }
+ }
+ ...
+ }
+
+Second and third passes
+~~~~~~~~~~~~~~~~~~~~~~~
+
+The second and third passes involve computing the Python stack size and code size
+for the bytecode or native code. After the third pass the code size cannot change,
+otherwise jump labels will be incorrect.
+
+.. code-block:: c
+
+ for (scope_t *s = comp->scope_head; s != NULL && comp->compile_error == MP_OBJ_NULL; s = s->next) {
+ ...
+
+ // Pass 2: Compute the Python stack size.
+ compile_scope(comp, s, MP_PASS_STACK_SIZE);
+
+ // Pass 3: Compute the code size.
+ if (comp->compile_error == MP_OBJ_NULL) {
+ compile_scope(comp, s, MP_PASS_CODE_SIZE);
+ }
+
+ ...
+ }
+
+Just before pass two there is a selection for the type of code to be emitted, which can
+either be native or bytecode.
+
+.. code-block:: c
+
+ // Choose the emitter type.
+ switch (s->emit_options) {
+ case MP_EMIT_OPT_NATIVE_PYTHON:
+ case MP_EMIT_OPT_VIPER:
+ if (emit_native == NULL) {
+ emit_native = NATIVE_EMITTER(new)(&comp->compile_error, &comp->next_label, max_num_labels);
+ }
+ comp->emit_method_table = NATIVE_EMITTER_TABLE;
+ comp->emit = emit_native;
+ break;
+
+ default:
+ comp->emit = emit_bc;
+ comp->emit_method_table = &emit_bc_method_table;
+ break;
+ }
+
+The bytecode option is the default but something unique to note for the native
+code option is that there is another option via ``VIPER``. See the
+:ref:`Emitting native code ` section for more details on
+viper annotations.
+
+There is also support for *inline assembly code*, where assembly instructions are
+written as Python function calls but are emitted directly as the corresponding
+machine code. This assembler has only three passes (scope, code size, emit)
+and uses a different implementation, not the ``compile_scope`` function.
+See the `inline assembler tutorial `_
+for more details.
+
+Fourth pass
+~~~~~~~~~~~
+
+The fourth pass emits the final code that can be executed, either bytecode in
+the virtual machine, or native code directly by the CPU.
+
+.. code-block:: c
+
+ for (scope_t *s = comp->scope_head; s != NULL && comp->compile_error == MP_OBJ_NULL; s = s->next) {
+ ...
+
+ // Pass 4: Emit the compiled bytecode or native code.
+ if (comp->compile_error == MP_OBJ_NULL) {
+ compile_scope(comp, s, MP_PASS_EMIT);
+ }
+ }
+
+Emitting bytecode
+-----------------
+
+Statements in Python code usually correspond to emitted bytecode, for example ``a + b``
+generates "push a" then "push b" then "binary op add". Some statements do not emit
+anything but instead affect other things like the scope of variables, for example
+``global a``.
+
+The implementation of a function that emits bytecode looks similar to this:
+
+.. code-block:: c
+
+ void mp_emit_bc_unary_op(emit_t *emit, mp_unary_op_t op) {
+ emit_write_bytecode_byte(emit, 0, MP_BC_UNARY_OP_MULTI + op);
+ }
+
+We use the unary operator expressions for an example here but the implementation
+details are similar for other statements/expressions. The method ``emit_write_bytecode_byte()``
+is a wrapper around the main function ``emit_get_cur_to_write_bytecode()`` that all
+functions must call to emit bytecode.
+
+.. _emitting_native_code:
+
+Emitting native code
+---------------------
+
+Similar to how bytecode is generated, there should be a corresponding function in ``py/emitnative.c`` for each
+code statement:
+
+.. code-block:: c
+
+ STATIC void emit_native_unary_op(emit_t *emit, mp_unary_op_t op) {
+ vtype_kind_t vtype;
+ emit_pre_pop_reg(emit, &vtype, REG_ARG_2);
+ if (vtype == VTYPE_PYOBJ) {
+ emit_call_with_imm_arg(emit, MP_F_UNARY_OP, op, REG_ARG_1);
+ emit_post_push_reg(emit, VTYPE_PYOBJ, REG_RET);
+ } else {
+ adjust_stack(emit, 1);
+ EMIT_NATIVE_VIPER_TYPE_ERROR(emit,
+ MP_ERROR_TEXT("unary op %q not implemented"), mp_unary_op_method_name[op]);
+ }
+ }
+
+The difference here is that we have to handle *viper typing*. Viper annotations allow
+us to handle more than one type of variable. By default all variables are Python objects,
+but with viper a variable can also be declared as a machine-typed variable like a native
+integer or pointer. Viper can be thought of as a superset of Python, where normal Python
+objects are handled as usual, while native machine variables are handled in an optimised
+way by using direct machine instructions for the operations. Viper typing may break
+Python equivalence because, for example, integers become native integers and can overflow
+(unlike Python integers which extend automatically to arbitrary precision).
diff --git a/components/language/micropython/docs/develop/extendingmicropython.rst b/components/language/micropython/docs/develop/extendingmicropython.rst
new file mode 100644
index 00000000..b4029c42
--- /dev/null
+++ b/components/language/micropython/docs/develop/extendingmicropython.rst
@@ -0,0 +1,18 @@
+.. _extendingmicropython:
+
+Extending MicroPython in C
+==========================
+
+This chapter describes options for implementing additional functionality in C, but from code
+written outside of the main MicroPython repository. The first approach is useful for building
+your own custom firmware with some project-specific additional modules or functions that can
+be accessed from Python. The second approach is for building modules that can be loaded at runtime.
+
+Please see the :ref:`library section ` for more information on building core modules that
+live in the main MicroPython repository.
+
+.. toctree::
+ :maxdepth: 3
+
+ cmodules.rst
+ natmod.rst
diff --git a/components/language/micropython/docs/develop/gettingstarted.rst b/components/language/micropython/docs/develop/gettingstarted.rst
new file mode 100644
index 00000000..36062ddc
--- /dev/null
+++ b/components/language/micropython/docs/develop/gettingstarted.rst
@@ -0,0 +1,329 @@
+.. _gettingstarted:
+
+Getting Started
+===============
+
+This guide covers a step-by-step process on setting up version control, obtaining and building
+a copy of the source code for a port, building the documentation, running tests, and a description of the
+directory structure of the MicroPython code base.
+
+Source control with git
+-----------------------
+
+MicroPython is hosted on `GitHub `_ and uses
+`Git `_ for source control. The workflow is such that
+code is pulled and pushed to and from the main repository. Install the respective version
+of Git for your operating system to follow through the rest of the steps.
+
+.. note::
+ For a reference on the installation instructions, please refer to
+ the `Git installation instructions `_.
+ Learn about the basic git commands in this `Git Handbook `_
+ or any other sources on the internet.
+
+.. note::
+ A .git-blame-ignore-revs file is included which avoids the output of git blame getting cluttered
+ by commits which are only for formatting code but have no functional changes. See `git blame documentation
+ `_ on how to use this.
+
+Get the code
+------------
+
+It is recommended that you maintain a fork of the MicroPython repository for your development purposes.
+The process of obtaining the source code includes the following:
+
+#. Fork the repository https://github.com/micropython/micropython
+#. You will now have a fork at /micropython>.
+#. Clone the forked repository using the following command:
+
+.. code-block:: bash
+
+ $ git clone https://github.com//micropython
+
+Then, `configure the remote repositories `_ to be able to
+collaborate on the MicroPython project.
+
+Configure remote upstream:
+
+.. code-block:: bash
+
+ $ cd micropython
+ $ git remote add upstream https://github.com/micropython/micropython
+
+It is common to configure ``upstream`` and ``origin`` on a forked repository
+to assist with sharing code changes. You can maintain your own mapping but
+it is recommended that ``origin`` maps to your fork and ``upstream`` to the main
+MicroPython repository.
+
+After the above configuration, your setup should be similar to this:
+
+.. code-block:: bash
+
+ $ git remote -v
+ origin https://github.com//micropython (fetch)
+ origin https://github.com//micropython (push)
+ upstream https://github.com/micropython/micropython (fetch)
+ upstream https://github.com/micropython/micropython (push)
+
+You should now have a copy of the source code. By default, you are pointing
+to the master branch. To prepare for further development, it is recommended
+to work on a development branch.
+
+.. code-block:: bash
+
+ $ git checkout -b dev-branch
+
+You can give it any name. You will have to compile MicroPython whenever you change
+to a different branch.
+
+Compile and build the code
+--------------------------
+
+When compiling MicroPython, you compile a specific :term:`port`, usually
+targeting a specific :ref:`board `. Start by installing the required dependencies.
+Then build the MicroPython cross-compiler before you can successfully compile and build.
+This applies specifically when using Linux to compile.
+The Windows instructions are provided in a later section.
+
+.. _required_dependencies:
+
+Required dependencies
+~~~~~~~~~~~~~~~~~~~~~
+
+Install the required dependencies for Linux:
+
+.. code-block:: bash
+
+ $ sudo apt-get install build-essential libffi-dev git pkg-config
+
+For the stm32 port, the ARM cross-compiler is required:
+
+.. code-block:: bash
+
+ $ sudo apt-get install arm-none-eabi-gcc arm-none-eabi-binutils arm-none-eabi-newlib
+
+See the `ARM GCC
+toolchain `_
+for the latest details.
+
+Python is also required. Python 2 is supported for now, but we recommend using Python 3.
+Check that you have Python available on your system:
+
+.. code-block:: bash
+
+ $ python3
+ Python 3.5.0 (default, Jul 17 2020, 14:04:10)
+ [GCC 5.4.0 20160609] on linux
+ Type "help", "copyright", "credits" or "license" for more information.
+ >>>
+
+All supported ports have different dependency requirements, see their respective
+`readme files `_.
+
+Building the MicroPython cross-compiler
+~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+
+Almost all ports require building ``mpy-cross`` first to perform pre-compilation
+of Python code that will be included in the port firmware:
+
+.. code-block:: bash
+
+ $ cd mpy-cross
+ $ make
+
+.. note::
+ Note that, ``mpy-cross`` must be built for the host architecture
+ and not the target architecture.
+
+If it built successfully, you should see a message similar to this:
+
+.. code-block:: bash
+
+ LINK mpy-cross
+ text data bss dec hex filename
+ 279328 776 880 280984 44998 mpy-cross
+
+.. note::
+
+ Use ``make -C mpy-cross`` to build the cross-compiler in one statement
+ without moving to the ``mpy-cross`` directory otherwise, you will need
+ to do ``cd ..`` for the next steps.
+
+Building the Unix port of MicroPython
+~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+
+The Unix port is a version of MicroPython that runs on Linux, macOS, and other Unix-like operating systems.
+It's extremely useful for developing MicroPython as it avoids having to deploy your code to a device to test it.
+In many ways, it works a lot like CPython's python binary.
+
+To build for the Unix port, make sure all Linux related dependencies are installed as detailed in the
+required dependencies section. See the :ref:`required_dependencies`
+to make sure that all dependencies are installed for this port. Also, make sure you have a working
+environment for ``gcc`` and ``GNU make``. Ubuntu 20.04 has been used for the example
+below but other unixes ought to work with little modification:
+
+.. code-block:: bash
+
+ $ gcc --version
+ gcc (Ubuntu 9.3.0-10ubuntu2) 9.3.0
+ Copyright (C) 2019 Free Software Foundation, Inc.
+ This is free software; see the source for copying conditions. There is NO
+ warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.then build:
+
+.. code-block:: bash
+
+ $ cd ports/unix
+ $ make submodules
+ $ make
+
+If MicroPython built correctly, you should see the following:
+
+.. code-block:: bash
+
+ LINK micropython
+ text data bss dec hex filename
+ 412033 5680 2496 420209 66971 micropython
+
+Now run it:
+
+.. code-block:: bash
+
+ $ ./micropython
+ MicroPython v1.13-38-gc67012d-dirty on 2020-09-13; linux version
+ Use Ctrl-D to exit, Ctrl-E for paste mode
+ >>> print("hello world")
+ hello world
+ >>>
+
+Building the Windows port
+~~~~~~~~~~~~~~~~~~~~~~~~~
+
+The Windows port includes a Visual Studio project file micropython.vcxproj that you can use to build micropython.exe.
+It can be opened in Visual Studio or built from the command line using msbuild. Alternatively, it can be built using mingw,
+either in Windows with Cygwin, or on Linux.
+See `windows port documentation `_ for more information.
+
+Building the STM32 port
+~~~~~~~~~~~~~~~~~~~~~~~
+
+Like the Unix port, you need to install some required dependencies
+as detailed in the :ref:`required_dependencies` section, then build:
+
+.. code-block:: bash
+
+ $ cd ports/stm32
+ $ make submodules
+ $ make
+
+Please refer to the `stm32 documentation `_
+for more details on flashing the firmware.
+
+.. note::
+ See the :ref:`required_dependencies` to make sure that all dependencies are installed for this port.
+ The cross-compiler is needed. ``arm-none-eabi-gcc`` should also be in the $PATH or specified manually
+ via CROSS_COMPILE, either by setting the environment variable or in the ``make`` command line arguments.
+
+You can also specify which board to use:
+
+.. code-block:: bash
+
+ $ cd ports/stm32
+ $ make submodules
+ $ make BOARD=
+
+See `ports/stm32/boards `_
+for the available boards. e.g. "PYBV11" or "NUCLEO_WB55".
+
+Building the documentation
+--------------------------
+
+MicroPython documentation is created using ``Sphinx``. If you have already
+installed Python, then install ``Sphinx`` using ``pip``. It is recommended
+that you use a virtual environment:
+
+.. code-block:: bash
+
+ $ python3 -m venv env
+ $ source env/bin/activate
+ $ pip install sphinx
+
+Navigate to the ``docs`` directory:
+
+.. code-block:: bash
+
+ $ cd docs
+
+Build the docs:
+
+.. code-block:: bash
+
+ $ make html
+
+Open ``docs/build/html/index.html`` in your browser to view the docs locally. Refer to the
+documentation on `importing your documentation
+`_ to use Read the Docs.
+
+Running the tests
+-----------------
+
+To run all tests in the test suite on the Unix port use:
+
+.. code-block:: bash
+
+ $ cd ports/unix
+ $ make test
+
+To run a selection of tests on a board/device connected over USB use:
+
+.. code-block:: bash
+
+ $ cd tests
+ $ ./run-tests.py --target minimal --device /dev/ttyACM0
+
+See also :ref:`writingtests`.
+
+Folder structure
+----------------
+
+There are a couple of directories to take note of in terms of where certain implementation details
+are. The following is a break down of the top-level folders in the source code.
+
+py
+
+ Contains the compiler, runtime, and core library implementation.
+
+mpy-cross
+
+ Has the MicroPython cross-compiler which pre-compiles the Python scripts to bytecode.
+
+ports
+
+ Code for all the versions of MicroPython for the supported ports.
+
+lib
+
+ Low-level C libraries used by any port which are mostly 3rd-party libraries.
+
+drivers
+
+ Has drivers for specific hardware and intended to work across multiple ports.
+
+extmod
+
+ Contains a C implementation of more non-core modules.
+
+docs
+
+ Has the standard documentation found at https://docs.micropython.org/.
+
+tests
+
+ An implementation of the test suite.
+
+tools
+
+ Contains helper tools including the ``upip`` and the ``pyboard.py`` module.
+
+examples
+
+ Example code for building MicroPython as a library as well as native modules.
diff --git a/components/language/micropython/docs/develop/img/bitmap.png b/components/language/micropython/docs/develop/img/bitmap.png
new file mode 100644
index 00000000..87de81d7
Binary files /dev/null and b/components/language/micropython/docs/develop/img/bitmap.png differ
diff --git a/components/language/micropython/docs/develop/img/collision.png b/components/language/micropython/docs/develop/img/collision.png
new file mode 100644
index 00000000..a67ddd61
Binary files /dev/null and b/components/language/micropython/docs/develop/img/collision.png differ
diff --git a/components/language/micropython/docs/develop/img/linprob.png b/components/language/micropython/docs/develop/img/linprob.png
new file mode 100644
index 00000000..c2881890
Binary files /dev/null and b/components/language/micropython/docs/develop/img/linprob.png differ
diff --git a/components/language/micropython/docs/develop/index.rst b/components/language/micropython/docs/develop/index.rst
new file mode 100644
index 00000000..327038f1
--- /dev/null
+++ b/components/language/micropython/docs/develop/index.rst
@@ -0,0 +1,26 @@
+MicroPython Internals
+=====================
+
+This chapter covers a tour of MicroPython from the perspective of a developer, contributing
+to MicroPython. It acts as a comprehensive resource on the implementation details of MicroPython
+for both novice and expert contributors.
+
+Development around MicroPython usually involves modifying the core runtime, porting or
+maintaining a new library. This guide describes at great depth, the implementation
+details of MicroPython including a getting started guide, compiler internals, porting
+MicroPython to a new platform and implementing a core MicroPython library.
+
+.. toctree::
+ :maxdepth: 3
+
+ gettingstarted.rst
+ writingtests.rst
+ compiler.rst
+ memorymgt.rst
+ library.rst
+ optimizations.rst
+ qstr.rst
+ maps.rst
+ publiccapi.rst
+ extendingmicropython.rst
+ porting.rst
diff --git a/components/language/micropython/docs/develop/library.rst b/components/language/micropython/docs/develop/library.rst
new file mode 100644
index 00000000..c2a86ea1
--- /dev/null
+++ b/components/language/micropython/docs/develop/library.rst
@@ -0,0 +1,86 @@
+.. _internals_library:
+
+Implementing a Module
+=====================
+
+This chapter details how to implement a core module in MicroPython.
+MicroPython modules can be one of the following:
+
+- Built-in module: A general module that is be part of the MicroPython repository.
+- User module: A module that is useful for your specific project that you maintain
+ in your own repository or private codebase.
+- Dynamic module: A module that can be deployed and imported at runtime to your device.
+
+A module in MicroPython can be implemented in one of the following locations:
+
+- py/: A core library that mirrors core CPython functionality.
+- extmod/: A CPython or MicroPython-specific module that is shared across multiple ports.
+- ports//: A port-specific module.
+
+.. note::
+ This chapter describes modules implemented in ``py/`` or core modules.
+ See :ref:`extendingmicropython` for details on implementing an external module.
+ For details on port-specific modules, see :ref:`porting_to_a_board`.
+
+Implementing a core module
+--------------------------
+
+Like CPython, MicroPython has core builtin modules that can be accessed through import statements.
+An example is the ``gc`` module discussed in :ref:`memorymanagement`.
+
+.. code-block:: bash
+
+ >>> import gc
+ >>> gc.enable()
+ >>>
+
+MicroPython has several other builtin standard/core modules like ``io``, ``array`` etc.
+Adding a new core module involves several modifications.
+
+First, create the ``C`` file in the ``py/`` directory. In this example we are adding a
+hypothetical new module ``subsystem`` in the file ``modsubsystem.c``:
+
+.. code-block:: c
+
+ #include "py/builtin.h"
+ #include "py/runtime.h"
+
+ #if MICROPY_PY_SUBSYSTEM
+
+ // info()
+ STATIC mp_obj_t py_subsystem_info(void) {
+ return MP_OBJ_NEW_SMALL_INT(42);
+ }
+ MP_DEFINE_CONST_FUN_OBJ_0(subsystem_info_obj, py_subsystem_info);
+
+ STATIC const mp_rom_map_elem_t mp_module_subsystem_globals_table[] = {
+ { MP_ROM_QSTR(MP_QSTR___name__), MP_ROM_QSTR(MP_QSTR_subsystem) },
+ { MP_ROM_QSTR(MP_QSTR_info), MP_ROM_PTR(&subsystem_info_obj) },
+ };
+ STATIC MP_DEFINE_CONST_DICT(mp_module_subsystem_globals, mp_module_subsystem_globals_table);
+
+ const mp_obj_module_t mp_module_subsystem = {
+ .base = { &mp_type_module },
+ .globals = (mp_obj_dict_t *)&mp_module_subsystem_globals,
+ };
+
+ MP_REGISTER_MODULE(MP_QSTR_subsystem, mp_module_subsystem);
+
+ #endif
+
+The implementation includes a definition of all functions related to the module and adds the
+functions to the module's global table in ``mp_module_subsystem_globals_table``. It also
+creates the module object with ``mp_module_subsystem``. The module is then registered with
+the wider system via the ``MP_REGISTER_MODULE`` macro.
+
+After building and running the modified MicroPython, the module should now be importable:
+
+.. code-block:: bash
+
+ >>> import subsystem
+ >>> subsystem.info()
+ 42
+ >>>
+
+Our ``info()`` function currently returns just a single number but can be extended
+to do anything. Similarly, more functions can be added to this new module.
diff --git a/components/language/micropython/docs/develop/maps.rst b/components/language/micropython/docs/develop/maps.rst
new file mode 100644
index 00000000..8f899fa1
--- /dev/null
+++ b/components/language/micropython/docs/develop/maps.rst
@@ -0,0 +1,63 @@
+.. _maps:
+
+Maps and Dictionaries
+=====================
+
+MicroPython dictionaries and maps use techniques called open addressing and linear probing.
+This chapter details both of these methods.
+
+Open addressing
+---------------
+
+`Open addressing `_ is used to resolve collisions.
+Collisions are very common occurrences and happen when two items happen to hash to the same
+slot or location. For example, given a hash setup as this:
+
+.. image:: img/collision.png
+
+If there is a request to fill slot ``0`` with ``70``, since the slot ``0`` is not empty, open addressing
+finds the next available slot in the dictionary to service this request. This sequential search for an alternate
+location is called *probing*. There are several sequence probing algorithms but MicroPython uses
+linear probing that is described in the next section.
+
+Linear probing
+--------------
+
+Linear probing is one of the methods for finding an available address or slot in a dictionary. In MicroPython,
+it is used with open addressing. To service the request described above, unlike other probing algorithms,
+linear probing assumes a fixed interval of ``1`` between probes. The request will therefore be serviced by
+placing the item in the next free slot which is slot ``4`` in our example:
+
+.. image:: img/linprob.png
+
+The same methods i.e open addressing and linear probing are used to search for an item in a dictionary.
+Assume we want to search for the data item ``33``. The computed hash value will be 2. Looking at slot 2
+reveals ``33``, at this point, we return ``True``. Searching for ``70`` is quite different as there was a
+collision at the time of insertion. Therefore computing the hash value is ``0`` which is currently
+holding ``44``. Instead of simply returning ``False``, we perform a sequential search starting at point
+``1`` until the item ``70`` is found or we encounter a free slot. This is the general way of performing
+look-ups in hashes:
+
+.. code-block:: c
+
+ // not yet found, keep searching in this table
+ pos = (pos + 1) % set->alloc;
+
+ if (pos == start_pos) {
+ // search got back to starting position, so index is not in table
+ if (lookup_kind & MP_MAP_LOOKUP_ADD_IF_NOT_FOUND) {
+ if (avail_slot != NULL) {
+ // there was an available slot, so use that
+ set->used++;
+ *avail_slot = index;
+ return index;
+ } else {
+ // not enough room in table, rehash it
+ mp_set_rehash(set);
+ // restart the search for the new element
+ start_pos = pos = hash % set->alloc;
+ }
+ }
+ } else {
+ return MP_OBJ_NULL;
+ }
diff --git a/components/language/micropython/docs/develop/memorymgt.rst b/components/language/micropython/docs/develop/memorymgt.rst
new file mode 100644
index 00000000..5b1690cc
--- /dev/null
+++ b/components/language/micropython/docs/develop/memorymgt.rst
@@ -0,0 +1,141 @@
+.. _memorymanagement:
+
+Memory Management
+=================
+
+Unlike programming languages such as C/C++, MicroPython hides memory management
+details from the developer by supporting automatic memory management.
+Automatic memory management is a technique used by operating systems or applications to automatically manage
+the allocation and deallocation of memory. This eliminates challenges such as forgetting to
+free the memory allocated to an object. Automatic memory management also avoids the critical issue of using memory
+that is already released. Automatic memory management takes many forms, one of them being
+garbage collection (GC).
+
+The garbage collector usually has two responsibilities;
+
+#. Allocate new objects in available memory.
+#. Free unused memory.
+
+There are many GC algorithms but MicroPython uses the
+`Mark and Sweep `_
+policy for managing memory. This algorithm has a mark phase that traverses the heap marking all
+live objects while the sweep phase goes through the heap reclaiming all unmarked objects.
+
+Garbage collection functionality in MicroPython is available through the ``gc`` built-in
+module:
+
+.. code-block:: bash
+
+ >>> x = 5
+ >>> x
+ 5
+ >>> import gc
+ >>> gc.enable()
+ >>> gc.mem_alloc()
+ 1312
+ >>> gc.mem_free()
+ 2071392
+ >>> gc.collect()
+ 19
+ >>> gc.disable()
+ >>>
+
+Even when ``gc.disable()`` is invoked, collection can be triggered with ``gc.collect()``.
+
+The object model
+----------------
+
+All MicroPython objects are referred to by the ``mp_obj_t`` data type.
+This is usually word-sized (i.e. the same size as a pointer on the target architecture),
+and can be typically 32-bit (STM32, nRF, ESP32, Unix x86) or 64-bit (Unix x64).
+It can also be greater than a word-size for certain object representations, for
+example ``OBJ_REPR_D`` has a 64-bit sized ``mp_obj_t`` on a 32-bit architecture.
+
+An ``mp_obj_t`` represents a MicroPython object, for example an integer, float, type, dict or
+class instance. Some objects, like booleans and small integers, have their value stored directly
+in the ``mp_obj_t`` value and do not require additional memory. Other objects have their value
+store elsewhere in memory (for example on the garbage-collected heap) and their ``mp_obj_t`` contains
+a pointer to that memory. A portion of ``mp_obj_t`` is the tag which tells what type of object it is.
+
+See ``py/mpconfig.h`` for the specific details of the available representations.
+
+**Pointer tagging**
+
+Because pointers are word-aligned, when they are stored in an ``mp_obj_t`` the
+lower bits of this object handle will be zero. For example on a 32-bit architecture
+the lower 2 bits will be zero:
+
+``********|********|********|******00``
+
+These bits are reserved for purposes of storing a tag. The tag stores extra information as
+opposed to introducing a new field to store that information in the object, which may be
+inefficient. In MicroPython the tag tells if we are dealing with a small integer, interned
+(small) string or a concrete object, and different semantics apply to each of these.
+
+For small integers the mapping is this:
+
+``********|********|********|*******1``
+
+Where the asterisks hold the actual integer value. For an interned string or an immediate
+object (e.g. ``True``) the layout of the ``mp_obj_t`` value is, respectively:
+
+``********|********|********|*****010``
+
+``********|********|********|*****110``
+
+While a concrete object that is none of the above takes the form:
+
+``********|********|********|******00``
+
+The stars here correspond to the address of the concrete object in memory.
+
+Allocation of objects
+----------------------
+
+The value of a small integer is stored directly in the ``mp_obj_t`` and will be
+allocated in-place, not on the heap or elsewhere. As such, creation of small
+integers does not affect the heap. Similarly for interned strings that already have
+their textual data stored elsewhere, and immediate values like ``None``, ``False``
+and ``True``.
+
+Everything else which is a concrete object is allocated on the heap and its object structure is such that
+a field is reserved in the object header to store the type of the object.
+
+.. code-block:: bash
+
+ +++++++++++
+ + +
+ + type + object header
+ + +
+ +++++++++++
+ + + object items
+ + +
+ + +
+ +++++++++++
+
+The heap's smallest unit of allocation is a block, which is four machine words in
+size (16 bytes on a 32-bit machine, 32 bytes on a 64-bit machine).
+Another structure also allocated on the heap tracks the allocation of
+objects in each block. This structure is called a *bitmap*.
+
+.. image:: img/bitmap.png
+
+The bitmap tracks whether a block is "free" or "in use" and use two bits to track this state
+for each block.
+
+The mark-sweep garbage collector manages the objects allocated on the heap, and also
+utilises the bitmap to mark objects that are still in use.
+See `py/gc.c `_
+for the full implementation of these details.
+
+**Allocation: heap layout**
+
+The heap is arranged such that it consists of blocks in pools. A block
+can have different properties:
+
+- *ATB(allocation table byte):* If set, then the block is a normal block
+- *FREE:* Free block
+- *HEAD:* Head of a chain of blocks
+- *TAIL:* In the tail of a chain of blocks
+- *MARK :* Marked head block
+- *FTB(finaliser table byte):* If set, then the block has a finaliser
diff --git a/components/language/micropython/docs/develop/natmod.rst b/components/language/micropython/docs/develop/natmod.rst
new file mode 100644
index 00000000..6d15f867
--- /dev/null
+++ b/components/language/micropython/docs/develop/natmod.rst
@@ -0,0 +1,225 @@
+.. _natmod:
+
+Native machine code in .mpy files
+=================================
+
+This section describes how to build and work with .mpy files that contain native
+machine code from a language other than Python. This allows you to
+write code in a language like C, compile and link it into a .mpy file, and then
+import this file like a normal Python module. This can be used for implementing
+functionality which is performance critical, or for including an existing
+library written in another language.
+
+One of the main advantages of using native .mpy files is that native machine code
+can be imported by a script dynamically, without the need to rebuild the main
+MicroPython firmware. This is in contrast to :ref:`cmodules` which also allows
+defining custom modules in C but they must be compiled into the main firmware image.
+
+The focus here is on using C to build native modules, but in principle any
+language which can be compiled to stand-alone machine code can be put into a
+.mpy file.
+
+A native .mpy module is built using the ``mpy_ld.py`` tool, which is found in the
+``tools/`` directory of the project. This tool takes a set of object files
+(.o files) and links them together to create a native .mpy files. It requires
+CPython 3 and the library pyelftools v0.25 or greater.
+
+Supported features and limitations
+----------------------------------
+
+A .mpy file can contain MicroPython bytecode and/or native machine code. If it
+contains native machine code then the .mpy file has a specific architecture
+associated with it. Current supported architectures are (these are the valid
+options for the ``ARCH`` variable, see below):
+
+* ``x86`` (32 bit)
+* ``x64`` (64 bit x86)
+* ``armv6m`` (ARM Thumb, eg Cortex-M0)
+* ``armv7m`` (ARM Thumb 2, eg Cortex-M3)
+* ``armv7emsp`` (ARM Thumb 2, single precision float, eg Cortex-M4F, Cortex-M7)
+* ``armv7emdp`` (ARM Thumb 2, double precision float, eg Cortex-M7)
+* ``xtensa`` (non-windowed, eg ESP8266)
+* ``xtensawin`` (windowed with window size 8, eg ESP32)
+
+When compiling and linking the native .mpy file the architecture must be chosen
+and the corresponding file can only be imported on that architecture. For more
+details about .mpy files see :ref:`mpy_files`.
+
+Native code must be compiled as position independent code (PIC) and use a global
+offset table (GOT), although the details of this varies from architecture to
+architecture. When importing .mpy files with native code the import machinery
+is able to do some basic relocation of the native code. This includes
+relocating text, rodata and BSS sections.
+
+Supported features of the linker and dynamic loader are:
+
+* executable code (text)
+* read-only data (rodata), including strings and constant data (arrays, structs, etc)
+* zeroed data (BSS)
+* pointers in text to text, rodata and BSS
+* pointers in rodata to text, rodata and BSS
+
+The known limitations are:
+
+* data sections are not supported; workaround: use BSS data and initialise the
+ data values explicitly
+
+* static BSS variables are not supported; workaround: use global BSS variables
+
+So, if your C code has writable data, make sure the data is defined globally,
+without an initialiser, and only written to within functions.
+
+Linker limitation: the native module is not linked against the symbol table of the
+full MicroPython firmware. Rather, it is linked against an explicit table of exported
+symbols found in ``mp_fun_table`` (in ``py/nativeglue.h``), that is fixed at firmware
+build time. It is thus not possible to simply call some arbitrary HAL/OS/RTOS/system
+function, for example.
+
+New symbols can be added to the end of the table and the firmware rebuilt.
+The symbols also need to be added to ``tools/mpy_ld.py``'s ``fun_table`` dict in the
+same location. This allows ``mpy_ld.py`` to be able to pick the new symbols up and
+provide relocations for them when the mpy is imported. Finally, if the symbol is a
+function, a macro or stub should be added to ``py/dynruntime.h`` to make it easy to
+call the function.
+
+Defining a native module
+------------------------
+
+A native .mpy module is defined by a set of files that are used to build the .mpy.
+The filesystem layout consists of two main parts, the source files and the Makefile:
+
+* In the simplest case only a single C source file is required, which contains all
+ the code that will be compiled into the .mpy module. This C source code must
+ include the ``py/dynruntime.h`` file to access the MicroPython dynamic API, and
+ must at least define a function called ``mpy_init``. This function will be the
+ entry point of the module, called when the module is imported.
+
+ The module can be split into multiple C source files if desired. Parts of the
+ module can also be implemented in Python. All source files should be listed in
+ the Makefile, by adding them to the ``SRC`` variable (see below). This includes
+ both C source files as well as any Python files which will be included in the
+ resulting .mpy file.
+
+* The ``Makefile`` contains the build configuration for the module and list the
+ source files used to build the .mpy module. It should define ``MPY_DIR`` as the
+ location of the MicroPython repository (to find header files, the relevant Makefile
+ fragment, and the ``mpy_ld.py`` tool), ``MOD`` as the name of the module, ``SRC``
+ as the list of source files, optionally specify the machine architecture via ``ARCH``,
+ and then include ``py/dynruntime.mk``.
+
+Minimal example
+---------------
+
+This section provides a fully working example of a simple module named ``factorial``.
+This module provides a single function ``factorial.factorial(x)`` which computes the
+factorial of the input and returns the result.
+
+Directory layout::
+
+ factorial/
+ ├── factorial.c
+ └── Makefile
+
+The file ``factorial.c`` contains:
+
+.. code-block:: c
+
+ // Include the header file to get access to the MicroPython API
+ #include "py/dynruntime.h"
+
+ // Helper function to compute factorial
+ STATIC mp_int_t factorial_helper(mp_int_t x) {
+ if (x == 0) {
+ return 1;
+ }
+ return x * factorial_helper(x - 1);
+ }
+
+ // This is the function which will be called from Python, as factorial(x)
+ STATIC mp_obj_t factorial(mp_obj_t x_obj) {
+ // Extract the integer from the MicroPython input object
+ mp_int_t x = mp_obj_get_int(x_obj);
+ // Calculate the factorial
+ mp_int_t result = factorial_helper(x);
+ // Convert the result to a MicroPython integer object and return it
+ return mp_obj_new_int(result);
+ }
+ // Define a Python reference to the function above
+ STATIC MP_DEFINE_CONST_FUN_OBJ_1(factorial_obj, factorial);
+
+ // This is the entry point and is called when the module is imported
+ mp_obj_t mpy_init(mp_obj_fun_bc_t *self, size_t n_args, size_t n_kw, mp_obj_t *args) {
+ // This must be first, it sets up the globals dict and other things
+ MP_DYNRUNTIME_INIT_ENTRY
+
+ // Make the function available in the module's namespace
+ mp_store_global(MP_QSTR_factorial, MP_OBJ_FROM_PTR(&factorial_obj));
+
+ // This must be last, it restores the globals dict
+ MP_DYNRUNTIME_INIT_EXIT
+ }
+
+The file ``Makefile`` contains:
+
+.. code-block:: make
+
+ # Location of top-level MicroPython directory
+ MPY_DIR = ../../..
+
+ # Name of module
+ MOD = factorial
+
+ # Source files (.c or .py)
+ SRC = factorial.c
+
+ # Architecture to build for (x86, x64, armv6m, armv7m, xtensa, xtensawin)
+ ARCH = x64
+
+ # Include to get the rules for compiling and linking the module
+ include $(MPY_DIR)/py/dynruntime.mk
+
+Compiling the module
+--------------------
+
+The prerequisite tools needed to build a native .mpy file are:
+
+* The MicroPython repository (at least the ``py/`` and ``tools/`` directories).
+* CPython 3, and the library pyelftools (eg ``pip install 'pyelftools>=0.25'``).
+* GNU make.
+* A C compiler for the target architecture (if C source is used).
+* Optionally ``mpy-cross``, built from the MicroPython repository (if .py source is used).
+
+Be sure to select the correct ``ARCH`` for the target you are going to run on.
+Then build with::
+
+ $ make
+
+Without modifying the Makefile you can specify the target architecture via::
+
+ $ make ARCH=armv7m
+
+Module usage in MicroPython
+---------------------------
+
+Once the module is built there should be a file called ``factorial.mpy``. Copy
+this so it is accessible on the filesystem of your MicroPython system and can be
+found in the import path. The module can now be accessed in Python just like any
+other module, for example::
+
+ import factorial
+ print(factorial.factorial(10))
+ # should display 3628800
+
+Further examples
+----------------
+
+See ``examples/natmod/`` for further examples which show many of the available
+features of native .mpy modules. Such features include:
+
+* using multiple C source files
+* including Python code alongside C code
+* rodata and BSS data
+* memory allocation
+* use of floating point
+* exception handling
+* including external C libraries
diff --git a/components/language/micropython/docs/develop/optimizations.rst b/components/language/micropython/docs/develop/optimizations.rst
new file mode 100644
index 00000000..d972cde6
--- /dev/null
+++ b/components/language/micropython/docs/develop/optimizations.rst
@@ -0,0 +1,72 @@
+.. _optimizations:
+
+Optimizations
+=============
+
+MicroPython uses several optimizations to save RAM but also ensure the efficient
+execution of programs. This chapter discusses some of these optimizations.
+
+.. note::
+ :ref:`qstr` and :ref:`maps` details other optimizations on strings and
+ dictionaries.
+
+Frozen bytecode
+---------------
+
+When MicroPython loads Python code from the filesystem, it first has to parse the file into
+a temporary in-memory representation, and then generate bytecode for execution, both of which
+are stored in the heap (in RAM). This can lead to significant amounts of memory being used.
+The MicroPython cross compiler can be used to generate
+a ``.mpy`` file, containing the pre-compiled bytecode for a Python module. This will still
+be loaded into RAM, but it avoids the additional overhead of the parsing stage.
+
+As a further optimisation, the pre-compiled bytecode from a ``.mpy`` file can be "frozen"
+into the firmware image as part of the main firmware compilation process, which means that
+the bytecode will be executed from ROM. This can lead to a significant memory saving, and
+reduce heap fragmentation.
+
+Variables
+---------
+
+MicroPython processes local and global variables differently. Global variables
+are stored and looked up from a global dictionary that is allocated on the heap
+(note that each module has its own separate dict, so separate namespace).
+Local variables on the other hand are are stored on the Python value stack, which may
+live on the C stack or on the heap. They are accessed directly by their offset
+within the Python stack, which is more efficient than a global lookup in a dict.
+
+The length of global variable names also affects how much RAM is used as identifiers
+are stored in RAM. The shorter the identifier, the less memory is used.
+
+The other aspect is that ``const`` variables that start with an underscore are treated as
+proper constants and are not allocated or added in a dictionary, hence saving some memory.
+These variables use ``const()`` from the MicroPython library. Therefore:
+
+.. code-block:: python
+
+ from micropython import const
+
+ X = const(1)
+ _Y = const(2)
+ foo(X, _Y)
+
+Compiles to:
+
+.. code-block:: python
+
+ X = 1
+ foo(1, 2)
+
+Allocation of memory
+--------------------
+
+Most of the common MicroPython constructs are not allocated on the heap.
+However the following are:
+
+- Dynamic data structures like lists, mappings, etc;
+- Functions, classes and object instances;
+- imports; and
+- First-time assignment of global variables (to create the slot in the global dict).
+
+For a detailed discussion on a more user-centric perspective on optimization,
+see `Maximising MicroPython speed `_
diff --git a/components/language/micropython/docs/develop/porting.rst b/components/language/micropython/docs/develop/porting.rst
new file mode 100644
index 00000000..bc25f47e
--- /dev/null
+++ b/components/language/micropython/docs/develop/porting.rst
@@ -0,0 +1,306 @@
+.. _porting_to_a_board:
+
+Porting MicroPython
+===================
+
+The MicroPython project contains several ports to different microcontroller families and
+architectures. The project repository has a `ports `_
+directory containing a subdirectory for each supported port.
+
+A port will typically contain definitions for multiple "boards", each of which is a specific piece of
+hardware that that port can run on, e.g. a development kit or device.
+
+The `minimal port `_ is
+available as a simplified reference implementation of a MicroPython port. It can run on both the
+host system and an STM32F4xx MCU.
+
+In general, starting a port requires:
+
+- Setting up the toolchain (configuring Makefiles, etc).
+- Implementing boot configuration and CPU initialization.
+- Initialising basic drivers required for development and debugging (e.g. GPIO, UART).
+- Performing the board-specific configurations.
+- Implementing the port-specific modules.
+
+Minimal MicroPython firmware
+----------------------------
+
+The best way to start porting MicroPython to a new board is by integrating a minimal
+MicroPython interpreter. For this walkthrough, create a subdirectory for the new
+port in the ``ports`` directory:
+
+.. code-block:: bash
+
+ $ cd ports
+ $ mkdir example_port
+
+The basic MicroPython firmware is implemented in the main port file, e.g ``main.c``:
+
+.. code-block:: c
+
+ #include "py/compile.h"
+ #include "py/gc.h"
+ #include "py/mperrno.h"
+ #include "py/stackctrl.h"
+ #include "shared/runtime/gchelper.h"
+ #include "shared/runtime/pyexec.h"
+
+ // Allocate memory for the MicroPython GC heap.
+ static char heap[4096];
+
+ int main(int argc, char **argv) {
+ // Initialise the MicroPython runtime.
+ mp_stack_ctrl_init();
+ gc_init(heap, heap + sizeof(heap));
+ mp_init();
+
+ // Start a normal REPL; will exit when ctrl-D is entered on a blank line.
+ pyexec_friendly_repl();
+
+ // Deinitialise the runtime.
+ gc_sweep_all();
+ mp_deinit();
+ return 0;
+ }
+
+ // Handle uncaught exceptions (should never be reached in a correct C implementation).
+ void nlr_jump_fail(void *val) {
+ for (;;) {
+ }
+ }
+
+ // Do a garbage collection cycle.
+ void gc_collect(void) {
+ gc_collect_start();
+ gc_helper_collect_regs_and_stack();
+ gc_collect_end();
+ }
+
+ // There is no filesystem so stat'ing returns nothing.
+ mp_import_stat_t mp_import_stat(const char *path) {
+ return MP_IMPORT_STAT_NO_EXIST;
+ }
+
+ // There is no filesystem so opening a file raises an exception.
+ mp_lexer_t *mp_lexer_new_from_file(const char *filename) {
+ mp_raise_OSError(MP_ENOENT);
+ }
+
+We also need a Makefile at this point for the port:
+
+.. code-block:: Makefile
+
+ # Include the core environment definitions; this will set $(TOP).
+ include ../../py/mkenv.mk
+
+ # Include py core make definitions.
+ include $(TOP)/py/py.mk
+
+ # Set CFLAGS and libraries.
+ CFLAGS = -I. -I$(BUILD) -I$(TOP)
+ LIBS = -lm
+
+ # Define the required source files.
+ SRC_C = \
+ main.c \
+ mphalport.c \
+ shared/readline/readline.c \
+ shared/runtime/gchelper_generic.c \
+ shared/runtime/pyexec.c \
+ shared/runtime/stdout_helpers.c \
+
+ # Define the required object files.
+ OBJ = $(PY_CORE_O) $(addprefix $(BUILD)/, $(SRC_C:.c=.o))
+
+ # Define the top-level target, the main firmware.
+ all: $(BUILD)/firmware.elf
+
+ # Define how to build the firmware.
+ $(BUILD)/firmware.elf: $(OBJ)
+ $(ECHO) "LINK $@"
+ $(Q)$(CC) $(LDFLAGS) -o $@ $^ $(LIBS)
+ $(Q)$(SIZE) $@
+
+ # Include remaining core make rules.
+ include $(TOP)/py/mkrules.mk
+
+Remember to use proper tabs to indent the Makefile.
+
+MicroPython Configurations
+--------------------------
+
+After integrating the minimal code above, the next step is to create the MicroPython
+configuration files for the port. The compile-time configurations are specified in
+``mpconfigport.h`` and additional hardware-abstraction functions, such as time keeping,
+in ``mphalport.h``.
+
+The following is an example of an ``mpconfigport.h`` file:
+
+.. code-block:: c
+
+ #include
+
+ // Python internal features.
+ #define MICROPY_ENABLE_GC (1)
+ #define MICROPY_HELPER_REPL (1)
+ #define MICROPY_ERROR_REPORTING (MICROPY_ERROR_REPORTING_TERSE)
+ #define MICROPY_FLOAT_IMPL (MICROPY_FLOAT_IMPL_FLOAT)
+
+ // Enable u-modules to be imported with their standard name, like sys.
+ #define MICROPY_MODULE_WEAK_LINKS (1)
+
+ // Fine control over Python builtins, classes, modules, etc.
+ #define MICROPY_PY_ASYNC_AWAIT (0)
+ #define MICROPY_PY_BUILTINS_SET (0)
+ #define MICROPY_PY_ATTRTUPLE (0)
+ #define MICROPY_PY_COLLECTIONS (0)
+ #define MICROPY_PY_MATH (0)
+ #define MICROPY_PY_IO (0)
+ #define MICROPY_PY_STRUCT (0)
+
+ // Type definitions for the specific machine.
+
+ typedef intptr_t mp_int_t; // must be pointer size
+ typedef uintptr_t mp_uint_t; // must be pointer size
+ typedef long mp_off_t;
+
+ // We need to provide a declaration/definition of alloca().
+ #include
+
+ // Define the port's name and hardware.
+ #define MICROPY_HW_BOARD_NAME "example-board"
+ #define MICROPY_HW_MCU_NAME "unknown-cpu"
+
+ #define MP_STATE_PORT MP_STATE_VM
+
+ #define MICROPY_PORT_ROOT_POINTERS \
+ const char *readline_hist[8];
+
+This configuration file contains machine-specific configurations including aspects like if different
+MicroPython features should be enabled e.g. ``#define MICROPY_ENABLE_GC (1)``. Making this Setting
+``(0)`` disables the feature.
+
+Other configurations include type definitions, root pointers, board name, microcontroller name
+etc.
+
+Similarly, an minimal example ``mphalport.h`` file looks like this:
+
+.. code-block:: c
+
+ static inline void mp_hal_set_interrupt_char(char c) {}
+
+Support for standard input/output
+---------------------------------
+
+MicroPython requires at least a way to output characters, and to have a REPL it also
+requires a way to input characters. Functions for this can be implemented in the file
+``mphalport.c``, for example:
+
+.. code-block:: c
+
+ #include
+ #include "py/mpconfig.h"
+
+ // Receive single character, blocking until one is available.
+ int mp_hal_stdin_rx_chr(void) {
+ unsigned char c = 0;
+ int r = read(STDIN_FILENO, &c, 1);
+ (void)r;
+ return c;
+ }
+
+ // Send the string of given length.
+ void mp_hal_stdout_tx_strn(const char *str, mp_uint_t len) {
+ int r = write(STDOUT_FILENO, str, len);
+ (void)r;
+ }
+
+These input and output functions have to be modified depending on the
+specific board API. This example uses the standard input/output stream.
+
+Building and running
+--------------------
+
+At this stage the directory of the new port should contain::
+
+ ports/example_port/
+ ├── main.c
+ ├── Makefile
+ ├── mpconfigport.h
+ ├── mphalport.c
+ └── mphalport.h
+
+The port can now be built by running ``make`` (or otherwise, depending on your system).
+
+If you are using the default compiler settings in the Makefile given above then this
+will create an executable called ``build/firmware.elf`` which can be executed directly.
+To get a functional REPL you may need to first configure the terminal to raw mode:
+
+.. code-block:: bash
+
+ $ stty raw opost -echo
+ $ ./build/firmware.elf
+
+That should give a MicroPython REPL. You can then run commands like:
+
+.. code-block:: bash
+
+ MicroPython v1.13 on 2021-01-01; example-board with unknown-cpu
+ >>> import sys
+ >>> sys.implementation
+ ('micropython', (1, 13, 0))
+ >>>
+
+Use Ctrl-D to exit, and then run ``reset`` to reset the terminal.
+
+Adding a module to the port
+---------------------------
+
+To add a custom module like ``myport``, first add the module definition in a file
+``modmyport.c``:
+
+.. code-block:: c
+
+ #include "py/runtime.h"
+
+ STATIC mp_obj_t myport_info(void) {
+ mp_printf(&mp_plat_print, "info about my port\n");
+ return mp_const_none;
+ }
+ STATIC MP_DEFINE_CONST_FUN_OBJ_0(myport_info_obj, myport_info);
+
+ STATIC const mp_rom_map_elem_t myport_module_globals_table[] = {
+ { MP_OBJ_NEW_QSTR(MP_QSTR___name__), MP_OBJ_NEW_QSTR(MP_QSTR_myport) },
+ { MP_ROM_QSTR(MP_QSTR_info), MP_ROM_PTR(&myport_info_obj) },
+ };
+ STATIC MP_DEFINE_CONST_DICT(myport_module_globals, myport_module_globals_table);
+
+ const mp_obj_module_t myport_module = {
+ .base = { &mp_type_module },
+ .globals = (mp_obj_dict_t *)&myport_module_globals,
+ };
+
+ MP_REGISTER_MODULE(MP_QSTR_myport, myport_module);
+
+You will also need to edit the Makefile to add ``modmyport.c`` to the ``SRC_C`` list, and
+a new line adding the same file to ``SRC_QSTR`` (so qstrs are searched for in this new file),
+like this:
+
+.. code-block:: Makefile
+
+ SRC_C = \
+ main.c \
+ modmyport.c \
+ mphalport.c \
+ ...
+
+ SRC_QSTR += modmyport.c
+
+If all went correctly then, after rebuilding, you should be able to import the new module:
+
+.. code-block:: bash
+
+ >>> import myport
+ >>> myport.info()
+ info about my port
+ >>>
diff --git a/components/language/micropython/docs/develop/publiccapi.rst b/components/language/micropython/docs/develop/publiccapi.rst
new file mode 100644
index 00000000..132c7b13
--- /dev/null
+++ b/components/language/micropython/docs/develop/publiccapi.rst
@@ -0,0 +1,25 @@
+.. _publiccapi:
+
+The public C API
+================
+
+The public C-API comprises functions defined in all C header files in the ``py/``
+directory. Most of the important core runtime C APIs are exposed in ``runtime.h`` and
+``obj.h``.
+
+The following is an example of public API functions from ``obj.h``:
+
+.. code-block:: c
+
+ mp_obj_t mp_obj_new_list(size_t n, mp_obj_t *items);
+ mp_obj_t mp_obj_list_append(mp_obj_t self_in, mp_obj_t arg);
+ mp_obj_t mp_obj_list_remove(mp_obj_t self_in, mp_obj_t value);
+ void mp_obj_list_get(mp_obj_t self_in, size_t *len, mp_obj_t **items);
+
+At its core, any functions and macros in header files make up the public
+API and can be used to access very low-level details of MicroPython. Static
+inline functions in header files are fine too, such functions will be
+inlined in the code when used.
+
+Header files in the ``ports`` directory are only exposed to the functionality
+specific to a given port.
diff --git a/components/language/micropython/docs/develop/qstr.rst b/components/language/micropython/docs/develop/qstr.rst
new file mode 100644
index 00000000..5d1ac5bb
--- /dev/null
+++ b/components/language/micropython/docs/develop/qstr.rst
@@ -0,0 +1,115 @@
+.. _qstr:
+
+MicroPython string interning
+============================
+
+MicroPython uses `string interning`_ to save both RAM and ROM. This avoids
+having to store duplicate copies of the same string. Primarily, this applies to
+identifiers in your code, as something like a function or variable name is very
+likely to appear in multiple places in the code. In MicroPython an interned
+string is called a QSTR (uniQue STRing).
+
+A QSTR value (with type ``qstr``) is a index into a linked list of QSTR pools.
+QSTRs store their length and a hash of their contents for fast comparison during
+the de-duplication process. All bytecode operations that work with strings use
+a QSTR argument.
+
+Compile-time QSTR generation
+----------------------------
+
+In the MicroPython C code, any strings that should be interned in the final
+firmware are written as ``MP_QSTR_Foo``. At compile time this will evaluate to
+a ``qstr`` value that points to the index of ``"Foo"`` in the QSTR pool.
+
+A multi-step process in the ``Makefile`` makes this work. In summary this
+process has three parts:
+
+1. Find all ``MP_QSTR_Foo`` tokens in the code.
+
+2. Generate a static QSTR pool containing all the string data (including lengths
+ and hashes).
+
+3. Replace all ``MP_QSTR_Foo`` (via the preprocessor) with their corresponding
+ index.
+
+``MP_QSTR_Foo`` tokens are searched for in two sources:
+
+1. All files referenced in ``$(SRC_QSTR)``. This is all C code (i.e. ``py``,
+ ``extmod``, ``ports/stm32``) but not including third-party code such as
+ ``lib``.
+
+2. Additional ``$(QSTR_GLOBAL_DEPENDENCIES)`` (which includes ``mpconfig*.h``).
+
+*Note:* ``frozen_mpy.c`` (generated by mpy-tool.py) has its own QSTR generation
+and pool.
+
+Some additional strings that can't be expressed using the ``MP_QSTR_Foo`` syntax
+(e.g. they contain non-alphanumeric characters) are explicitly provided in
+``qstrdefs.h`` and ``qstrdefsport.h`` via the ``$(QSTR_DEFS)`` variable.
+
+Processing happens in the following stages:
+
+1. ``qstr.i.last`` is the concatenation of putting every single input file
+ through the C pre-processor. This means that any conditionally disabled code
+ will be removed, and macros expanded. This means we don't add strings to the
+ pool that won't be used in the final firmware. Because at this stage (thanks
+ to the ``NO_QSTR`` macro added by ``QSTR_GEN_CFLAGS``) there is no
+ definition for ``MP_QSTR_Foo`` it passes through this stage unaffected. This
+ file also includes comments from the preprocessor that include line number
+ information. Note that this step only uses files that have changed, which
+ means that ``qstr.i.last`` will only contain data from files that have
+ changed since the last compile.
+
+2. ``qstr.split`` is an empty file created after running ``makeqstrdefs.py split``
+ on qstr.i.last. It's just used as a dependency to indicate that the step ran.
+ This script outputs one file per input C file, ``genhdr/qstr/...file.c.qstr``,
+ which contains only the matched QSTRs. Each QSTR is printed as ``Q(Foo)``.
+ This step is necessary to combine the existing files with the new data
+ generated from the incremental update in ``qstr.i.last``.
+
+3. ``qstrdefs.collected.h`` is the output of concatenating ``genhdr/qstr/*``
+ using ``makeqstrdefs.py cat``. This is now the full set of ``MP_QSTR_Foo``'s
+ found in the code, now formatted as ``Q(Foo)``, one-per-line, with duplicates.
+ This file is only updated if the set of qstrs has changed. A hash of the QSTR
+ data is written to another file (``qstrdefs.collected.h.hash``) which allows
+ it to track changes across builds.
+
+4. Generate an enumeration, each entry of which maps a ``MP_QSTR_Foo`` to it's corresponding index.
+ It concatenates ``qstrdefs.collected.h`` with ``qstrdefs*.h``, then it transforms
+ each line from ``Q(Foo)`` to ``"Q(Foo)"`` so they pass through the preprocessor
+ unchanged. Then the preprocessor is used to deal with any conditional
+ compilation in ``qstrdefs*.h``. Then the transformation is undone back to
+ ``Q(Foo)``, and saved as ``qstrdefs.preprocessed.h``.
+
+5. ``qstrdefs.generated.h`` is the output of ``makeqstrdata.py``. For each
+ ``Q(Foo)`` in qstrdefs.preprocessed.h (plus some extra hard-coded ones), it outputs
+ ``QDEF(MP_QSTR_Foo, (const byte*)"hash" "Foo")``.
+
+Then in the main compile, two things happen with ``qstrdefs.generated.h``:
+
+1. In qstr.h, each QDEF becomes an entry in an enum, which makes ``MP_QSTR_Foo``
+ available to code and equal to the index of that string in the QSTR table.
+
+2. In qstr.c, the actual QSTR data table is generated as elements of the
+ ``mp_qstr_const_pool->qstrs``.
+
+.. _`string interning`: https://en.wikipedia.org/wiki/String_interning
+
+Run-time QSTR generation
+------------------------
+
+Additional QSTR pools can be created at runtime so that strings can be added to
+them. For example, the code::
+
+ foo[x] = 3
+
+Will need to create a QSTR for the value of ``x`` so it can be used by the
+"load attr" bytecode.
+
+Also, when compiling Python code, identifiers and literals need to have QSTRs
+created. Note: only literals shorter than 10 characters become QSTRs. This is
+because a regular string on the heap always takes up a minimum of 16 bytes (one
+GC block), whereas QSTRs allow them to be packed more efficiently into the pool.
+
+QSTR pools (and the underlying "chunks" that store the string data) are allocated
+on-demand on the heap with a minimum size.
diff --git a/components/language/micropython/docs/develop/writingtests.rst b/components/language/micropython/docs/develop/writingtests.rst
new file mode 100644
index 00000000..9bb5178f
--- /dev/null
+++ b/components/language/micropython/docs/develop/writingtests.rst
@@ -0,0 +1,70 @@
+.. _writingtests:
+
+Writing tests
+=============
+
+Tests in MicroPython are located at the path ``tests/``. The following is a listing of
+key directories and the run-tests.py runner script:
+
+.. code-block:: bash
+
+ .
+ ├── basics
+ ├── extmod
+ ├── float
+ ├── micropython
+ ├── run-tests.py
+ ...
+
+There are subfolders maintained to categorize the tests. Add a test by creating a new file in one of the
+existing folders or in a new folder. It's also possible to make custom tests outside this tests folder,
+which would be recommended for a custom port.
+
+For example, add the following code in a file ``print.py`` in the ``tests/unix/`` subdirectory:
+
+.. code-block:: python
+
+ def print_one():
+ print(1)
+
+ print_one()
+
+If you run your tests, this test should appear in the test output:
+
+.. code-block:: bash
+
+ $ cd ports/unix
+ $ make tests
+ skip unix/extra_coverage.py
+ pass unix/ffi_callback.py
+ pass unix/ffi_float.py
+ pass unix/ffi_float2.py
+ pass unix/print.py
+ pass unix/time.py
+ pass unix/time2.py
+
+Tests are run by comparing the output from the test target against the output from CPython.
+So any test should use print statements to indicate test results.
+
+For tests that can't be compared to CPython (i.e. micropython-specific functionality),
+you can provide a ``.py.exp`` file which will be used as the truth for comparison.
+
+The other way to run tests, which is useful when running on targets other than the Unix port, is:
+
+.. code-block:: bash
+
+ $ cd tests
+ $ ./run-tests.py
+
+Then to run on a board:
+
+.. code-block:: bash
+
+ $ ./run-tests.py --target minimal --device /dev/ttyACM0
+
+And to run only a certain set of tests (eg a directory):
+
+.. code-block:: bash
+
+ $ ./run-tests.py -d basics
+ $ ./run-tests.py float/builtin*.py
diff --git a/components/language/micropython/docs/differences/index_template.txt b/components/language/micropython/docs/differences/index_template.txt
new file mode 100644
index 00000000..dbbd7fc0
--- /dev/null
+++ b/components/language/micropython/docs/differences/index_template.txt
@@ -0,0 +1,24 @@
+.. _cpython_diffs:
+
+MicroPython differences from CPython
+====================================
+
+MicroPython implements Python 3.4 and some select features of Python 3.5 and
+above. The sections below describe the current status of these features.
+
+.. toctree::
+
+ ../differences/python_35.rst
+ ../differences/python_36.rst
+ ../differences/python_37.rst
+ ../differences/python_38.rst
+ ../differences/python_39.rst
+
+For the features of Python that are implemented by MicroPython, there are
+sometimes differences in their behaviour compared to standard Python. The
+operations listed in the sections below produce conflicting results in
+MicroPython when compared to standard Python.
+
+.. toctree::
+ :maxdepth: 2
+
diff --git a/components/language/micropython/docs/differences/python_35.rst b/components/language/micropython/docs/differences/python_35.rst
new file mode 100644
index 00000000..94b10b58
--- /dev/null
+++ b/components/language/micropython/docs/differences/python_35.rst
@@ -0,0 +1,181 @@
+.. _python_35:
+
+Python 3.5
+==========
+
+Below is a list of finalised/accepted PEPs for Python 3.5 grouped into their impact to MicroPython.
+
+ +----------------------------------------------------------------------------------------------------------+---------------+
+ | **Extensions to the syntax:** | **Status** |
+ +--------------------------------------------------------+-------------------------------------------------+---------------+
+ | `PEP 448 `_ | additional unpacking generalizations | Partial |
+ +--------------------------------------------------------+-------------------------------------------------+---------------+
+ | `PEP 465 `_ | a new matrix multiplication operator | Completed |
+ +--------------------------------------------------------+-------------------------------------------------+---------------+
+ | `PEP 492 `_ | coroutines with async and await syntax | Completed |
+ +--------------------------------------------------------+-------------------------------------------------+---------------+
+ | **Extensions and changes to runtime:** |
+ +--------------------------------------------------------+-------------------------------------------------+---------------+
+ | `PEP 461 `_ | % formatting for binary strings | Completed |
+ +--------------------------------------------------------+-------------------------------------------------+---------------+
+ | `PEP 475 `_ | retrying system calls that fail with EINTR | Completed |
+ +--------------------------------------------------------+-------------------------------------------------+---------------+
+ | `PEP 479 `_ | change StopIteration handling inside generators | Completed |
+ +--------------------------------------------------------+-------------------------------------------------+---------------+
+ | **Standard library changes:** |
+ +--------------------------------------------------------+-------------------------------------------------+---------------+
+ | `PEP 471 `_ | os.scandir() | |
+ +--------------------------------------------------------+-------------------------------------------------+---------------+
+ | `PEP 485 `_ | math.isclose(), a function for testing | Completed |
+ | | approximate equality | |
+ +--------------------------------------------------------+-------------------------------------------------+---------------+
+ | **Miscellaneous changes:** |
+ +--------------------------------------------------------+-------------------------------------------------+---------------+
+ | `PEP 441 `_ | improved Python zip application support | |
+ +--------------------------------------------------------+-------------------------------------------------+---------------+
+ | `PEP 486 `_ | make the Python Launcher aware of virtual | Not relevant |
+ | | environments | |
+ +--------------------------------------------------------+-------------------------------------------------+---------------+
+ | `PEP 484 `_ | type hints (advisory only) | In Progress |
+ +--------------------------------------------------------+-------------------------------------------------+---------------+
+ | `PEP 488 `_ | elimination of PYO files | Not relevant |
+ +--------------------------------------------------------+-------------------------------------------------+---------------+
+ | `PEP 489 `_ | redesigning extension module loading | |
+ +--------------------------------------------------------+-------------------------------------------------+---------------+
+
+
+Other Language Changes:
+
+ +-----------------------------------------------------------------------------------------------------------+---------------+
+ | Added the *namereplace* error handlers. The *backslashreplace* error handlers now work with decoding and | |
+ | translating. | |
+ +-----------------------------------------------------------------------------------------------------------+---------------+
+ | Property docstrings are now writable. This is especially useful for collections.namedtuple() docstrings | |
+ +-----------------------------------------------------------------------------------------------------------+---------------+
+ | Circular imports involving relative imports are now supported. | |
+ +-----------------------------------------------------------------------------------------------------------+---------------+
+
+
+New Modules:
+
+* `typing `_
+
+* `zipzap `_
+
+
+Changes to built-in modules:
+
+ +-----------------------------------------------------------------------------------------------------------+---------------+
+ | `collections `_ |
+ +-----------------------------------------------------------------------------------------------------------+---------------+
+ | The *OrderedDict* class is now implemented in C, which makes it 4 to 100 times faster. | |
+ +-----------------------------------------------------------------------------------------------------------+---------------+
+ | *OrderedDict.items()* , *OrderedDict.keys()* , *OrderedDict.values()* views now support reversed() | |
+ | iteration. | |
+ +-----------------------------------------------------------------------------------------------------------+---------------+
+ | The deque class now defines *index()*, *insert()*, and *copy()*, and supports the + and * operators. | |
+ +-----------------------------------------------------------------------------------------------------------+---------------+
+ | Docstrings produced by namedtuple() can now be updated. | |
+ +-----------------------------------------------------------------------------------------------------------+---------------+
+ | The UserString class now implements the *__getnewargs__()*, *__rmod__()*, *casefold()*, *format_map()*, | |
+ | *isprintable()*, and *maketrans()* methods to match the corresponding methods of str. | |
+ +-----------------------------------------------------------------------------------------------------------+---------------+
+ | `heapq `_ |
+ +-----------------------------------------------------------------------------------------------------------+---------------+
+ | Element comparison in *merge()* can now be customized by passing a key function in a new optional key | |
+ | keyword argument, and a new optional *reverse* keyword argument can be used to reverse element comparison | |
+ +-----------------------------------------------------------------------------------------------------------+---------------+
+ | `io `_ |
+ +-----------------------------------------------------------------------------------------------------------+---------------+
+ | A new *BufferedIOBase.readinto1()* method, that uses at most one call to the underlying raw stream's | |
+ | *RawIOBase.read()* or *RawIOBase.readinto()* methods | |
+ +-----------------------------------------------------------------------------------------------------------+---------------+
+ | `json `_ | |
+ +-----------------------------------------------------------------------------------------------------------+---------------+
+ | JSON decoder now raises JSONDecodeError instead of ValueError to provide better context information about | |
+ | the error. | |
+ +-----------------------------------------------------------------------------------------------------------+---------------+
+ | `math `_ |
+ +-----------------------------------------------------------------------------------------------------------+---------------+
+ | Two new constants have been added to the math module: *inf* and *nan*. | Completed |
+ +-----------------------------------------------------------------------------------------------------------+---------------+
+ | A new function *isclose()* provides a way to test for approximate equality. | |
+ +-----------------------------------------------------------------------------------------------------------+---------------+
+ | A new *gcd()* function has been added. The *fractions.gcd()* function is now deprecated. | |
+ +-----------------------------------------------------------------------------------------------------------+---------------+
+ | `os `_ |
+ +-----------------------------------------------------------------------------------------------------------+---------------+
+ | The new *scandir()* function returning an iterator of DirEntry objects has been added. | |
+ +-----------------------------------------------------------------------------------------------------------+---------------+
+ | The *urandom()* function now uses the *getrandom()* syscall on Linux 3.17 or newer, and *getentropy()* on | |
+ | OpenBSD 5.6 and newer, removing the need to use /dev/urandom and avoiding failures due to potential file | |
+ | descriptor exhaustion. | |
+ +-----------------------------------------------------------------------------------------------------------+---------------+
+ | New *get_blocking()* and *set_blocking()* functions allow getting and setting a file descriptor's blocking| |
+ | mode (O_NONBLOCK.) | |
+ +-----------------------------------------------------------------------------------------------------------+---------------+
+ | There is a new *os.path.commonpath()* function returning the longest common sub-path of each passed | |
+ | pathname | |
+ +-----------------------------------------------------------------------------------------------------------+---------------+
+ | `re `_ | |
+ +-----------------------------------------------------------------------------------------------------------+---------------+
+ | References and conditional references to groups with fixed length are now allowed in lookbehind assertions| |
+ +-----------------------------------------------------------------------------------------------------------+---------------+
+ | The number of capturing groups in regular expressions is no longer limited to 100. | |
+ +-----------------------------------------------------------------------------------------------------------+---------------+
+ | The *sub()* and *subn()* functions now replace unmatched groups with empty strings instead of raising an | |
+ | exception. | |
+ +-----------------------------------------------------------------------------------------------------------+---------------+
+ | The *re.error* exceptions have new attributes, msg, pattern, pos, lineno, and colno, that provide better | |
+ | context information about the error | |
+ +-----------------------------------------------------------------------------------------------------------+---------------+
+ | `socket `_ |
+ +-----------------------------------------------------------------------------------------------------------+---------------+
+ | Functions with timeouts now use a monotonic clock, instead of a system clock. | |
+ +-----------------------------------------------------------------------------------------------------------+---------------+
+ | A new *socket.sendfile()* method allows sending a file over a socket by using the high-performance | |
+ | *os.sendfile()* function on UNIX, resulting in uploads being from 2 to 3 times faster than when using | |
+ | plain *socket.send()* | |
+ +-----------------------------------------------------------------------------------------------------------+---------------+
+ | The *socket.sendall()* method no longer resets the socket timeout every time bytes are received or sent. | |
+ | The socket timeout is now the maximum total duration to send all data. | |
+ +-----------------------------------------------------------------------------------------------------------+---------------+
+ | The backlog argument of the *socket.listen()* method is now optional. By default it is set to SOMAXCONN or| Completed |
+ | to 128, whichever is less. | |
+ +-----------------------------------------------------------------------------------------------------------+---------------+
+ | `ssl `_ |
+ +-----------------------------------------------------------------------------------------------------------+---------------+
+ | Memory BIO Support | |
+ +-----------------------------------------------------------------------------------------------------------+---------------+
+ | Application-Layer Protocol Negotiation Support | |
+ +-----------------------------------------------------------------------------------------------------------+---------------+
+ | There is a new *SSLSocket.version()* method to query the actual protocol version in use. | |
+ +-----------------------------------------------------------------------------------------------------------+---------------+
+ | The SSLSocket class now implements a *SSLSocket.sendfile()* method. | |
+ +-----------------------------------------------------------------------------------------------------------+---------------+
+ | The *SSLSocket.send()* method now raises either the *ssl.SSLWantReadError* or *ssl.SSLWantWriteError* | |
+ | exception on a non-blocking socket if the operation would block. Previously, it would return 0. | |
+ +-----------------------------------------------------------------------------------------------------------+---------------+
+ | The *cert_time_to_seconds()* function now interprets the input time as UTC and not as local time, per RFC | |
+ | 5280. Additionally, the return value is always an int. | |
+ +-----------------------------------------------------------------------------------------------------------+---------------+
+ | New *SSLObject.shared_ciphers()* and *SSLSocket.shared_ciphers()* methods return the list of ciphers sent | |
+ | by the client during the handshake. | |
+ +-----------------------------------------------------------------------------------------------------------+---------------+
+ | The *SSLSocket.do_handshake()*, *SSLSocket.read()*, *SSLSocket.shutdown()*, and *SSLSocket.write()* | |
+ | methods of the SSLSocket class no longer reset the socket timeout every time bytes are received or sent. | |
+ +-----------------------------------------------------------------------------------------------------------+---------------+
+ | The *match_hostname()* function now supports matching of IP addresses. | |
+ +-----------------------------------------------------------------------------------------------------------+---------------+
+ | `sys `_ |
+ +-----------------------------------------------------------------------------------------------------------+---------------+
+ | A new *set_coroutine_wrapper()* function allows setting a global hook that will be called whenever a | |
+ | coroutine object is created by an async def function. A corresponding *get_coroutine_wrapper()* can be | |
+ | used to obtain a currently set wrapper. | |
+ +-----------------------------------------------------------------------------------------------------------+---------------+
+ | A new *is_finalizing()* function can be used to check if the Python interpreter is shutting down. | |
+ +-----------------------------------------------------------------------------------------------------------+---------------+
+ | `time `_ |
+ +-----------------------------------------------------------------------------------------------------------+---------------+
+ | The *monotonic()* function is now always available | |
+ +-----------------------------------------------------------------------------------------------------------+---------------+
diff --git a/components/language/micropython/docs/differences/python_36.rst b/components/language/micropython/docs/differences/python_36.rst
new file mode 100644
index 00000000..edf6bef0
--- /dev/null
+++ b/components/language/micropython/docs/differences/python_36.rst
@@ -0,0 +1,191 @@
+.. _python_36:
+
+Python 3.6
+==========
+
+Python 3.6 beta 1 was released on 12 Sep 2016, and a summary of the new features can be found here:
+
+ +-----------------------------------------------------------------------------------------------------------+--------------+
+ | **New Syntax Features:** | **Status** |
+ +--------------------------------------------------------+--------------------------------------------------+--------------+
+ | `PEP 498 `_ | Literal String Formatting | |
+ +--------------------------------------------------------+--------------------------------------------------+--------------+
+ | `PEP 515 `_ | Underscores in Numeric Literals | |
+ +--------------------------------------------------------+--------------------------------------------------+--------------+
+ | `PEP 525 `_ | Asynchronous Generators | |
+ +--------------------------------------------------------+--------------------------------------------------+--------------+
+ | `PEP 526 `_ | Syntax for Variable Annotations (provisional) | |
+ +--------------------------------------------------------+--------------------------------------------------+--------------+
+ | `PEP 530 `_ | Asynchronous Comprehensions | |
+ +--------------------------------------------------------+--------------------------------------------------+--------------+
+ | **New Built-in Features:** |
+ +--------------------------------------------------------+--------------------------------------------------+--------------+
+ | `PEP 468 `_ | Preserving the order of *kwargs* in a function | |
+ +--------------------------------------------------------+--------------------------------------------------+--------------+
+ | `PEP 487 `_ | Simpler customization of class creation | |
+ +--------------------------------------------------------+--------------------------------------------------+--------------+
+ | `PEP 520 `_ | Preserving Class Attribute Definition Order | |
+ +--------------------------------------------------------+--------------------------------------------------+--------------+
+ | **Standard Library Changes:** |
+ +--------------------------------------------------------+--------------------------------------------------+--------------+
+ | `PEP 495 `_ | Local Time Disambiguation | |
+ +--------------------------------------------------------+--------------------------------------------------+--------------+
+ | `PEP 506 `_ | Adding A Secrets Module To The Standard Library | |
+ +--------------------------------------------------------+--------------------------------------------------+--------------+
+ | `PEP 519 `_ | Adding a file system path protocol | |
+ +--------------------------------------------------------+--------------------------------------------------+--------------+
+ | **CPython internals:** |
+ +--------------------------------------------------------+--------------------------------------------------+--------------+
+ | `PEP 509 `_ | Add a private version to dict | |
+ +--------------------------------------------------------+--------------------------------------------------+--------------+
+ | `PEP 523 `_ | Adding a frame evaluation API to CPython | |
+ +--------------------------------------------------------+--------------------------------------------------+--------------+
+ | **Linux/Window Changes** |
+ +--------------------------------------------------------+--------------------------------------------------+--------------+
+ | `PEP 524 `_ | Make os.urandom() blocking on Linux | |
+ | | (during system startup) | |
+ +--------------------------------------------------------+--------------------------------------------------+--------------+
+ | `PEP 528 `_ | Change Windows console encoding to UTF-8 | |
+ +--------------------------------------------------------+--------------------------------------------------+--------------+
+ | `PEP 529 `_ | Change Windows filesystem encoding to UTF-8 | |
+ +--------------------------------------------------------+--------------------------------------------------+--------------+
+
+Other Language Changes:
+
+ +-------------------------------------------------------------------------------------------------------------+---------------+
+ | A *global* or *nonlocal* statement must now textually appear before the first use of the affected name in | |
+ | the same scope. Previously this was a SyntaxWarning. | |
+ +-------------------------------------------------------------------------------------------------------------+---------------+
+ | It is now possible to set a special method to None to indicate that the corresponding operation is not | |
+ | available. For example, if a class sets *__iter__()* to *None* , the class is not iterable. | |
+ +-------------------------------------------------------------------------------------------------------------+---------------+
+ | Long sequences of repeated traceback lines are now abbreviated as *[Previous line repeated {count} more | |
+ | times]* | |
+ +-------------------------------------------------------------------------------------------------------------+---------------+
+ | Import now raises the new exception *ModuleNotFoundError* when it cannot find a module. Code that currently | |
+ | checks for ImportError (in try-except) will still work. | |
+ +-------------------------------------------------------------------------------------------------------------+---------------+
+ | Class methods relying on zero-argument *super()* will now work correctly when called from metaclass methods | |
+ | during class creation. | |
+ +-------------------------------------------------------------------------------------------------------------+---------------+
+
+Changes to built-in modules:
+
+ +--------------------------------------------------------------------------------------------------------------+----------------+
+ | `array `_ | |
+ +--------------------------------------------------------------------------------------------------------------+----------------+
+ | Exhausted iterators of *array.array* will now stay exhausted even if the iterated array is extended. | |
+ +--------------------------------------------------------------------------------------------------------------+----------------+
+ | `binascii `_ | |
+ +--------------------------------------------------------------------------------------------------------------+----------------+
+ | The b2a_base64() function now accepts an optional newline keyword argument to control whether the newline | Completed |
+ | character is appended to the return value | |
+ +--------------------------------------------------------------------------------------------------------------+----------------+
+ | `cmath `_ | |
+ +--------------------------------------------------------------------------------------------------------------+----------------+
+ | The new cmath.tau (τ) constant has been added | |
+ +--------------------------------------------------------------------------------------------------------------+----------------+
+ | New constants: *cmath.inf* and *cmath.nan* to match *math.inf* and *math.nan* , and also *cmath.infj* and | |
+ | *cmath.nanj* to match the format used by complex repr | |
+ +--------------------------------------------------------------------------------------------------------------+----------------+
+ | `collections `_ |
+ +--------------------------------------------------------------------------------------------------------------+----------------+
+ | The new Collection abstract base class has been added to represent sized iterable container classes | |
+ +--------------------------------------------------------------------------------------------------------------+----------------+
+ | The new *Reversible* abstract base class represents iterable classes that also provide the *__reversed__()* | |
+ | method. | |
+ +--------------------------------------------------------------------------------------------------------------+----------------+
+ | The new *AsyncGenerator* abstract base class represents asynchronous generators. | |
+ +--------------------------------------------------------------------------------------------------------------+----------------+
+ | The *namedtuple()* function now accepts an optional keyword argument module, which, when specified, is used | |
+ | for the *__module__* attribute of the returned named tuple class. | |
+ +--------------------------------------------------------------------------------------------------------------+----------------+
+ | The verbose and rename arguments for *namedtuple()* are now keyword-only. | |
+ +--------------------------------------------------------------------------------------------------------------+----------------+
+ | Recursive *collections.deque* instances can now be pickled. | |
+ +--------------------------------------------------------------------------------------------------------------+----------------+
+ | `hashlib `_ |
+ +--------------------------------------------------------------------------------------------------------------+----------------+
+ | BLAKE2 hash functions were added to the module. *blake2b()* and *blake2s()* are always available and support | |
+ | the full feature set of BLAKE2. | |
+ +--------------------------------------------------------------------------------------------------------------+----------------+
+ | The SHA-3 hash functions *sha3_224()*, *sha3_256()*, *sha3_384()*, *sha3_512()*, and *SHAKE* hash functions | |
+ | *shake_128()* and *shake_256()* were added. | |
+ +--------------------------------------------------------------------------------------------------------------+----------------+
+ | The password-based key derivation function *scrypt()* is now available with OpenSSL 1.1.0 and newer. | |
+ +--------------------------------------------------------------------------------------------------------------+----------------+
+ | `json `_ |
+ +--------------------------------------------------------------------------------------------------------------+----------------+
+ | *json.load()* and *json.loads()* now support binary input. Encoded JSON should be represented using either | |
+ | UTF-8, UTF-16, or UTF-32. | |
+ +--------------------------------------------------------------------------------------------------------------+----------------+
+ | `math `_ |
+ +--------------------------------------------------------------------------------------------------------------+----------------+
+ | The new math.tau (τ) constant has been added | Completed |
+ +--------------------------------------------------------------------------------------------------------------+----------------+
+ | `os `_ |
+ +--------------------------------------------------------------------------------------------------------------+----------------+
+ | A new *close()* method allows explicitly closing a *scandir()* iterator. The *scandir()* iterator now | |
+ | supports the context manager protocol. | |
+ +--------------------------------------------------------------------------------------------------------------+----------------+
+ | On Linux, *os.urandom()* now blocks until the system urandom entropy pool is initialized to increase the | |
+ | security. | |
+ +--------------------------------------------------------------------------------------------------------------+----------------+
+ | The Linux *getrandom()* syscall (get random bytes) is now exposed as the new *os.getrandom()* function. | |
+ +--------------------------------------------------------------------------------------------------------------+----------------+
+ | `re `_ |
+ +--------------------------------------------------------------------------------------------------------------+----------------+
+ | Added support of modifier spans in regular expressions. Examples: *'(?i:p)ython'* matches 'python' and | |
+ | 'Python', but not 'PYTHON'; *'(?i)g(?-i:v)r'* matches *'GvR'* and *'gvr'*, but not *'GVR'* . | |
+ +--------------------------------------------------------------------------------------------------------------+----------------+
+ | Match object groups can be accessed by *__getitem__*, which is equivalent to *group()*. So *mo['name']* is | |
+ | now equivalent to *mo.group('name')*. | |
+ +--------------------------------------------------------------------------------------------------------------+----------------+
+ | Match objects now support index-like objects as group indices. | |
+ +--------------------------------------------------------------------------------------------------------------+----------------+
+ | `socket `_ |
+ +--------------------------------------------------------------------------------------------------------------+----------------+
+ | The *ioctl()* function now supports the *SIO_LOOPBACK_FAST_PATH* control code. | |
+ +--------------------------------------------------------------------------------------------------------------+----------------+
+ | The *getsockopt()* constants *SO_DOMAIN* , *SO_PROTOCOL*, *SO_PEERSEC* , and *SO_PASSSEC* are now supported. | |
+ +--------------------------------------------------------------------------------------------------------------+----------------+
+ | The *setsockopt()* now supports the *setsockopt(level, optname, None, optlen: int)* form. | |
+ +--------------------------------------------------------------------------------------------------------------+----------------+
+ | The socket module now supports the address family *AF_ALG* to interface with Linux Kernel crypto API. | |
+ | *ALG_*, *SOL_ALG* and *sendmsg_afalg()* were added. | |
+ +--------------------------------------------------------------------------------------------------------------+----------------+
+ | New Linux constants *TCP_USER_TIMEOUT* and *TCP_CONGESTION* were added. | |
+ +--------------------------------------------------------------------------------------------------------------+----------------+
+ | `ssl `_ |
+ +--------------------------------------------------------------------------------------------------------------+----------------+
+ | ssl supports OpenSSL 1.1.0. The minimum recommend version is 1.0.2. | |
+ +--------------------------------------------------------------------------------------------------------------+----------------+
+ | 3DES has been removed from the default cipher suites and ChaCha20 Poly1305 cipher suites have been added. | |
+ +--------------------------------------------------------------------------------------------------------------+----------------+
+ | *SSLContext* has better default configuration for options and ciphers. | |
+ +--------------------------------------------------------------------------------------------------------------+----------------+
+ | SSL session can be copied from one client-side connection to another with the new *SSLSession* class. TLS | |
+ | session resumption can speed up the initial handshake, reduce latency and improve performance. | |
+ +--------------------------------------------------------------------------------------------------------------+----------------+
+ | The new *get_ciphers()* method can be used to get a list of enabled ciphers in order of cipher priority. | |
+ +--------------------------------------------------------------------------------------------------------------+----------------+
+ | All constants and flags have been converted to *IntEnum* and *IntFlags*. | |
+ +--------------------------------------------------------------------------------------------------------------+----------------+
+ | Server and client-side specific TLS protocols for *SSLContext* were added. | |
+ +--------------------------------------------------------------------------------------------------------------+----------------+
+ | Added *SSLContext.post_handshake_auth* to enable and *ssl.SSLSocket.verify_client_post_handshake()* to | |
+ | initiate TLS 1.3 post-handshake authentication. | |
+ +--------------------------------------------------------------------------------------------------------------+----------------+
+ | `struct `_ | |
+ +--------------------------------------------------------------------------------------------------------------+----------------+
+ | now supports IEEE 754 half-precision floats via the 'e' format specifier. | |
+ +--------------------------------------------------------------------------------------------------------------+----------------+
+ | `sys `_ | |
+ +--------------------------------------------------------------------------------------------------------------+----------------+
+ | The new *getfilesystemencodeerrors()* function returns the name of the error mode used to convert between | |
+ | Unicode filenames and bytes filenames. | |
+ +--------------------------------------------------------------------------------------------------------------+----------------+
+ | `zlib `_ | |
+ +--------------------------------------------------------------------------------------------------------------+----------------+
+ | The *compress()* and *decompress()* functions now accept keyword arguments | |
+ +--------------------------------------------------------------------------------------------------------------+----------------+
diff --git a/components/language/micropython/docs/differences/python_37.rst b/components/language/micropython/docs/differences/python_37.rst
new file mode 100644
index 00000000..c46678e9
--- /dev/null
+++ b/components/language/micropython/docs/differences/python_37.rst
@@ -0,0 +1,95 @@
+.. _python_37:
+
+Python 3.7
+==========
+
+New Features:
+
+ +--------------------------------------------------------+--------------------------------------------------+----------------+
+ | **Features:** | **Status** |
+ +--------------------------------------------------------+--------------------------------------------------+----------------+
+ | `PEP 538 `_ | Coercing the legacy C locale to a UTF-8 based | |
+ | | locale | |
+ +--------------------------------------------------------+--------------------------------------------------+----------------+
+ | `PEP 539 `_ | A New C-API for Thread-Local Storage in CPython | |
+ +--------------------------------------------------------+--------------------------------------------------+----------------+
+ | `PEP 540 `_ | UTF-8 mode | |
+ +--------------------------------------------------------+--------------------------------------------------+----------------+
+ | `PEP 552 `_ | Deterministic pyc | |
+ +--------------------------------------------------------+--------------------------------------------------+----------------+
+ | `PEP 553 `_ | Built-in breakpoint() | |
+ +--------------------------------------------------------+--------------------------------------------------+----------------+
+ | `PEP 557 `_ | Data Classes | |
+ +--------------------------------------------------------+--------------------------------------------------+----------------+
+ | `PEP 560 `_ | Core support for typing module and generic types | |
+ +--------------------------------------------------------+--------------------------------------------------+----------------+
+ | `PEP 562 `_ | Module __getattr__ and __dir__ | Partially done |
+ +--------------------------------------------------------+--------------------------------------------------+----------------+
+ | `PEP 563 `_ | Postponed Evaluation of Annotations | |
+ +--------------------------------------------------------+--------------------------------------------------+----------------+
+ | `PEP 564 `_ | Time functions with nanosecond resolution | |
+ +--------------------------------------------------------+--------------------------------------------------+----------------+
+ | `PEP 565 `_ | Show DeprecationWarning in __main__ | |
+ +--------------------------------------------------------+--------------------------------------------------+----------------+
+ | `PEP 567 `_ | Context Variables | |
+ +--------------------------------------------------------+--------------------------------------------------+----------------+
+
+Other Language Changes:
+
+ +----------------------------------------------------------------------------------------------------------+----------------+
+ | async and await are now reserved keywords | Completed |
+ +----------------------------------------------------------------------------------------------------------+----------------+
+ | dict objects must preserve insertion-order | |
+ +----------------------------------------------------------------------------------------------------------+----------------+
+ | More than 255 arguments can now be passed to a function; a function can now have more than 255 parameters| |
+ +----------------------------------------------------------------------------------------------------------+----------------+
+ | bytes.fromhex() and bytearray.fromhex() now ignore all ASCII whitespace, not only spaces | |
+ +----------------------------------------------------------------------------------------------------------+----------------+
+ | str, bytes, and bytearray gained support for the new isascii() method, which can be used to test if a | |
+ | string or bytes contain only the ASCII characters | |
+ +----------------------------------------------------------------------------------------------------------+----------------+
+ | ImportError now displays module name and module __file__ path whenfrom ... import ... fails | |
+ +----------------------------------------------------------------------------------------------------------+----------------+
+ | Circular imports involving absolute imports with binding a submodule to a name are now supported | |
+ +----------------------------------------------------------------------------------------------------------+----------------+
+ | object.__format__(x, '') is now equivalent to str(x) rather than format(str(self), '') | |
+ +----------------------------------------------------------------------------------------------------------+----------------+
+ | In order to better support dynamic creation of stack traces, types.TracebackType can now be instantiated | |
+ | from Python code, and the tb_next attribute on tracebacks is now writable | |
+ +----------------------------------------------------------------------------------------------------------+----------------+
+ | When using the -m switch, sys.path[0] is now eagerly expanded to the full starting directory path, rather| |
+ | than being left as the empty directory (which allows imports from the current working directory at the | |
+ | time when an import occurs) | |
+ +----------------------------------------------------------------------------------------------------------+----------------+
+ | The new -X importtime option or the PYTHONPROFILEIMPORTTIME environment variable can be used to show the | |
+ | timing of each module import | |
+ +----------------------------------------------------------------------------------------------------------+----------------+
+
+Changes to built-in modules:
+
+ +------------------------------------------------------------------------------------------------------------+----------------+
+ | `asyncio `_ | |
+ +------------------------------------------------------------------------------------------------------------+----------------+
+ | asyncio (many, may need a separate ticket) | |
+ +------------------------------------------------------------------------------------------------------------+----------------+
+ | `gc `_ | |
+ +------------------------------------------------------------------------------------------------------------+----------------+
+ | New features include *gc.freeze()*, *gc.unfreeze()*, *gc-get_freeze_count* | |
+ +------------------------------------------------------------------------------------------------------------+----------------+
+ | `math `_ | |
+ +------------------------------------------------------------------------------------------------------------+----------------+
+ | math.remainder() added to implement IEEE 754-style remainder | |
+ +------------------------------------------------------------------------------------------------------------+----------------+
+ | `re `_ | |
+ +------------------------------------------------------------------------------------------------------------+----------------+
+ | A number of tidy up features including better support for splitting on empty strings and copy support for | |
+ | compiled expressions and match objects | |
+ +------------------------------------------------------------------------------------------------------------+----------------+
+ | `sys `_ | |
+ +------------------------------------------------------------------------------------------------------------+----------------+
+ | sys.breakpointhook() added. sys.get(/set)_coroutine_origin_tracking_depth() added | |
+ +------------------------------------------------------------------------------------------------------------+----------------+
+ | `time `_ | |
+ +------------------------------------------------------------------------------------------------------------+----------------+
+ | Mostly updates to support nanosecond resolution in PEP564, see above | |
+ +------------------------------------------------------------------------------------------------------------+----------------+
diff --git a/components/language/micropython/docs/differences/python_38.rst b/components/language/micropython/docs/differences/python_38.rst
new file mode 100644
index 00000000..47840a8b
--- /dev/null
+++ b/components/language/micropython/docs/differences/python_38.rst
@@ -0,0 +1,118 @@
+.. _python_38:
+
+Python 3.8
+==========
+
+Python 3.8.0 (final) was released on the 14 October 2019. The Features for 3.8
+are defined in `PEP 569 `_ and
+a detailed description of the changes can be found in What's New in `Python
+3.8. `_
+
+ +--------------------------------------------------------+---------------------------------------------------+---------------+
+ | **Features:** | Status |
+ +--------------------------------------------------------+---------------------------------------------------+---------------+
+ | `PEP 570 `_ | Positional-only arguments | |
+ +--------------------------------------------------------+---------------------------------------------------+---------------+
+ | `PEP 572 `_ | Assignment Expressions | |
+ +--------------------------------------------------------+---------------------------------------------------+---------------+
+ | `PEP 574 `_ | Pickle protocol 5 with out-of-band data | |
+ +--------------------------------------------------------+---------------------------------------------------+---------------+
+ | `PEP 578 `_ | Runtime audit hooks | |
+ +--------------------------------------------------------+---------------------------------------------------+---------------+
+ | `PEP 587 `_ | Python Initialization Configuration | |
+ +--------------------------------------------------------+---------------------------------------------------+---------------+
+ | `PEP 590 `_ | Vectorcall: a fast calling protocol for CPython | |
+ +--------------------------------------------------------+---------------------------------------------------+---------------+
+ | **Miscellaneous** |
+ +------------------------------------------------------------------------------------------------------------+---------------+
+ | f-strings support = for self-documenting expressions and debugging | Completed |
+ +------------------------------------------------------------------------------------------------------------+---------------+
+
+Other Language Changes:
+
+ +------------------------------------------------------------------------------------------------------------+-------------+
+ | A *continue* statement was illegal in the *finally* clause due to a problem with the implementation. In | Completed |
+ | Python 3.8 this restriction was lifted | |
+ +------------------------------------------------------------------------------------------------------------+-------------+
+ | The *bool*, *int* , and *fractions.Fraction* types now have an *as_integer_ratio()* method like that found | |
+ | in *float* and *decimal.Decimal* | |
+ +------------------------------------------------------------------------------------------------------------+-------------+
+ | Constructors of *int*, *float* and *complex* will now use the *__index__()* special method, if available | |
+ | and the corresponding method *__int__()*, *__float__()* or *__complex__()* is not available | |
+ +------------------------------------------------------------------------------------------------------------+-------------+
+ | Added support of *\N{name}* escapes in regular expressions | |
+ +------------------------------------------------------------------------------------------------------------+-------------+
+ | Dict and dictviews are now iterable in reversed insertion order using *reversed()* | |
+ +------------------------------------------------------------------------------------------------------------+-------------+
+ | The syntax allowed for keyword names in function calls was further restricted. In particular, | |
+ | f((keyword)=arg) is no longer allowed | |
+ +------------------------------------------------------------------------------------------------------------+-------------+
+ | Generalized iterable unpacking in yield and return statements no longer requires enclosing parentheses | |
+ +------------------------------------------------------------------------------------------------------------+-------------+
+ | When a comma is missed in code such as [(10, 20) (30, 40)], the compiler displays a SyntaxWarning with a | |
+ | helpful suggestion | |
+ +------------------------------------------------------------------------------------------------------------+-------------+
+ | Arithmetic operations between subclasses of *datetime.date* or *datetime.datetime* and *datetime.timedelta*| |
+ | objects now return an instance of the subclass, rather than the base class | |
+ +------------------------------------------------------------------------------------------------------------+-------------+
+ | When the Python interpreter is interrupted by *Ctrl-C (SIGINT)* and the resulting *KeyboardInterrupt* | |
+ | exception is not caught, the Python process now exits via a SIGINT signal or with the correct exit code | |
+ | such that the calling process can detect that it died due to a *Ctrl-C* | |
+ +------------------------------------------------------------------------------------------------------------+-------------+
+ | Some advanced styles of programming require updating the *types.CodeType* object for an existing function | |
+ +------------------------------------------------------------------------------------------------------------+-------------+
+ | For integers, the three-argument form of the pow() function now permits the exponent to be negative in the | |
+ | case where the base is relatively prime to the modulus | |
+ +------------------------------------------------------------------------------------------------------------+-------------+
+ | Dict comprehensions have been synced-up with dict literals so that the key is computed first and the value | |
+ | second | |
+ +------------------------------------------------------------------------------------------------------------+-------------+
+ | The *object.__reduce__()* method can now return a tuple from two to six elements long | |
+ +------------------------------------------------------------------------------------------------------------+-------------+
+
+Changes to built-in modules:
+
+ +------------------------------------------------------------------------------------------------------------+-------------+
+ | `asyncio` |
+ +------------------------------------------------------------------------------------------------------------+-------------+
+ | *asyncio.run()* has graduated from the provisional to stable API | Completed |
+ +------------------------------------------------------------------------------------------------------------+-------------+
+ | Running *python -m asyncio* launches a natively async REPL | |
+ +------------------------------------------------------------------------------------------------------------+-------------+
+ | The exception *asyncio.CancelledError* now inherits from *BaseException* rather than *Exception* and no | Completed |
+ | longer inherits from *concurrent.futures.CancelledError* | |
+ +------------------------------------------------------------------------------------------------------------+-------------+
+ | Added *asyncio.Task.get_coro()* for getting the wrapped coroutine within an *asyncio.Task* | |
+ +------------------------------------------------------------------------------------------------------------+-------------+
+ | Asyncio tasks can now be named, either by passing the name keyword argument to *asyncio.create_task()* or | |
+ | the *create_task()* event loop method, or by calling the *set_name()* method on the task object | |
+ +------------------------------------------------------------------------------------------------------------+-------------+
+ | Added support for Happy Eyeballs to *asyncio.loop.create_connection()*. To specify the behavior, two new | |
+ | parameters have been added: *happy_eyeballs_delay* and interleave. | |
+ +------------------------------------------------------------------------------------------------------------+-------------+
+ | `gc` |
+ +------------------------------------------------------------------------------------------------------------+-------------+
+ | *get_objects()* can now receive an optional generation parameter indicating a generation to get objects | |
+ | from. (Note, though, that while *gc* is a built-in, *get_objects()* is not implemented for MicroPython) | |
+ +------------------------------------------------------------------------------------------------------------+-------------+
+ | `math` |
+ +------------------------------------------------------------------------------------------------------------+-------------+
+ | Added new function *math.dist()* for computing Euclidean distance between two points | |
+ +------------------------------------------------------------------------------------------------------------+-------------+
+ | Expanded the *math.hypot()* function to handle multiple dimensions | |
+ +------------------------------------------------------------------------------------------------------------+-------------+
+ | Added new function, *math.prod()*, as analogous function to *sum()* that returns the product of a "start" | |
+ | value (default: 1) times an iterable of numbers | |
+ +------------------------------------------------------------------------------------------------------------+-------------+
+ | Added two new combinatoric functions *math.perm()* and *math.comb()* | |
+ +------------------------------------------------------------------------------------------------------------+-------------+
+ | Added a new function *math.isqrt()* for computing accurate integer square roots without conversion to | |
+ | floating point | |
+ +------------------------------------------------------------------------------------------------------------+-------------+
+ | The function *math.factorial()* no longer accepts arguments that are not int-like | Completed |
+ +------------------------------------------------------------------------------------------------------------+-------------+
+ | `sys` |
+ +------------------------------------------------------------------------------------------------------------+-------------+
+ | Add new *sys.unraisablehook()* function which can be overridden to control how "unraisable exceptions" | |
+ | are handled | |
+ +------------------------------------------------------------------------------------------------------------+-------------+
diff --git a/components/language/micropython/docs/differences/python_39.rst b/components/language/micropython/docs/differences/python_39.rst
new file mode 100644
index 00000000..6852dd63
--- /dev/null
+++ b/components/language/micropython/docs/differences/python_39.rst
@@ -0,0 +1,121 @@
+.. _python_39:
+
+Python 3.9
+==========
+
+Python 3.9.0 (final) was released on the 5th October 2020. The Features for 3.9 are
+defined in `PEP 596 `_
+and a detailed description of the changes can be found in
+`What's New in Python 3.9 `_
+
+ +--------------------------------------------------------+----------------------------------------------------+--------------+
+ | **Features:** | | **Status** |
+ +--------------------------------------------------------+----------------------------------------------------+--------------+
+ | `PEP 573 `_ | fast access to module state from methods of C | |
+ | | extension types | |
+ +--------------------------------------------------------+----------------------------------------------------+--------------+
+ | `PEP 584 `_ | union operators added to dict | |
+ +--------------------------------------------------------+----------------------------------------------------+--------------+
+ | `PEP 585 `_ | type hinting generics in standard collections | |
+ +--------------------------------------------------------+----------------------------------------------------+--------------+
+ | `PEP 593 `_ | flexible function and variable annotations | |
+ +--------------------------------------------------------+----------------------------------------------------+--------------+
+ | `PEP 602 `_ | CPython adopts an annual release cycle. Instead of | |
+ | | annual, aiming for two month release cycle | |
+ +--------------------------------------------------------+----------------------------------------------------+--------------+
+ | `PEP 614 `_ | relaxed grammar restrictions on decorators | |
+ +--------------------------------------------------------+----------------------------------------------------+--------------+
+ | `PEP 615 `_ | the IANA Time Zone Database is now present in the | |
+ | | standard library in the zoneinfo module | |
+ +--------------------------------------------------------+----------------------------------------------------+--------------+
+ | `PEP 616 `_ | string methods to remove prefixes and suffixes | |
+ +--------------------------------------------------------+----------------------------------------------------+--------------+
+ | `PEP 617 `_ | CPython now uses a new parser based on PEG | |
+ +--------------------------------------------------------+----------------------------------------------------+--------------+
+
+Other Language Changes:
+
+ +-------------------------------------------------------------------------------------------------------------+---------------+
+ | *__import__()* now raises *ImportError* instead of *ValueError* | Completed |
+ +-------------------------------------------------------------------------------------------------------------+---------------+
+ | Python now gets the absolute path of the script filename specified on the command line (ex: *python3* | |
+ | *script.py*): the *__file__* attribute of the *__main__* module became an absolute path, rather than a | |
+ | relative path | |
+ +-------------------------------------------------------------------------------------------------------------+---------------+
+ | By default, for best performance, the errors argument is only checked at the first encoding/decoding error | |
+ | and the encoding argument is sometimes ignored for empty strings | |
+ +-------------------------------------------------------------------------------------------------------------+---------------+
+ | *"".replace("", s, n)* now returns *s* instead of an empty string for all non-zero n. It is now consistent | |
+ | with *"".replace("", s)* | |
+ +-------------------------------------------------------------------------------------------------------------+---------------+
+ | Any valid expression can now be used as a decorator. Previously, the grammar was much more restrictive | |
+ +-------------------------------------------------------------------------------------------------------------+---------------+
+ | Parallel running of *aclose()* / *asend()* / *athrow()* is now prohibited, and *ag_running* now reflects | |
+ | the actual running status of the async generator | |
+ +-------------------------------------------------------------------------------------------------------------+---------------+
+ | Unexpected errors in calling the *__iter__* method are no longer masked by TypeError in the in operator and | |
+ | functions contains(), indexOf() and countOf() of the operator module | |
+ +-------------------------------------------------------------------------------------------------------------+---------------+
+ | Unparenthesized lambda expressions can no longer be the expression part in an if clause in comprehensions | |
+ | and generator expressions | |
+ +-------------------------------------------------------------------------------------------------------------+---------------+
+
+Changes to built-in modules:
+
+ +---------------------------------------------------------------------------------------------------------------+---------------+
+ | `asyncio` |
+ +---------------------------------------------------------------------------------------------------------------+---------------+
+ | Due to significant security concerns, the reuse_address parameter of *asyncio.loop.create_datagram_endpoint()*| |
+ | is no longer supported | |
+ +---------------------------------------------------------------------------------------------------------------+---------------+
+ | Added a new coroutine *shutdown_default_executor()* that schedules a shutdown for the default executor that | |
+ | waits on the *ThreadPoolExecutor* to finish closing. Also, *asyncio.run()* has been updated to use the new | |
+ | coroutine. | |
+ +---------------------------------------------------------------------------------------------------------------+---------------+
+ | Added *asyncio.PidfdChildWatcher*, a Linux-specific child watcher implementation that polls process file | |
+ | descriptors | |
+ +---------------------------------------------------------------------------------------------------------------+---------------+
+ | added a new *coroutine asyncio.to_thread()* | |
+ +---------------------------------------------------------------------------------------------------------------+---------------+
+ | When cancelling the task due to a timeout, *asyncio.wait_for()* will now wait until the cancellation is | |
+ | complete also in the case when timeout is <= 0, like it does with positive timeouts | |
+ +---------------------------------------------------------------------------------------------------------------+---------------+
+ | *asyncio* now raises *TyperError* when calling incompatible methods with an *ssl.SSLSocket* socket | |
+ +---------------------------------------------------------------------------------------------------------------+---------------+
+ | `gc` |
+ +---------------------------------------------------------------------------------------------------------------+---------------+
+ | Garbage collection does not block on resurrected objects | |
+ +---------------------------------------------------------------------------------------------------------------+---------------+
+ | Added a new function *gc.is_finalized()* to check if an object has been finalized by the garbage collector | |
+ +---------------------------------------------------------------------------------------------------------------+---------------+
+ | `math` |
+ +---------------------------------------------------------------------------------------------------------------+---------------+
+ | Expanded the *math.gcd()* function to handle multiple arguments. Formerly, it only supported two arguments | |
+ +---------------------------------------------------------------------------------------------------------------+---------------+
+ | Added *math.lcm()*: return the least common multiple of specified arguments | |
+ +---------------------------------------------------------------------------------------------------------------+---------------+
+ | Added *math.nextafter()*: return the next floating-point value after x towards y | |
+ +---------------------------------------------------------------------------------------------------------------+---------------+
+ | Added *math.ulp()*: return the value of the least significant bit of a float | |
+ +---------------------------------------------------------------------------------------------------------------+---------------+
+ | `os` |
+ +---------------------------------------------------------------------------------------------------------------+---------------+
+ | Exposed the Linux-specific *os.pidfd_open()* and *os.P_PIDFD* | |
+ +---------------------------------------------------------------------------------------------------------------+---------------+
+ | The *os.unsetenv()* function is now also available on Windows | Completed |
+ +---------------------------------------------------------------------------------------------------------------+---------------+
+ | The *os.putenv()* and *os.unsetenv()* functions are now always available | Completed |
+ +---------------------------------------------------------------------------------------------------------------+---------------+
+ | Added *os.waitstatus_to_exitcode()* function: convert a wait status to an exit code | |
+ +---------------------------------------------------------------------------------------------------------------+---------------+
+ | `random` |
+ +---------------------------------------------------------------------------------------------------------------+---------------+
+ | Added a new *random.Random.randbytes* method: generate random bytes | |
+ +---------------------------------------------------------------------------------------------------------------+---------------+
+ | `sys` |
+ +---------------------------------------------------------------------------------------------------------------+---------------+
+ | Added a new *sys.platlibdir* attribute: name of the platform-specific library directory | |
+ +---------------------------------------------------------------------------------------------------------------+---------------+
+ | Previously, *sys.stderr* was block-buffered when non-interactive. Now stderr defaults to always being | |
+ | line-buffered | |
+ +---------------------------------------------------------------------------------------------------------------+---------------+
diff --git a/components/language/micropython/docs/esp32/general.rst b/components/language/micropython/docs/esp32/general.rst
new file mode 100644
index 00000000..8137c042
--- /dev/null
+++ b/components/language/micropython/docs/esp32/general.rst
@@ -0,0 +1,64 @@
+.. _esp32_general:
+
+General information about the ESP32 port
+========================================
+
+The ESP32 is a popular WiFi and Bluetooth enabled System-on-Chip (SoC) by
+Espressif Systems.
+
+Multitude of boards
+-------------------
+
+There is a multitude of modules and boards from different sources which carry
+the ESP32 chip. MicroPython tries to provide a generic port which would run on
+as many boards/modules as possible, but there may be limitations. Espressif
+development boards are taken as reference for the port (for example, testing is
+performed on them). For any board you are using please make sure you have a
+datasheet, schematics and other reference materials so you can look up any
+board-specific functions.
+
+To make a generic ESP32 port and support as many boards as possible the
+following design and implementation decision were made:
+
+* GPIO pin numbering is based on ESP32 chip numbering. Please have the manual/pin
+ diagram of your board at hand to find correspondence between your board pins and
+ actual ESP32 pins.
+* All pins are supported by MicroPython but not all are usable on any given board.
+ For example pins that are connected to external SPI flash should not be used,
+ and a board may only expose a certain selection of pins.
+
+
+Technical specifications and SoC datasheets
+-------------------------------------------
+
+The datasheets and other reference material for ESP32 chip are available
+from the vendor site: https://www.espressif.com/en/support/download/documents?keys=esp32 .
+They are the primary reference for the chip technical specifications, capabilities,
+operating modes, internal functioning, etc.
+
+For your convenience, some of technical specifications are provided below:
+
+* Architecture: Xtensa Dual-Core 32-bit LX6
+* CPU frequency: up to 240MHz
+* Total RAM available: 528KB (part of it reserved for system)
+* BootROM: 448KB
+* Internal FlashROM: none
+* External FlashROM: code and data, via SPI Flash; usual size 4MB
+* GPIO: 34 (GPIOs are multiplexed with other functions, including
+ external FlashROM, UART, etc.)
+* UART: 3 RX/TX UART (no hardware handshaking), one TX-only UART
+* SPI: 4 SPI interfaces (one used for FlashROM)
+* I2C: 2 I2C (bitbang implementation available on any pins)
+* I2S: 2
+* ADC: 12-bit SAR ADC up to 18 channels
+* DAC: 2 8-bit DACs
+* RMT: 8 channels allowing accurate pulse transmit/receive
+* Programming: using BootROM bootloader from UART - due to external FlashROM
+ and always-available BootROM bootloader, the ESP32 is not brickable
+
+For more information see the ESP32 datasheet: https://www.espressif.com/sites/default/files/documentation/esp32_datasheet_en.pdf
+
+MicroPython is implemented on top of the ESP-IDF, Espressif's development
+framework for the ESP32. This is a FreeRTOS based system. See the
+`ESP-IDF Programming Guide `_
+for details.
diff --git a/components/language/micropython/docs/esp32/img/esp32.jpg b/components/language/micropython/docs/esp32/img/esp32.jpg
new file mode 100644
index 00000000..a96ddcbe
Binary files /dev/null and b/components/language/micropython/docs/esp32/img/esp32.jpg differ
diff --git a/components/language/micropython/docs/esp32/quickref.rst b/components/language/micropython/docs/esp32/quickref.rst
new file mode 100644
index 00000000..894508f4
--- /dev/null
+++ b/components/language/micropython/docs/esp32/quickref.rst
@@ -0,0 +1,756 @@
+.. _esp32_quickref:
+
+Quick reference for the ESP32
+=============================
+
+.. image:: img/esp32.jpg
+ :alt: ESP32 board
+ :width: 640px
+
+The Espressif ESP32 Development Board (image attribution: Adafruit).
+
+Below is a quick reference for ESP32-based boards. If it is your first time
+working with this board it may be useful to get an overview of the microcontroller:
+
+.. toctree::
+ :maxdepth: 1
+
+ general.rst
+ tutorial/index.rst
+
+Installing MicroPython
+----------------------
+
+See the corresponding section of tutorial: :ref:`esp32_intro`. It also includes
+a troubleshooting subsection.
+
+General board control
+---------------------
+
+The MicroPython REPL is on UART0 (GPIO1=TX, GPIO3=RX) at baudrate 115200.
+Tab-completion is useful to find out what methods an object has.
+Paste mode (ctrl-E) is useful to paste a large slab of Python code into
+the REPL.
+
+The :mod:`machine` module::
+
+ import machine
+
+ machine.freq() # get the current frequency of the CPU
+ machine.freq(240000000) # set the CPU frequency to 240 MHz
+
+The :mod:`esp` module::
+
+ import esp
+
+ esp.osdebug(None) # turn off vendor O/S debugging messages
+ esp.osdebug(0) # redirect vendor O/S debugging messages to UART(0)
+
+ # low level methods to interact with flash storage
+ esp.flash_size()
+ esp.flash_user_start()
+ esp.flash_erase(sector_no)
+ esp.flash_write(byte_offset, buffer)
+ esp.flash_read(byte_offset, buffer)
+
+The :mod:`esp32` module::
+
+ import esp32
+
+ esp32.hall_sensor() # read the internal hall sensor
+ esp32.raw_temperature() # read the internal temperature of the MCU, in Fahrenheit
+ esp32.ULP() # access to the Ultra-Low-Power Co-processor
+
+Note that the temperature sensor in the ESP32 will typically read higher than
+ambient due to the IC getting warm while it runs. This effect can be minimised
+by reading the temperature sensor immediately after waking up from sleep.
+
+Networking
+----------
+
+The :mod:`network` module::
+
+ import network
+
+ wlan = network.WLAN(network.STA_IF) # create station interface
+ wlan.active(True) # activate the interface
+ wlan.scan() # scan for access points
+ wlan.isconnected() # check if the station is connected to an AP
+ wlan.connect('essid', 'password') # connect to an AP
+ wlan.config('mac') # get the interface's MAC address
+ wlan.ifconfig() # get the interface's IP/netmask/gw/DNS addresses
+
+ ap = network.WLAN(network.AP_IF) # create access-point interface
+ ap.config(essid='ESP-AP') # set the ESSID of the access point
+ ap.config(max_clients=10) # set how many clients can connect to the network
+ ap.active(True) # activate the interface
+
+A useful function for connecting to your local WiFi network is::
+
+ def do_connect():
+ import network
+ wlan = network.WLAN(network.STA_IF)
+ wlan.active(True)
+ if not wlan.isconnected():
+ print('connecting to network...')
+ wlan.connect('essid', 'password')
+ while not wlan.isconnected():
+ pass
+ print('network config:', wlan.ifconfig())
+
+Once the network is established the :mod:`socket ` module can be used
+to create and use TCP/UDP sockets as usual, and the ``urequests`` module for
+convenient HTTP requests.
+
+After a call to ``wlan.connect()``, the device will by default retry to connect
+**forever**, even when the authentication failed or no AP is in range.
+``wlan.status()`` will return ``network.STAT_CONNECTING`` in this state until a
+connection succeeds or the interface gets disabled. This can be changed by
+calling ``wlan.config(reconnects=n)``, where n are the number of desired reconnect
+attempts (0 means it won't retry, -1 will restore the default behaviour of trying
+to reconnect forever).
+
+Delay and timing
+----------------
+
+Use the :mod:`time ` module::
+
+ import time
+
+ time.sleep(1) # sleep for 1 second
+ time.sleep_ms(500) # sleep for 500 milliseconds
+ time.sleep_us(10) # sleep for 10 microseconds
+ start = time.ticks_ms() # get millisecond counter
+ delta = time.ticks_diff(time.ticks_ms(), start) # compute time difference
+
+Timers
+------
+
+The ESP32 port has four hardware timers. Use the :ref:`machine.Timer ` class
+with a timer ID from 0 to 3 (inclusive)::
+
+ from machine import Timer
+
+ tim0 = Timer(0)
+ tim0.init(period=5000, mode=Timer.ONE_SHOT, callback=lambda t:print(0))
+
+ tim1 = Timer(1)
+ tim1.init(period=2000, mode=Timer.PERIODIC, callback=lambda t:print(1))
+
+The period is in milliseconds.
+
+Virtual timers are not currently supported on this port.
+
+.. _Pins_and_GPIO:
+
+Pins and GPIO
+-------------
+
+Use the :ref:`machine.Pin ` class::
+
+ from machine import Pin
+
+ p0 = Pin(0, Pin.OUT) # create output pin on GPIO0
+ p0.on() # set pin to "on" (high) level
+ p0.off() # set pin to "off" (low) level
+ p0.value(1) # set pin to on/high
+
+ p2 = Pin(2, Pin.IN) # create input pin on GPIO2
+ print(p2.value()) # get value, 0 or 1
+
+ p4 = Pin(4, Pin.IN, Pin.PULL_UP) # enable internal pull-up resistor
+ p5 = Pin(5, Pin.OUT, value=1) # set pin high on creation
+ p6 = Pin(6, Pin.OUT, drive=Pin.DRIVE_3) # set maximum drive strength
+
+Available Pins are from the following ranges (inclusive): 0-19, 21-23, 25-27, 32-39.
+These correspond to the actual GPIO pin numbers of ESP32 chip. Note that many
+end-user boards use their own adhoc pin numbering (marked e.g. D0, D1, ...).
+For mapping between board logical pins and physical chip pins consult your board
+documentation.
+
+Four drive strengths are supported, using the ``drive`` keyword argument to the
+``Pin()`` constructor or ``Pin.init()`` method, with different corresponding
+safe maximum source/sink currents and approximate internal driver resistances:
+
+ - ``Pin.DRIVE_0``: 5mA / 130 ohm
+ - ``Pin.DRIVE_1``: 10mA / 60 ohm
+ - ``Pin.DRIVE_2``: 20mA / 30 ohm (default strength if not configured)
+ - ``Pin.DRIVE_3``: 40mA / 15 ohm
+
+The ``hold=`` keyword argument to ``Pin()`` and ``Pin.init()`` will enable the
+ESP32 "pad hold" feature. When set to ``True``, the pin configuration
+(direction, pull resistors and output value) will be held and any further
+changes (including changing the output level) will not be applied. Setting
+``hold=False`` will immediately apply any outstanding pin configuration changes
+and release the pin. Using ``hold=True`` while a pin is already held will apply
+any configuration changes and then immediately reapply the hold.
+
+Notes:
+
+* Pins 1 and 3 are REPL UART TX and RX respectively
+
+* Pins 6, 7, 8, 11, 16, and 17 are used for connecting the embedded flash,
+ and are not recommended for other uses
+
+* Pins 34-39 are input only, and also do not have internal pull-up resistors
+
+* See :ref:`Deep_sleep_Mode` for a discussion of pin behaviour during sleep
+
+There's a higher-level abstraction :ref:`machine.Signal `
+which can be used to invert a pin. Useful for illuminating active-low LEDs
+using ``on()`` or ``value(1)``.
+
+UART (serial bus)
+-----------------
+
+See :ref:`machine.UART `. ::
+
+ from machine import UART
+
+ uart1 = UART(1, baudrate=9600, tx=33, rx=32)
+ uart1.write('hello') # write 5 bytes
+ uart1.read(5) # read up to 5 bytes
+
+The ESP32 has three hardware UARTs: UART0, UART1 and UART2.
+They each have default GPIO assigned to them, however depending on your
+ESP32 variant and board, these pins may conflict with embedded flash,
+onboard PSRAM or peripherals.
+
+Any GPIO can be used for hardware UARTs using the GPIO matrix, so to avoid
+conflicts simply provide ``tx`` and ``rx`` pins when constructing. The default
+pins listed below.
+
+===== ===== ===== =====
+\ UART0 UART1 UART2
+===== ===== ===== =====
+tx 1 10 17
+rx 3 9 16
+===== ===== ===== =====
+
+PWM (pulse width modulation)
+----------------------------
+
+PWM can be enabled on all output-enabled pins. The base frequency can
+range from 1Hz to 40MHz but there is a tradeoff; as the base frequency
+*increases* the duty resolution *decreases*. See
+`LED Control `_
+for more details.
+
+Use the :ref:`machine.PWM ` class::
+
+ from machine import Pin, PWM
+
+ pwm0 = PWM(Pin(0)) # create PWM object from a pin
+ freq = pwm0.freq() # get current frequency (default 5kHz)
+ pwm0.freq(1000) # set PWM frequency from 1Hz to 40MHz
+
+ duty = pwm0.duty() # get current duty cycle, range 0-1023 (default 512, 50%)
+ pwm0.duty(256) # set duty cycle from 0 to 1023 as a ratio duty/1023, (now 25%)
+
+ duty_u16 = pwm0.duty_u16() # get current duty cycle, range 0-65535
+ pwm0.duty_u16(2**16*3//4) # set duty cycle from 0 to 65535 as a ratio duty_u16/65535, (now 75%)
+
+ duty_ns = pwm0.duty_ns() # get current pulse width in ns
+ pwm0.duty_ns(250_000) # set pulse width in nanoseconds from 0 to 1_000_000_000/freq, (now 25%)
+
+ pwm0.deinit() # turn off PWM on the pin
+
+ pwm2 = PWM(Pin(2), freq=20000, duty=512) # create and configure in one go
+ print(pwm2) # view PWM settings
+
+ESP chips have different hardware peripherals:
+
+===================================================== ======== ======== ========
+Hardware specification ESP32 ESP32-S2 ESP32-C3
+----------------------------------------------------- -------- -------- --------
+Number of groups (speed modes) 2 1 1
+Number of timers per group 4 4 4
+Number of channels per group 8 8 6
+----------------------------------------------------- -------- -------- --------
+Different PWM frequencies (groups * timers) 8 4 4
+Total PWM channels (Pins, duties) (groups * channels) 16 8 6
+===================================================== ======== ======== ========
+
+A maximum number of PWM channels (Pins) are available on the ESP32 - 16 channels,
+but only 8 different PWM frequencies are available, the remaining 8 channels must
+have the same frequency. On the other hand, 16 independent PWM duty cycles are
+possible at the same frequency.
+
+See more examples in the :ref:`esp32_pwm` tutorial.
+
+ADC (analog to digital conversion)
+----------------------------------
+
+On the ESP32, ADC functionality is available on pins 32-39 (ADC block 1) and
+pins 0, 2, 4, 12-15 and 25-27 (ADC block 2).
+
+Use the :ref:`machine.ADC ` class::
+
+ from machine import ADC
+
+ adc = ADC(pin) # create an ADC object acting on a pin
+ val = adc.read_u16() # read a raw analog value in the range 0-65535
+ val = adc.read_uv() # read an analog value in microvolts
+
+ADC block 2 is also used by WiFi and so attempting to read analog values from
+block 2 pins when WiFi is active will raise an exception.
+
+The internal ADC reference voltage is typically 1.1V, but varies slightly from
+package to package. The ADC is less linear close to the reference voltage
+(particularly at higher attenuations) and has a minimum measurement voltage
+around 100mV, voltages at or below this will read as 0. To read voltages
+accurately, it is recommended to use the ``read_uv()`` method (see below).
+
+ESP32-specific ADC class method reference:
+
+.. class:: ADC(pin, *, atten)
+
+ Return the ADC object for the specified pin. ESP32 does not support
+ different timings for ADC sampling and so the ``sample_ns`` keyword argument
+ is not supported.
+
+ To read voltages above the reference voltage, apply input attenuation with
+ the ``atten`` keyword argument. Valid values (and approximate linear
+ measurement ranges) are:
+
+ - ``ADC.ATTN_0DB``: No attenuation (100mV - 950mV)
+ - ``ADC.ATTN_2_5DB``: 2.5dB attenuation (100mV - 1250mV)
+ - ``ADC.ATTN_6DB``: 6dB attenuation (150mV - 1750mV)
+ - ``ADC.ATTN_11DB``: 11dB attenuation (150mV - 2450mV)
+
+.. Warning::
+ Note that the absolute maximum voltage rating for input pins is 3.6V. Going
+ near to this boundary risks damage to the IC!
+
+.. method:: ADC.read_uv()
+
+ This method uses the known characteristics of the ADC and per-package eFuse
+ values - set during manufacture - to return a calibrated input voltage
+ (before attenuation) in microvolts. The returned value has only millivolt
+ resolution (i.e., will always be a multiple of 1000 microvolts).
+
+ The calibration is only valid across the linear range of the ADC. In
+ particular, an input tied to ground will read as a value above 0 microvolts.
+ Within the linear range, however, more accurate and consistent results will
+ be obtained than using `read_u16()` and scaling the result with a constant.
+
+The ESP32 port also supports the :ref:`machine.ADC ` API:
+
+.. class:: ADCBlock(id, *, bits)
+
+ Return the ADC block object with the given ``id`` (1 or 2) and initialize
+ it to the specified resolution (9 to 12-bits depending on the ESP32 series)
+ or the highest supported resolution if not specified.
+
+.. method:: ADCBlock.connect(pin)
+ ADCBlock.connect(channel)
+ ADCBlock.connect(channel, pin)
+
+ Return the ``ADC`` object for the specified ADC pin or channel number.
+ Arbitrary connection of ADC channels to GPIO is not supported and so
+ specifying a pin that is not connected to this block, or specifying a
+ mismatched channel and pin, will raise an exception.
+
+Legacy methods:
+
+.. method:: ADC.read()
+
+ This method returns the raw ADC value ranged according to the resolution of
+ the block, e.g., 0-4095 for 12-bit resolution.
+
+.. method:: ADC.atten(atten)
+
+ Equivalent to ``ADC.init(atten=atten)``.
+
+.. method:: ADC.width(bits)
+
+ Equivalent to ``ADC.block().init(bits=bits)``.
+
+For compatibility, the ``ADC`` object also provides constants matching the
+supported ADC resolutions:
+
+ - ``ADC.WIDTH_9BIT`` = 9
+ - ``ADC.WIDTH_10BIT`` = 10
+ - ``ADC.WIDTH_11BIT`` = 11
+ - ``ADC.WIDTH_12BIT`` = 12
+
+
+Software SPI bus
+----------------
+
+Software SPI (using bit-banging) works on all pins, and is accessed via the
+:ref:`machine.SoftSPI ` class::
+
+ from machine import Pin, SoftSPI
+
+ # construct a SoftSPI bus on the given pins
+ # polarity is the idle state of SCK
+ # phase=0 means sample on the first edge of SCK, phase=1 means the second
+ spi = SoftSPI(baudrate=100000, polarity=1, phase=0, sck=Pin(0), mosi=Pin(2), miso=Pin(4))
+
+ spi.init(baudrate=200000) # set the baudrate
+
+ spi.read(10) # read 10 bytes on MISO
+ spi.read(10, 0xff) # read 10 bytes while outputting 0xff on MOSI
+
+ buf = bytearray(50) # create a buffer
+ spi.readinto(buf) # read into the given buffer (reads 50 bytes in this case)
+ spi.readinto(buf, 0xff) # read into the given buffer and output 0xff on MOSI
+
+ spi.write(b'12345') # write 5 bytes on MOSI
+
+ buf = bytearray(4) # create a buffer
+ spi.write_readinto(b'1234', buf) # write to MOSI and read from MISO into the buffer
+ spi.write_readinto(buf, buf) # write buf to MOSI and read MISO back into buf
+
+.. Warning::
+ Currently *all* of ``sck``, ``mosi`` and ``miso`` *must* be specified when
+ initialising Software SPI.
+
+Hardware SPI bus
+----------------
+
+There are two hardware SPI channels that allow faster transmission
+rates (up to 80Mhz). These may be used on any IO pins that support the
+required direction and are otherwise unused (see :ref:`Pins_and_GPIO`)
+but if they are not configured to their default pins then they need to
+pass through an extra layer of GPIO multiplexing, which can impact
+their reliability at high speeds. Hardware SPI channels are limited
+to 40MHz when used on pins other than the default ones listed below.
+
+===== =========== ============
+\ HSPI (id=1) VSPI (id=2)
+===== =========== ============
+sck 14 18
+mosi 13 23
+miso 12 19
+===== =========== ============
+
+Hardware SPI is accessed via the :ref:`machine.SPI ` class and
+has the same methods as software SPI above::
+
+ from machine import Pin, SPI
+
+ hspi = SPI(1, 10000000)
+ hspi = SPI(1, 10000000, sck=Pin(14), mosi=Pin(13), miso=Pin(12))
+ vspi = SPI(2, baudrate=80000000, polarity=0, phase=0, bits=8, firstbit=0, sck=Pin(18), mosi=Pin(23), miso=Pin(19))
+
+Software I2C bus
+----------------
+
+Software I2C (using bit-banging) works on all output-capable pins, and is
+accessed via the :ref:`machine.SoftI2C ` class::
+
+ from machine import Pin, SoftI2C
+
+ i2c = SoftI2C(scl=Pin(5), sda=Pin(4), freq=100000)
+
+ i2c.scan() # scan for devices
+
+ i2c.readfrom(0x3a, 4) # read 4 bytes from device with address 0x3a
+ i2c.writeto(0x3a, '12') # write '12' to device with address 0x3a
+
+ buf = bytearray(10) # create a buffer with 10 bytes
+ i2c.writeto(0x3a, buf) # write the given buffer to the peripheral
+
+Hardware I2C bus
+----------------
+
+There are two hardware I2C peripherals with identifiers 0 and 1. Any available
+output-capable pins can be used for SCL and SDA but the defaults are given
+below.
+
+===== =========== ============
+\ I2C(0) I2C(1)
+===== =========== ============
+scl 18 25
+sda 19 26
+===== =========== ============
+
+The driver is accessed via the :ref:`machine.I2C ` class and
+has the same methods as software I2C above::
+
+ from machine import Pin, I2C
+
+ i2c = I2C(0)
+ i2c = I2C(1, scl=Pin(5), sda=Pin(4), freq=400000)
+
+I2S bus
+-------
+
+See :ref:`machine.I2S `. ::
+
+ from machine import I2S, Pin
+
+ i2s = I2S(0, sck=Pin(13), ws=Pin(14), sd=Pin(34), mode=I2S.TX, bits=16, format=I2S.STEREO, rate=44100, ibuf=40000) # create I2S object
+ i2s.write(buf) # write buffer of audio samples to I2S device
+
+ i2s = I2S(1, sck=Pin(33), ws=Pin(25), sd=Pin(32), mode=I2S.RX, bits=16, format=I2S.MONO, rate=22050, ibuf=40000) # create I2S object
+ i2s.readinto(buf) # fill buffer with audio samples from I2S device
+
+The I2S class is currently available as a Technical Preview. During the preview period, feedback from
+users is encouraged. Based on this feedback, the I2S class API and implementation may be changed.
+
+ESP32 has two I2S buses with id=0 and id=1
+
+Real time clock (RTC)
+---------------------
+
+See :ref:`machine.RTC ` ::
+
+ from machine import RTC
+
+ rtc = RTC()
+ rtc.datetime((2017, 8, 23, 1, 12, 48, 0, 0)) # set a specific date and time
+ rtc.datetime() # get date and time
+
+WDT (Watchdog timer)
+--------------------
+
+See :ref:`machine.WDT `. ::
+
+ from machine import WDT
+
+ # enable the WDT with a timeout of 5s (1s is the minimum)
+ wdt = WDT(timeout=5000)
+ wdt.feed()
+
+.. _Deep_sleep_mode:
+
+Deep-sleep mode
+---------------
+
+The following code can be used to sleep, wake and check the reset cause::
+
+ import machine
+
+ # check if the device woke from a deep sleep
+ if machine.reset_cause() == machine.DEEPSLEEP_RESET:
+ print('woke from a deep sleep')
+
+ # put the device to sleep for 10 seconds
+ machine.deepsleep(10000)
+
+Notes:
+
+* Calling ``deepsleep()`` without an argument will put the device to sleep
+ indefinitely
+* A software reset does not change the reset cause
+
+Some ESP32 pins (0, 2, 4, 12-15, 25-27, 32-39) are connected to the RTC during
+deep-sleep and can be used to wake the device with the ``wake_on_`` functions in
+the :mod:`esp32` module. The output-capable RTC pins (all except 34-39) will
+also retain their pull-up or pull-down resistor configuration when entering
+deep-sleep.
+
+If the pull resistors are not actively required during deep-sleep and are likely
+to cause current leakage (for example a pull-up resistor is connected to ground
+through a switch), then they should be disabled to save power before entering
+deep-sleep mode::
+
+ from machine import Pin, deepsleep
+
+ # configure input RTC pin with pull-up on boot
+ pin = Pin(2, Pin.IN, Pin.PULL_UP)
+
+ # disable pull-up and put the device to sleep for 10 seconds
+ pin.init(pull=None)
+ machine.deepsleep(10000)
+
+Output-configured RTC pins will also retain their output direction and level in
+deep-sleep if pad hold is enabled with the ``hold=True`` argument to
+``Pin.init()``.
+
+Non-RTC GPIO pins will be disconnected by default on entering deep-sleep.
+Configuration of non-RTC pins - including output level - can be retained by
+enabling pad hold on the pin and enabling GPIO pad hold during deep-sleep::
+
+ from machine import Pin, deepsleep
+ import esp32
+
+ opin = Pin(19, Pin.OUT, value=1, hold=True) # hold output level
+ ipin = Pin(21, Pin.IN, Pin.PULL_UP, hold=True) # hold pull-up
+
+ # enable pad hold in deep-sleep for non-RTC GPIO
+ esp32.gpio_deep_sleep_hold(True)
+
+ # put the device to sleep for 10 seconds
+ deepsleep(10000)
+
+The pin configuration - including the pad hold - will be retained on wake from
+sleep. See :ref:`Pins_and_GPIO` above for a further discussion of pad holding.
+
+SD card
+-------
+
+See :ref:`machine.SDCard `. ::
+
+ import machine, os
+
+ # Slot 2 uses pins sck=18, cs=5, miso=19, mosi=23
+ sd = machine.SDCard(slot=2)
+ os.mount(sd, "/sd") # mount
+
+ os.listdir('/sd') # list directory contents
+
+ os.umount('/sd') # eject
+
+RMT
+---
+
+The RMT is ESP32-specific and allows generation of accurate digital pulses with
+12.5ns resolution. See :ref:`esp32.RMT ` for details. Usage is::
+
+ import esp32
+ from machine import Pin
+
+ r = esp32.RMT(0, pin=Pin(18), clock_div=8)
+ r # RMT(channel=0, pin=18, source_freq=80000000, clock_div=8)
+ # The channel resolution is 100ns (1/(source_freq/clock_div)).
+ r.write_pulses((1, 20, 2, 40), 0) # Send 0 for 100ns, 1 for 2000ns, 0 for 200ns, 1 for 4000ns
+
+OneWire driver
+--------------
+
+The OneWire driver is implemented in software and works on all pins::
+
+ from machine import Pin
+ import onewire
+
+ ow = onewire.OneWire(Pin(12)) # create a OneWire bus on GPIO12
+ ow.scan() # return a list of devices on the bus
+ ow.reset() # reset the bus
+ ow.readbyte() # read a byte
+ ow.writebyte(0x12) # write a byte on the bus
+ ow.write('123') # write bytes on the bus
+ ow.select_rom(b'12345678') # select a specific device by its ROM code
+
+There is a specific driver for DS18S20 and DS18B20 devices::
+
+ import time, ds18x20
+ ds = ds18x20.DS18X20(ow)
+ roms = ds.scan()
+ ds.convert_temp()
+ time.sleep_ms(750)
+ for rom in roms:
+ print(ds.read_temp(rom))
+
+Be sure to put a 4.7k pull-up resistor on the data line. Note that
+the ``convert_temp()`` method must be called each time you want to
+sample the temperature.
+
+NeoPixel and APA106 driver
+--------------------------
+
+Use the ``neopixel`` and ``apa106`` modules::
+
+ from machine import Pin
+ from neopixel import NeoPixel
+
+ pin = Pin(0, Pin.OUT) # set GPIO0 to output to drive NeoPixels
+ np = NeoPixel(pin, 8) # create NeoPixel driver on GPIO0 for 8 pixels
+ np[0] = (255, 255, 255) # set the first pixel to white
+ np.write() # write data to all pixels
+ r, g, b = np[0] # get first pixel colour
+
+
+The APA106 driver extends NeoPixel, but internally uses a different colour order::
+
+ from apa106 import APA106
+ ap = APA106(pin, 8)
+ r, g, b = ap[0]
+
+.. Warning::
+ By default ``NeoPixel`` is configured to control the more popular *800kHz*
+ units. It is possible to use alternative timing to control other (typically
+ 400kHz) devices by passing ``timing=0`` when constructing the
+ ``NeoPixel`` object.
+
+For low-level driving of a NeoPixel see `machine.bitstream`.
+This low-level driver uses an RMT channel by default. To configure this see
+`RMT.bitstream_channel`.
+
+APA102 (DotStar) uses a different driver as it has an additional clock pin.
+
+Capacitive touch
+----------------
+
+Use the ``TouchPad`` class in the ``machine`` module::
+
+ from machine import TouchPad, Pin
+
+ t = TouchPad(Pin(14))
+ t.read() # Returns a smaller number when touched
+
+``TouchPad.read`` returns a value relative to the capacitive variation. Small numbers (typically in
+the *tens*) are common when a pin is touched, larger numbers (above *one thousand*) when
+no touch is present. However the values are *relative* and can vary depending on the board
+and surrounding composition so some calibration may be required.
+
+There are ten capacitive touch-enabled pins that can be used on the ESP32: 0, 2, 4, 12, 13
+14, 15, 27, 32, 33. Trying to assign to any other pins will result in a ``ValueError``.
+
+Note that TouchPads can be used to wake an ESP32 from sleep::
+
+ import machine
+ from machine import TouchPad, Pin
+ import esp32
+
+ t = TouchPad(Pin(14))
+ t.config(500) # configure the threshold at which the pin is considered touched
+ esp32.wake_on_touch(True)
+ machine.lightsleep() # put the MCU to sleep until a touchpad is touched
+
+For more details on touchpads refer to `Espressif Touch Sensor
+`_.
+
+
+DHT driver
+----------
+
+The DHT driver is implemented in software and works on all pins::
+
+ import dht
+ import machine
+
+ d = dht.DHT11(machine.Pin(4))
+ d.measure()
+ d.temperature() # eg. 23 (°C)
+ d.humidity() # eg. 41 (% RH)
+
+ d = dht.DHT22(machine.Pin(4))
+ d.measure()
+ d.temperature() # eg. 23.6 (°C)
+ d.humidity() # eg. 41.3 (% RH)
+
+WebREPL (web browser interactive prompt)
+----------------------------------------
+
+WebREPL (REPL over WebSockets, accessible via a web browser) is an
+experimental feature available in ESP32 port. Download web client
+from https://github.com/micropython/webrepl (hosted version available
+at http://micropython.org/webrepl), and configure it by executing::
+
+ import webrepl_setup
+
+and following on-screen instructions. After reboot, it will be available
+for connection. If you disabled automatic start-up on boot, you may
+run configured daemon on demand using::
+
+ import webrepl
+ webrepl.start()
+
+ # or, start with a specific password
+ webrepl.start(password='mypass')
+
+The WebREPL daemon listens on all active interfaces, which can be STA or
+AP. This allows you to connect to the ESP32 via a router (the STA
+interface) or directly when connected to its access point.
+
+In addition to terminal/command prompt access, WebREPL also has provision
+for file transfer (both upload and download). The web client has buttons for
+the corresponding functions, or you can use the command-line client
+``webrepl_cli.py`` from the repository above.
+
+See the MicroPython forum for other community-supported alternatives
+to transfer files to an ESP32 board.
diff --git a/components/language/micropython/docs/esp32/tutorial/index.rst b/components/language/micropython/docs/esp32/tutorial/index.rst
new file mode 100644
index 00000000..c6242d73
--- /dev/null
+++ b/components/language/micropython/docs/esp32/tutorial/index.rst
@@ -0,0 +1,23 @@
+.. _esp32_tutorial:
+
+MicroPython tutorial for ESP32
+==============================
+
+This tutorial is intended to get you started using MicroPython on the ESP32
+system-on-a-chip. If it is your first time it is recommended to follow the
+tutorial through in the order below. Otherwise the sections are mostly self
+contained, so feel free to skip to those that interest you.
+
+The tutorial does not assume that you know Python, but it also does not attempt
+to explain any of the details of the Python language. Instead it provides you
+with commands that are ready to run, and hopes that you will gain a bit of
+Python knowledge along the way. To learn more about Python itself please refer
+to ``__.
+
+.. toctree::
+ :maxdepth: 1
+ :numbered:
+
+ intro.rst
+ pwm.rst
+ peripheral_access.rst
diff --git a/components/language/micropython/docs/esp32/tutorial/intro.rst b/components/language/micropython/docs/esp32/tutorial/intro.rst
new file mode 100644
index 00000000..8ed42dbd
--- /dev/null
+++ b/components/language/micropython/docs/esp32/tutorial/intro.rst
@@ -0,0 +1,139 @@
+.. _esp32_intro:
+
+Getting started with MicroPython on the ESP32
+=============================================
+
+Using MicroPython is a great way to get the most of your ESP32 board. And
+vice versa, the ESP32 chip is a great platform for using MicroPython. This
+tutorial will guide you through setting up MicroPython, getting a prompt, using
+WebREPL, connecting to the network and communicating with the Internet, using
+the hardware peripherals, and controlling some external components.
+
+Let's get started!
+
+Requirements
+------------
+
+The first thing you need is a board with an ESP32 chip. The MicroPython
+software supports the ESP32 chip itself and any board should work. The main
+characteristic of a board is how the GPIO pins are connected to the outside
+world, and whether it includes a built-in USB-serial convertor to make the
+UART available to your PC.
+
+Names of pins will be given in this tutorial using the chip names (eg GPIO2)
+and it should be straightforward to find which pin this corresponds to on your
+particular board.
+
+Powering the board
+------------------
+
+If your board has a USB connector on it then most likely it is powered through
+this when connected to your PC. Otherwise you will need to power it directly.
+Please refer to the documentation for your board for further details.
+
+Getting the firmware
+--------------------
+
+The first thing you need to do is download the most recent MicroPython firmware
+.bin file to load onto your ESP32 device. You can download it from the
+`MicroPython downloads page `_.
+From here, you have 3 main choices:
+
+* Stable firmware builds
+* Daily firmware builds
+* Daily firmware builds with SPIRAM support
+
+If you are just starting with MicroPython, the best bet is to go for the Stable
+firmware builds. If you are an advanced, experienced MicroPython ESP32 user
+who would like to follow development closely and help with testing new
+features, there are daily builds. If your board has SPIRAM support you can
+use either the standard firmware or the firmware with SPIRAM support, and in
+the latter case you will have access to more RAM for Python objects.
+
+Deploying the firmware
+----------------------
+
+Once you have the MicroPython firmware you need to load it onto your ESP32 device.
+There are two main steps to do this: first you need to put your device in
+bootloader mode, and second you need to copy across the firmware. The exact
+procedure for these steps is highly dependent on the particular board and you will
+need to refer to its documentation for details.
+
+Fortunately, most boards have a USB connector, a USB-serial convertor, and the DTR
+and RTS pins wired in a special way then deploying the firmware should be easy as
+all steps can be done automatically. Boards that have such features
+include the Adafruit Feather HUZZAH32, M5Stack, Wemos LOLIN32, and TinyPICO
+boards, along with the Espressif DevKitC, PICO-KIT, WROVER-KIT dev-kits.
+
+For best results it is recommended to first erase the entire flash of your
+device before putting on new MicroPython firmware.
+
+Currently we only support esptool.py to copy across the firmware. You can find
+this tool here: ` `__, or install it
+using pip::
+
+ pip install esptool
+
+Versions starting with 1.3 support both Python 2.7 and Python 3.4 (or newer).
+An older version (at least 1.2.1 is needed) works fine but will require Python
+2.7.
+
+Using esptool.py you can erase the flash with the command::
+
+ esptool.py --port /dev/ttyUSB0 erase_flash
+
+And then deploy the new firmware using::
+
+ esptool.py --chip esp32 --port /dev/ttyUSB0 write_flash -z 0x1000 esp32-20180511-v1.9.4.bin
+
+Notes:
+
+* You might need to change the "port" setting to something else relevant for your
+ PC
+* You may need to reduce the baudrate if you get errors when flashing
+ (eg down to 115200 by adding ``--baud 115200`` into the command)
+* For some boards with a particular FlashROM configuration you may need to
+ change the flash mode (eg by adding ``-fm dio`` into the command)
+* The filename of the firmware should match the file that you have
+
+If the above commands run without error then MicroPython should be installed on
+your board!
+
+Serial prompt
+-------------
+
+Once you have the firmware on the device you can access the REPL (Python prompt)
+over UART0 (GPIO1=TX, GPIO3=RX), which might be connected to a USB-serial
+convertor, depending on your board. The baudrate is 115200.
+
+From here you can now follow the ESP8266 tutorial, because these two Espressif chips
+are very similar when it comes to using MicroPython on them. The ESP8266 tutorial
+is found at :ref:`esp8266_tutorial` (but skip the Introduction section).
+
+Troubleshooting installation problems
+-------------------------------------
+
+If you experience problems during flashing or with running firmware immediately
+after it, here are troubleshooting recommendations:
+
+* Be aware of and try to exclude hardware problems. There are 2 common
+ problems: bad power source quality, and worn-out/defective FlashROM.
+ Speaking of power source, not just raw amperage is important, but also low
+ ripple and noise/EMI in general. The most reliable and convenient power
+ source is a USB port.
+
+* The flashing instructions above use flashing speed of 460800 baud, which is
+ good compromise between speed and stability. However, depending on your
+ module/board, USB-UART convertor, cables, host OS, etc., the above baud
+ rate may be too high and lead to errors. Try a more common 115200 baud
+ rate instead in such cases.
+
+* To catch incorrect flash content (e.g. from a defective sector on a chip),
+ add ``--verify`` switch to the commands above.
+
+* If you still experience problems with flashing the firmware please
+ refer to esptool.py project page, https://github.com/espressif/esptool
+ for additional documentation and a bug tracker where you can report problems.
+
+* If you are able to flash the firmware but the ``--verify`` option returns
+ errors even after multiple retries the you may have a defective FlashROM chip.
diff --git a/components/language/micropython/docs/esp32/tutorial/peripheral_access.rst b/components/language/micropython/docs/esp32/tutorial/peripheral_access.rst
new file mode 100644
index 00000000..3304c341
--- /dev/null
+++ b/components/language/micropython/docs/esp32/tutorial/peripheral_access.rst
@@ -0,0 +1,44 @@
+Accessing peripherals directly via registers
+============================================
+
+The ESP32's peripherals can be controlled via direct register reads and writes.
+This requires reading the datasheet to know what registers to use and what
+values to write to them. The following example shows how to turn on and change
+the prescaler of the MCPWM0 peripheral.
+
+.. code-block:: python3
+
+ from micropython import const
+ from machine import mem32
+
+ # Define the register addresses that will be used.
+ DR_REG_DPORT_BASE = const(0x3FF00000)
+ DPORT_PERIP_CLK_EN_REG = const(DR_REG_DPORT_BASE + 0x0C0)
+ DPORT_PERIP_RST_EN_REG = const(DR_REG_DPORT_BASE + 0x0C4)
+ DPORT_PWM0_CLK_EN = const(1 << 17)
+ MCPWM0 = const(0x3FF5E000)
+ MCPWM1 = const(0x3FF6C000)
+
+ # Enable CLK and disable RST.
+ print(hex(mem32[DPORT_PERIP_CLK_EN_REG] & 0xffffffff))
+ print(hex(mem32[DPORT_PERIP_RST_EN_REG] & 0xffffffff))
+ mem32[DPORT_PERIP_CLK_EN_REG] |= DPORT_PWM0_CLK_EN
+ mem32[DPORT_PERIP_RST_EN_REG] &= ~DPORT_PWM0_CLK_EN
+ print(hex(mem32[DPORT_PERIP_CLK_EN_REG] & 0xffffffff))
+ print(hex(mem32[DPORT_PERIP_RST_EN_REG] & 0xffffffff))
+
+ # Change the MCPWM0 prescaler.
+ print(hex(mem32[MCPWM0])) # read PWM_CLK_CFG_REG (reset value = 0)
+ mem32[MCPWM0] = 0x55 # change PWM_CLK_PRESCALE
+ print(hex(mem32[MCPWM0])) # read PWM_CLK_CFG_REG
+
+Note that before a peripheral can be used its clock must be enabled and it must
+be taken out of reset. In the above example the following registers are used
+for this:
+
+- ``DPORT_PERI_CLK_EN_REG``: used to enable a peripheral clock
+
+- ``DPORT_PERI_RST_EN_REG``: used to reset (or take out of reset) a peripheral
+
+The MCPWM0 peripheral is in bit position 17 of the above two registers, hence
+the value of ``DPORT_PWM0_CLK_EN``.
diff --git a/components/language/micropython/docs/esp32/tutorial/pwm.rst b/components/language/micropython/docs/esp32/tutorial/pwm.rst
new file mode 100644
index 00000000..12d10a86
--- /dev/null
+++ b/components/language/micropython/docs/esp32/tutorial/pwm.rst
@@ -0,0 +1,115 @@
+.. _esp32_pwm:
+
+Pulse Width Modulation
+======================
+
+Pulse width modulation (PWM) is a way to get an artificial analog output on a
+digital pin. It achieves this by rapidly toggling the pin from low to high.
+There are two parameters associated with this: the frequency of the toggling,
+and the duty cycle. The duty cycle is defined to be how long the pin is high
+compared with the length of a single period (low plus high time). Maximum
+duty cycle is when the pin is high all of the time, and minimum is when it is
+low all of the time.
+
+* More comprehensive example with all 16 PWM channels and 8 timers::
+
+ from machine import Pin, PWM
+ try:
+ f = 100 # Hz
+ d = 1024 // 16 # 6.25%
+ pins = (15, 2, 4, 16, 18, 19, 22, 23, 25, 26, 27, 14 , 12, 13, 32, 33)
+ pwms = []
+ for i, pin in enumerate(pins):
+ pwms.append(PWM(Pin(pin), freq=f * (i // 2 + 1), duty= 1023 if i==15 else d * (i + 1)))
+ print(pwms[i])
+ finally:
+ for pwm in pwms:
+ try:
+ pwm.deinit()
+ except:
+ pass
+
+ Output is::
+
+ PWM(Pin(15), freq=100, duty=64, resolution=10, mode=0, channel=0, timer=0)
+ PWM(Pin(2), freq=100, duty=128, resolution=10, mode=0, channel=1, timer=0)
+ PWM(Pin(4), freq=200, duty=192, resolution=10, mode=0, channel=2, timer=1)
+ PWM(Pin(16), freq=200, duty=256, resolution=10, mode=0, channel=3, timer=1)
+ PWM(Pin(18), freq=300, duty=320, resolution=10, mode=0, channel=4, timer=2)
+ PWM(Pin(19), freq=300, duty=384, resolution=10, mode=0, channel=5, timer=2)
+ PWM(Pin(22), freq=400, duty=448, resolution=10, mode=0, channel=6, timer=3)
+ PWM(Pin(23), freq=400, duty=512, resolution=10, mode=0, channel=7, timer=3)
+ PWM(Pin(25), freq=500, duty=576, resolution=10, mode=1, channel=0, timer=0)
+ PWM(Pin(26), freq=500, duty=640, resolution=10, mode=1, channel=1, timer=0)
+ PWM(Pin(27), freq=600, duty=704, resolution=10, mode=1, channel=2, timer=1)
+ PWM(Pin(14), freq=600, duty=768, resolution=10, mode=1, channel=3, timer=1)
+ PWM(Pin(12), freq=700, duty=832, resolution=10, mode=1, channel=4, timer=2)
+ PWM(Pin(13), freq=700, duty=896, resolution=10, mode=1, channel=5, timer=2)
+ PWM(Pin(32), freq=800, duty=960, resolution=10, mode=1, channel=6, timer=3)
+ PWM(Pin(33), freq=800, duty=1023, resolution=10, mode=1, channel=7, timer=3)
+
+* Example of a smooth frequency change::
+
+ from utime import sleep
+ from machine import Pin, PWM
+
+ F_MIN = 500
+ F_MAX = 1000
+
+ f = F_MIN
+ delta_f = 1
+
+ p = PWM(Pin(5), f)
+ print(p)
+
+ while True:
+ p.freq(f)
+
+ sleep(10 / F_MIN)
+
+ f += delta_f
+ if f >= F_MAX or f <= F_MIN:
+ delta_f = -delta_f
+
+ See PWM wave at Pin(5) with an oscilloscope.
+
+* Example of a smooth duty change::
+
+ from utime import sleep
+ from machine import Pin, PWM
+
+ DUTY_MAX = 2**16 - 1
+
+ duty_u16 = 0
+ delta_d = 16
+
+ p = PWM(Pin(5), 1000, duty_u16=duty_u16)
+ print(p)
+
+ while True:
+ p.duty_u16(duty_u16)
+
+ sleep(1 / 1000)
+
+ duty_u16 += delta_d
+ if duty_u16 >= DUTY_MAX:
+ duty_u16 = DUTY_MAX
+ delta_d = -delta_d
+ elif duty_u16 <= 0:
+ duty_u16 = 0
+ delta_d = -delta_d
+
+ See PWM wave at Pin(5) with an oscilloscope.
+
+Note: the Pin.OUT mode does not need to be specified. The channel is initialized
+to PWM mode internally once for each Pin that is passed to the PWM constructor.
+
+The following code is wrong::
+
+ pwm = PWM(Pin(5, Pin.OUT), freq=1000, duty=512) # Pin(5) in PWM mode here
+ pwm = PWM(Pin(5, Pin.OUT), freq=500, duty=256) # Pin(5) in OUT mode here, PWM is off
+
+Use this code instead::
+
+ pwm = PWM(Pin(5), freq=1000, duty=512)
+ pwm.init(freq=500, duty=256)
diff --git a/components/language/micropython/docs/esp8266/general.rst b/components/language/micropython/docs/esp8266/general.rst
new file mode 100644
index 00000000..be0437e7
--- /dev/null
+++ b/components/language/micropython/docs/esp8266/general.rst
@@ -0,0 +1,211 @@
+.. _esp8266_general:
+
+General information about the ESP8266 port
+==========================================
+
+ESP8266 is a popular WiFi-enabled System-on-Chip (SoC) by Espressif Systems.
+
+Multitude of boards
+-------------------
+
+There is a multitude of modules and boards from different sources which carry
+the ESP8266 chip. MicroPython tries to provide a generic port which would run on
+as many boards/modules as possible, but there may be limitations. Adafruit
+Feather HUZZAH board is taken as a reference board for the port (for example,
+testing is performed on it). If you have another board, please make sure you
+have a datasheet, schematics and other reference materials for your board
+handy to look up various aspects of your board functioning.
+
+To make a generic ESP8266 port and support as many boards as possible,
+the following design and implementation decision were made:
+
+* GPIO pin numbering is based on ESP8266 chip numbering, not some "logical"
+ numbering of a particular board. Please have the manual/pin diagram of your board
+ at hand to find correspondence between your board pins and actual ESP8266 pins.
+ We also encourage users of various boards to share this mapping via MicroPython
+ forum, with the idea to collect community-maintained reference materials
+ eventually.
+* All pins which make sense to support, are supported by MicroPython
+ (for example, pins which are used to connect SPI flash
+ are not exposed, as they're unlikely useful for anything else, and
+ operating on them will lead to board lock-up). However, any particular
+ board may expose only subset of pins. Consult your board reference manual.
+* Some boards may lack external pins/internal connectivity to support
+ ESP8266 deepsleep mode.
+
+
+Technical specifications and SoC datasheets
+-------------------------------------------
+
+The datasheets and other reference material for ESP8266 chip are available
+from the vendor site: http://bbs.espressif.com/viewtopic.php?f=67&t=225 .
+They are the primary reference for the chip technical specifications, capabilities,
+operating modes, internal functioning, etc.
+
+For your convenience, some of technical specifications are provided below:
+
+* Architecture: Xtensa lx106
+* CPU frequency: 80MHz overclockable to 160MHz
+* Total RAM available: 96KB (part of it reserved for system)
+* BootROM: 64KB
+* Internal FlashROM: None
+* External FlashROM: code and data, via SPI Flash. Normal sizes 512KB-4MB.
+* GPIO: 16 + 1 (GPIOs are multiplexed with other functions, including
+ external FlashROM, UART, deep sleep wake-up, etc.)
+* UART: One RX/TX UART (no hardware handshaking), one TX-only UART.
+* SPI: 2 SPI interfaces (one used for FlashROM).
+* I2C: No native external I2C (bitbang implementation available on any pins).
+* I2S: 1.
+* Programming: using BootROM bootloader from UART. Due to external FlashROM
+ and always-available BootROM bootloader, ESP8266 is not brickable.
+
+
+Scarcity of runtime resources
+-----------------------------
+
+ESP8266 has very modest resources (first of all, RAM memory). So, please
+avoid allocating too big container objects (lists, dictionaries) and
+buffers. There is also no full-fledged OS to keep track of resources
+and automatically clean them up, so that's the task of a user/user
+application: please be sure to close open files, sockets, etc. as soon
+as possible after use.
+
+
+Boot process
+------------
+
+On boot, MicroPython EPS8266 port executes ``_boot.py`` script from internal
+frozen modules. It mounts filesystem in FlashROM, or if it's not available,
+performs first-time setup of the module and creates the filesystem. This
+part of the boot process is considered fixed, and not available for customization
+for end users (even if you build from source, please refrain from changes to
+it; customization of early boot process is available only to advanced users
+and developers, who can diagnose themselves any issues arising from
+modifying the standard process).
+
+Once the filesystem is mounted, ``boot.py`` is executed from it. The standard
+version of this file is created during first-time module set up and has
+commands to start a WebREPL daemon (disabled by default, configurable
+with ``webrepl_setup`` module), etc. This
+file is customizable by end users (for example, you may want to set some
+parameters or add other services which should be run on
+a module start-up). But keep in mind that incorrect modifications to boot.py
+may still lead to boot loops or lock ups, requiring to reflash a module
+from scratch. (In particular, it's recommended that you use either
+``webrepl_setup`` module or manual editing to configure WebREPL, but not
+both).
+
+As a final step of boot procedure, ``main.py`` is executed from filesystem,
+if exists. This file is a hook to start up a user application each time
+on boot (instead of going to REPL). For small test applications, you may
+name them directly as ``main.py``, and upload to module, but instead it's
+recommended to keep your application(s) in separate files, and have just
+the following in ``main.py``::
+
+ import my_app
+ my_app.main()
+
+This will allow to keep the structure of your application clear, as well as
+allow to install multiple applications on a board, and switch among them.
+
+
+Known Issues
+------------
+
+Real-time clock
+~~~~~~~~~~~~~~~
+
+RTC in ESP8266 has very bad accuracy, drift may be seconds per minute. As
+a workaround, to measure short enough intervals you can use
+``time.time()``, etc. functions, and for wall clock time, synchronize from
+the net using included ``ntptime.py`` module.
+
+Due to limitations of the ESP8266 chip the internal real-time clock (RTC)
+will overflow every 7:45h. If a long-term working RTC time is required then
+``time()`` or ``localtime()`` must be called at least once within 7 hours.
+MicroPython will then handle the overflow.
+
+Simultaneous operation of STA_IF and AP_IF
+~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+
+Simultaneous operation of STA_IF and AP_IF interfaces is supported.
+
+However, due to restrictions of the hardware, there may be performance
+issues in the AP_IF, if the STA_IF is not connected and searching.
+An application should manage these interfaces and for example
+deactivate the STA_IF in environments where only the AP_IF is used.
+
+Sockets and WiFi buffers overflow
+~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+
+Socket instances remain active until they are explicitly closed. This has two
+consequences. Firstly they occupy RAM, so an application which opens sockets
+without closing them may eventually run out of memory. Secondly not properly
+closed socket can cause the low-level part of the vendor WiFi stack to emit
+``Lmac`` errors. This occurs if data comes in for a socket and is not
+processed in a timely manner. This can overflow the WiFi stack input queue
+and lead to a deadlock. The only recovery is by a hard reset.
+
+The above may also happen after an application terminates and quits to the REPL
+for any reason including an exception. Subsequent arrival of data provokes the
+failure with the above error message repeatedly issued. So, sockets should be
+closed in any case, regardless whether an application terminates successfully
+or by an exception, for example using try/finally::
+
+ sock = socket(...)
+ try:
+ # Use sock
+ finally:
+ sock.close()
+
+
+SSL/TLS limitations
+~~~~~~~~~~~~~~~~~~~
+
+ESP8266 uses `axTLS `_ library, which is one
+of the smallest TLS libraries with compatible licensing. However, it
+also has some known issues/limitations:
+
+1. No support for Diffie-Hellman (DH) key exchange and Elliptic-curve
+ cryptography (ECC). This means it can't work with sites which require
+ the use of these features (it works ok with the typical sites that use
+ RSA certificates).
+2. Half-duplex communication nature. axTLS uses a single buffer for both
+ sending and receiving, which leads to considerable memory saving and
+ works well with protocols like HTTP. But there may be problems with
+ protocols which don't follow classic request-response model.
+
+Besides axTLS's own limitations, the configuration used for MicroPython is
+highly optimized for code size, which leads to additional limitations
+(these may be lifted in the future):
+
+3. Optimized RSA algorithms are not enabled, which may lead to slow
+ SSL handshakes.
+4. Session Reuse is not enabled, which means every connection must undergo
+ the full, expensive SSL handshake.
+
+Besides axTLS specific limitations described above, there's another generic
+limitation with usage of TLS on the low-memory devices:
+
+5. The TLS standard specifies the maximum length of the TLS record (unit
+ of TLS communication, the entire record must be buffered before it can
+ be processed) as 16KB. That's almost half of the available ESP8266 memory,
+ and inside a more or less advanced application would be hard to allocate
+ due to memory fragmentation issues. As a compromise, a smaller buffer is
+ used, with the idea that the most interesting usage for SSL would be
+ accessing various REST APIs, which usually require much smaller messages.
+ The buffers size is on the order of 5KB, and is adjusted from time to
+ time, taking as a reference being able to access https://google.com .
+ The smaller buffer however means that some sites can't be accessed using
+ it, and it's not possible to stream large amounts of data. axTLS does
+ have support for TLS's Max Fragment Size extension, but no HTTPS website
+ does, so use of the extension is really only effective for local
+ communication with other devices.
+
+There are also some not implemented features specifically in MicroPython's
+``ssl`` module based on axTLS:
+
+6. Certificates are not validated (this makes connections susceptible
+ to man-in-the-middle attacks).
+7. There is no support for client certificates (scheduled to be fixed in
+ 1.9.4 release).
diff --git a/components/language/micropython/docs/esp8266/img/adafruit_products_pinoutstop.jpg b/components/language/micropython/docs/esp8266/img/adafruit_products_pinoutstop.jpg
new file mode 100644
index 00000000..655e27ae
Binary files /dev/null and b/components/language/micropython/docs/esp8266/img/adafruit_products_pinoutstop.jpg differ
diff --git a/components/language/micropython/docs/esp8266/quickref.rst b/components/language/micropython/docs/esp8266/quickref.rst
new file mode 100644
index 00000000..4e00a922
--- /dev/null
+++ b/components/language/micropython/docs/esp8266/quickref.rst
@@ -0,0 +1,466 @@
+.. _esp8266_quickref:
+
+Quick reference for the ESP8266
+===============================
+
+.. image:: img/adafruit_products_pinoutstop.jpg
+ :alt: Adafruit Feather HUZZAH board
+ :width: 640px
+
+The Adafruit Feather HUZZAH board (image attribution: Adafruit).
+
+Below is a quick reference for ESP8266-based boards. If it is your first time
+working with this board please consider reading the following sections first:
+
+.. toctree::
+ :maxdepth: 1
+
+ general.rst
+ tutorial/index.rst
+
+Installing MicroPython
+----------------------
+
+See the corresponding section of tutorial: :ref:`intro`. It also includes
+a troubleshooting subsection.
+
+General board control
+---------------------
+
+The MicroPython REPL is on UART0 (GPIO1=TX, GPIO3=RX) at baudrate 115200.
+Tab-completion is useful to find out what methods an object has.
+Paste mode (ctrl-E) is useful to paste a large slab of Python code into
+the REPL.
+
+The :mod:`machine` module::
+
+ import machine
+
+ machine.freq() # get the current frequency of the CPU
+ machine.freq(160000000) # set the CPU frequency to 160 MHz
+
+The :mod:`esp` module::
+
+ import esp
+
+ esp.osdebug(None) # turn off vendor O/S debugging messages
+ esp.osdebug(0) # redirect vendor O/S debugging messages to UART(0)
+
+Networking
+----------
+
+The :mod:`network` module::
+
+ import network
+
+ wlan = network.WLAN(network.STA_IF) # create station interface
+ wlan.active(True) # activate the interface
+ wlan.scan() # scan for access points
+ wlan.isconnected() # check if the station is connected to an AP
+ wlan.connect('essid', 'password') # connect to an AP
+ wlan.config('mac') # get the interface's MAC address
+ wlan.ifconfig() # get the interface's IP/netmask/gw/DNS addresses
+
+ ap = network.WLAN(network.AP_IF) # create access-point interface
+ ap.active(True) # activate the interface
+ ap.config(essid='ESP-AP') # set the ESSID of the access point
+
+A useful function for connecting to your local WiFi network is::
+
+ def do_connect():
+ import network
+ wlan = network.WLAN(network.STA_IF)
+ wlan.active(True)
+ if not wlan.isconnected():
+ print('connecting to network...')
+ wlan.connect('essid', 'password')
+ while not wlan.isconnected():
+ pass
+ print('network config:', wlan.ifconfig())
+
+Once the network is established the :mod:`socket ` module can be used
+to create and use TCP/UDP sockets as usual.
+
+Delay and timing
+----------------
+
+Use the :mod:`time ` module::
+
+ import time
+
+ time.sleep(1) # sleep for 1 second
+ time.sleep_ms(500) # sleep for 500 milliseconds
+ time.sleep_us(10) # sleep for 10 microseconds
+ start = time.ticks_ms() # get millisecond counter
+ delta = time.ticks_diff(time.ticks_ms(), start) # compute time difference
+
+Timers
+------
+
+Virtual (RTOS-based) timers are supported. Use the :ref:`machine.Timer ` class
+with timer ID of -1::
+
+ from machine import Timer
+
+ tim = Timer(-1)
+ tim.init(period=5000, mode=Timer.ONE_SHOT, callback=lambda t:print(1))
+ tim.init(period=2000, mode=Timer.PERIODIC, callback=lambda t:print(2))
+
+The period is in milliseconds.
+
+Pins and GPIO
+-------------
+
+Use the :ref:`machine.Pin ` class::
+
+ from machine import Pin
+
+ p0 = Pin(0, Pin.OUT) # create output pin on GPIO0
+ p0.on() # set pin to "on" (high) level
+ p0.off() # set pin to "off" (low) level
+ p0.value(1) # set pin to on/high
+
+ p2 = Pin(2, Pin.IN) # create input pin on GPIO2
+ print(p2.value()) # get value, 0 or 1
+
+ p4 = Pin(4, Pin.IN, Pin.PULL_UP) # enable internal pull-up resistor
+ p5 = Pin(5, Pin.OUT, value=1) # set pin high on creation
+
+Available pins are: 0, 1, 2, 3, 4, 5, 12, 13, 14, 15, 16, which correspond
+to the actual GPIO pin numbers of ESP8266 chip. Note that many end-user
+boards use their own adhoc pin numbering (marked e.g. D0, D1, ...). As
+MicroPython supports different boards and modules, physical pin numbering
+was chosen as the lowest common denominator. For mapping between board
+logical pins and physical chip pins, consult your board documentation.
+
+Note that Pin(1) and Pin(3) are REPL UART TX and RX respectively.
+Also note that Pin(16) is a special pin (used for wakeup from deepsleep
+mode) and may be not available for use with higher-level classes like
+``Neopixel``.
+
+There's a higher-level abstraction :ref:`machine.Signal `
+which can be used to invert a pin. Useful for illuminating active-low LEDs
+using ``on()`` or ``value(1)``.
+
+UART (serial bus)
+-----------------
+
+See :ref:`machine.UART `. ::
+
+ from machine import UART
+ uart = UART(0, baudrate=9600)
+ uart.write('hello')
+ uart.read(5) # read up to 5 bytes
+
+Two UARTs are available. UART0 is on Pins 1 (TX) and 3 (RX). UART0 is
+bidirectional, and by default is used for the REPL. UART1 is on Pins 2
+(TX) and 8 (RX) however Pin 8 is used to connect the flash chip, so
+UART1 is TX only.
+
+When UART0 is attached to the REPL, all incoming chars on UART(0) go
+straight to stdin so uart.read() will always return None. Use
+sys.stdin.read() if it's needed to read characters from the UART(0)
+while it's also used for the REPL (or detach, read, then reattach).
+When detached the UART(0) can be used for other purposes.
+
+If there are no objects in any of the dupterm slots when the REPL is
+started (on hard or soft reset) then UART(0) is automatically attached.
+Without this, the only way to recover a board without a REPL would be to
+completely erase and reflash (which would install the default boot.py which
+attaches the REPL).
+
+To detach the REPL from UART0, use::
+
+ import os
+ os.dupterm(None, 1)
+
+The REPL is attached by default. If you have detached it, to reattach
+it use::
+
+ import os, machine
+ uart = machine.UART(0, 115200)
+ os.dupterm(uart, 1)
+
+PWM (pulse width modulation)
+----------------------------
+
+PWM can be enabled on all pins except Pin(16). There is a single frequency
+for all channels, with range between 1 and 1000 (measured in Hz). The duty
+cycle is between 0 and 1023 inclusive.
+
+Use the ``machine.PWM`` class::
+
+ from machine import Pin, PWM
+
+ pwm0 = PWM(Pin(0)) # create PWM object from a pin
+ pwm0.freq() # get current frequency
+ pwm0.freq(1000) # set frequency
+ pwm0.duty() # get current duty cycle
+ pwm0.duty(200) # set duty cycle
+ pwm0.deinit() # turn off PWM on the pin
+
+ pwm2 = PWM(Pin(2), freq=500, duty=512) # create and configure in one go
+
+ADC (analog to digital conversion)
+----------------------------------
+
+ADC is available on a dedicated pin.
+Note that input voltages on the ADC pin must be between 0v and 1.0v.
+
+Use the :ref:`machine.ADC ` class::
+
+ from machine import ADC
+
+ adc = ADC(0) # create ADC object on ADC pin
+ adc.read() # read value, 0-1024
+
+Software SPI bus
+----------------
+
+There are two SPI drivers. One is implemented in software (bit-banging)
+and works on all pins, and is accessed via the :ref:`machine.SoftSPI `
+class::
+
+ from machine import Pin, SoftSPI
+
+ # construct an SPI bus on the given pins
+ # polarity is the idle state of SCK
+ # phase=0 means sample on the first edge of SCK, phase=1 means the second
+ spi = SoftSPI(baudrate=100000, polarity=1, phase=0, sck=Pin(0), mosi=Pin(2), miso=Pin(4))
+
+ spi.init(baudrate=200000) # set the baudrate
+
+ spi.read(10) # read 10 bytes on MISO
+ spi.read(10, 0xff) # read 10 bytes while outputting 0xff on MOSI
+
+ buf = bytearray(50) # create a buffer
+ spi.readinto(buf) # read into the given buffer (reads 50 bytes in this case)
+ spi.readinto(buf, 0xff) # read into the given buffer and output 0xff on MOSI
+
+ spi.write(b'12345') # write 5 bytes on MOSI
+
+ buf = bytearray(4) # create a buffer
+ spi.write_readinto(b'1234', buf) # write to MOSI and read from MISO into the buffer
+ spi.write_readinto(buf, buf) # write buf to MOSI and read MISO back into buf
+
+
+Hardware SPI bus
+----------------
+
+The hardware SPI is faster (up to 80Mhz), but only works on following pins:
+``MISO`` is GPIO12, ``MOSI`` is GPIO13, and ``SCK`` is GPIO14. It has the same
+methods as the bitbanging SPI class above, except for the pin parameters for the
+constructor and init (as those are fixed)::
+
+ from machine import Pin, SPI
+
+ hspi = SPI(1, baudrate=80000000, polarity=0, phase=0)
+
+(``SPI(0)`` is used for FlashROM and not available to users.)
+
+I2C bus
+-------
+
+The I2C driver is implemented in software and works on all pins,
+and is accessed via the :ref:`machine.I2C ` class (which is an
+alias of :ref:`machine.SoftI2C `)::
+
+ from machine import Pin, I2C
+
+ # construct an I2C bus
+ i2c = I2C(scl=Pin(5), sda=Pin(4), freq=100000)
+
+ i2c.readfrom(0x3a, 4) # read 4 bytes from peripheral device with address 0x3a
+ i2c.writeto(0x3a, '12') # write '12' to peripheral device with address 0x3a
+
+ buf = bytearray(10) # create a buffer with 10 bytes
+ i2c.writeto(0x3a, buf) # write the given buffer to the peripheral
+
+Real time clock (RTC)
+---------------------
+
+See :ref:`machine.RTC ` ::
+
+ from machine import RTC
+
+ rtc = RTC()
+ rtc.datetime((2017, 8, 23, 1, 12, 48, 0, 0)) # set a specific date and time
+ rtc.datetime() # get date and time
+
+ # synchronize with ntp
+ # need to be connected to wifi
+ import ntptime
+ ntptime.settime() # set the rtc datetime from the remote server
+ rtc.datetime() # get the date and time in UTC
+
+.. note:: Not all methods are implemented: `RTC.now()`, `RTC.irq(handler=*) `
+ (using a custom handler), `RTC.init()` and `RTC.deinit()` are
+ currently not supported.
+
+WDT (Watchdog timer)
+--------------------
+
+See :ref:`machine.WDT `. ::
+
+ from machine import WDT
+
+ # enable the WDT
+ wdt = WDT()
+ wdt.feed()
+
+Deep-sleep mode
+---------------
+
+Connect GPIO16 to the reset pin (RST on HUZZAH). Then the following code
+can be used to sleep, wake and check the reset cause::
+
+ import machine
+
+ # configure RTC.ALARM0 to be able to wake the device
+ rtc = machine.RTC()
+ rtc.irq(trigger=rtc.ALARM0, wake=machine.DEEPSLEEP)
+
+ # check if the device woke from a deep sleep
+ if machine.reset_cause() == machine.DEEPSLEEP_RESET:
+ print('woke from a deep sleep')
+
+ # set RTC.ALARM0 to fire after 10 seconds (waking the device)
+ rtc.alarm(rtc.ALARM0, 10000)
+
+ # put the device to sleep
+ machine.deepsleep()
+
+OneWire driver
+--------------
+
+The OneWire driver is implemented in software and works on all pins::
+
+ from machine import Pin
+ import onewire
+
+ ow = onewire.OneWire(Pin(12)) # create a OneWire bus on GPIO12
+ ow.scan() # return a list of devices on the bus
+ ow.reset() # reset the bus
+ ow.readbyte() # read a byte
+ ow.writebyte(0x12) # write a byte on the bus
+ ow.write('123') # write bytes on the bus
+ ow.select_rom(b'12345678') # select a specific device by its ROM code
+
+There is a specific driver for DS18S20 and DS18B20 devices::
+
+ import time, ds18x20
+ ds = ds18x20.DS18X20(ow)
+ roms = ds.scan()
+ ds.convert_temp()
+ time.sleep_ms(750)
+ for rom in roms:
+ print(ds.read_temp(rom))
+
+Be sure to put a 4.7k pull-up resistor on the data line. Note that
+the ``convert_temp()`` method must be called each time you want to
+sample the temperature.
+
+NeoPixel driver
+---------------
+
+Use the ``neopixel`` module::
+
+ from machine import Pin
+ from neopixel import NeoPixel
+
+ pin = Pin(0, Pin.OUT) # set GPIO0 to output to drive NeoPixels
+ np = NeoPixel(pin, 8) # create NeoPixel driver on GPIO0 for 8 pixels
+ np[0] = (255, 255, 255) # set the first pixel to white
+ np.write() # write data to all pixels
+ r, g, b = np[0] # get first pixel colour
+
+.. Warning::
+ By default ``NeoPixel`` is configured to control the more popular *800kHz*
+ units. It is possible to use alternative timing to control other (typically
+ 400kHz) devices by passing ``timing=0`` when constructing the
+ ``NeoPixel`` object.
+
+For low-level driving of a NeoPixel see `machine.bitstream`.
+
+APA102 driver
+-------------
+
+Use the ``apa102`` module::
+
+ from machine import Pin
+ from apa102 import APA102
+
+ clock = Pin(14, Pin.OUT) # set GPIO14 to output to drive the clock
+ data = Pin(13, Pin.OUT) # set GPIO13 to output to drive the data
+ apa = APA102(clock, data, 8) # create APA102 driver on the clock and the data pin for 8 pixels
+ apa[0] = (255, 255, 255, 31) # set the first pixel to white with a maximum brightness of 31
+ apa.write() # write data to all pixels
+ r, g, b, brightness = apa[0] # get first pixel colour
+
+For low-level driving of an APA102::
+
+ import esp
+ esp.apa102_write(clock_pin, data_pin, rgbi_buf)
+
+DHT driver
+----------
+
+The DHT driver is implemented in software and works on all pins::
+
+ import dht
+ import machine
+
+ d = dht.DHT11(machine.Pin(4))
+ d.measure()
+ d.temperature() # eg. 23 (°C)
+ d.humidity() # eg. 41 (% RH)
+
+ d = dht.DHT22(machine.Pin(4))
+ d.measure()
+ d.temperature() # eg. 23.6 (°C)
+ d.humidity() # eg. 41.3 (% RH)
+
+SSD1306 driver
+--------------
+
+Driver for SSD1306 monochrome OLED displays. See tutorial :ref:`ssd1306`. ::
+
+ from machine import Pin, I2C
+ import ssd1306
+
+ i2c = I2C(scl=Pin(5), sda=Pin(4), freq=100000)
+ display = ssd1306.SSD1306_I2C(128, 64, i2c)
+
+ display.text('Hello World', 0, 0, 1)
+ display.show()
+
+WebREPL (web browser interactive prompt)
+----------------------------------------
+
+WebREPL (REPL over WebSockets, accessible via a web browser) is an
+experimental feature available in ESP8266 port. Download web client
+from https://github.com/micropython/webrepl (hosted version available
+at http://micropython.org/webrepl), and configure it by executing::
+
+ import webrepl_setup
+
+and following on-screen instructions. After reboot, it will be available
+for connection. If you disabled automatic start-up on boot, you may
+run configured daemon on demand using::
+
+ import webrepl
+ webrepl.start()
+
+The supported way to use WebREPL is by connecting to ESP8266 access point,
+but the daemon is also started on STA interface if it is active, so if your
+router is set up and works correctly, you may also use WebREPL while connected
+to your normal Internet access point (use the ESP8266 AP connection method
+if you face any issues).
+
+Besides terminal/command prompt access, WebREPL also has provision for file
+transfer (both upload and download). Web client has buttons for the
+corresponding functions, or you can use command-line client ``webrepl_cli.py``
+from the repository above.
+
+See the MicroPython forum for other community-supported alternatives
+to transfer files to ESP8266.
diff --git a/components/language/micropython/docs/esp8266/tutorial/adc.rst b/components/language/micropython/docs/esp8266/tutorial/adc.rst
new file mode 100644
index 00000000..fa6fdaba
--- /dev/null
+++ b/components/language/micropython/docs/esp8266/tutorial/adc.rst
@@ -0,0 +1,19 @@
+Analog to Digital Conversion
+============================
+
+The ESP8266 has a single pin (separate to the GPIO pins) which can be used to
+read analog voltages and convert them to a digital value. You can construct
+such an ADC pin object using::
+
+ >>> import machine
+ >>> adc = machine.ADC(0)
+
+Then read its value with::
+
+ >>> adc.read()
+ 58
+
+The values returned from the ``read()`` function are between 0 (for 0.0 volts)
+and 1024 (for 1.0 volts). Please note that this input can only tolerate a
+maximum of 1.0 volts and you must use a voltage divider circuit to measure
+larger voltages.
diff --git a/components/language/micropython/docs/esp8266/tutorial/apa102.rst b/components/language/micropython/docs/esp8266/tutorial/apa102.rst
new file mode 100644
index 00000000..1c775daa
--- /dev/null
+++ b/components/language/micropython/docs/esp8266/tutorial/apa102.rst
@@ -0,0 +1,91 @@
+Controlling APA102 LEDs
+=======================
+
+APA102 LEDs, also known as DotStar LEDs, are individually addressable
+full-colour RGB LEDs, generally in a string formation. They differ from
+NeoPixels in that they require two pins to control - both a Clock and Data pin.
+They can operate at a much higher data and PWM frequencies than NeoPixels and
+are more suitable for persistence-of-vision effects.
+
+To create an APA102 object do the following::
+
+ >>> import machine, apa102
+ >>> strip = apa102.APA102(machine.Pin(5), machine.Pin(4), 60)
+
+This configures an 60 pixel APA102 strip with clock on GPIO5 and data on GPIO4.
+You can adjust the pin numbers and the number of pixels to suit your needs.
+
+The RGB colour data, as well as a brightness level, is sent to the APA102 in a
+certain order. Usually this is ``(Red, Green, Blue, Brightness)``.
+If you are using one of the newer APA102C LEDs the green and blue are swapped,
+so the order is ``(Red, Blue, Green, Brightness)``.
+The APA102 has more of a square lens while the APA102C has more of a round one.
+If you are using a APA102C strip and would prefer to provide colours in RGB
+order instead of RBG, you can customise the tuple colour order like so::
+
+ >>> strip.ORDER = (0, 2, 1, 3)
+
+To set the colour of pixels use::
+
+ >>> strip[0] = (255, 255, 255, 31) # set to white, full brightness
+ >>> strip[1] = (255, 0, 0, 31) # set to red, full brightness
+ >>> strip[2] = (0, 255, 0, 15) # set to green, half brightness
+ >>> strip[3] = (0, 0, 255, 7) # set to blue, quarter brightness
+
+Use the ``write()`` method to output the colours to the LEDs::
+
+ >>> strip.write()
+
+Demonstration::
+
+ import time
+ import machine, apa102
+
+ # 1M strip with 60 LEDs
+ strip = apa102.APA102(machine.Pin(5), machine.Pin(4), 60)
+
+ brightness = 1 # 0 is off, 1 is dim, 31 is max
+
+ # Helper for converting 0-255 offset to a colour tuple
+ def wheel(offset, brightness):
+ # The colours are a transition r - g - b - back to r
+ offset = 255 - offset
+ if offset < 85:
+ return (255 - offset * 3, 0, offset * 3, brightness)
+ if offset < 170:
+ offset -= 85
+ return (0, offset * 3, 255 - offset * 3, brightness)
+ offset -= 170
+ return (offset * 3, 255 - offset * 3, 0, brightness)
+
+ # Demo 1: RGB RGB RGB
+ red = 0xff0000
+ green = red >> 8
+ blue = red >> 16
+ for i in range(strip.n):
+ colour = red >> (i % 3) * 8
+ strip[i] = ((colour & red) >> 16, (colour & green) >> 8, (colour & blue), brightness)
+ strip.write()
+
+ # Demo 2: Show all colours of the rainbow
+ for i in range(strip.n):
+ strip[i] = wheel((i * 256 // strip.n) % 255, brightness)
+ strip.write()
+
+ # Demo 3: Fade all pixels together through rainbow colours, offset each pixel
+ for r in range(5):
+ for n in range(256):
+ for i in range(strip.n):
+ strip[i] = wheel(((i * 256 // strip.n) + n) & 255, brightness)
+ strip.write()
+ time.sleep_ms(25)
+
+ # Demo 4: Same colour, different brightness levels
+ for b in range(31,-1,-1):
+ strip[0] = (255, 153, 0, b)
+ strip.write()
+ time.sleep_ms(250)
+
+ # End: Turn off all the LEDs
+ strip.fill((0, 0, 0, 0))
+ strip.write()
diff --git a/components/language/micropython/docs/esp8266/tutorial/dht.rst b/components/language/micropython/docs/esp8266/tutorial/dht.rst
new file mode 100644
index 00000000..1602e8a3
--- /dev/null
+++ b/components/language/micropython/docs/esp8266/tutorial/dht.rst
@@ -0,0 +1,65 @@
+Temperature and Humidity
+========================
+
+DHT (Digital Humidity & Temperature) sensors are low cost digital sensors with
+capacitive humidity sensors and thermistors to measure the surrounding air.
+They feature a chip that handles analog to digital conversion and provide a
+1-wire interface. Newer sensors additionally provide an I2C interface.
+
+The DHT11 (blue) and DHT22 (white) sensors provide the same 1-wire interface,
+however, the DHT22 requires a separate object as it has more complex
+calculation. DHT22 have 1 decimal place resolution for both humidity and
+temperature readings. DHT11 have whole number for both.
+
+A custom 1-wire protocol, which is different to Dallas 1-wire, is used to get
+the measurements from the sensor. The payload consists of a humidity value,
+a temperature value and a checksum.
+
+To use the 1-wire interface, construct the objects referring to their data pin::
+
+ >>> import dht
+ >>> import machine
+ >>> d = dht.DHT11(machine.Pin(4))
+
+ >>> import dht
+ >>> import machine
+ >>> d = dht.DHT22(machine.Pin(4))
+
+Then measure and read their values with::
+
+ >>> d.measure()
+ >>> d.temperature()
+ >>> d.humidity()
+
+Values returned from ``temperature()`` are in degrees Celsius and values
+returned from ``humidity()`` are a percentage of relative humidity.
+
+The DHT11 can be called no more than once per second and the DHT22 once every
+two seconds for most accurate results. Sensor accuracy will degrade over time.
+Each sensor supports a different operating range. Refer to the product
+datasheets for specifics.
+
+In 1-wire mode, only three of the four pins are used and in I2C mode, all four
+pins are used. Older sensors may still have 4 pins even though they do not
+support I2C. The 3rd pin is simply not connected.
+
+Pin configurations:
+
+Sensor without I2C in 1-wire mode (eg. DHT11, DHT22, AM2301, AM2302):
+
+ 1=VDD, 2=Data, 3=NC, 4=GND
+
+Sensor with I2C in 1-wire mode (eg. DHT12, AM2320, AM2321, AM2322):
+
+ 1=VDD, 2=Data, 3=GND, 4=GND
+
+Sensor with I2C in I2C mode (eg. DHT12, AM2320, AM2321, AM2322):
+
+ 1=VDD, 2=SDA, 3=GND, 4=SCL
+
+You should use pull-up resistors for the Data, SDA and SCL pins.
+
+To make newer I2C sensors work in backwards compatible 1-wire mode, you must
+connect both pins 3 and 4 to GND. This disables the I2C interface.
+
+DHT22 sensors are now sold under the name AM2302 and are otherwise identical.
diff --git a/components/language/micropython/docs/esp8266/tutorial/filesystem.rst b/components/language/micropython/docs/esp8266/tutorial/filesystem.rst
new file mode 100644
index 00000000..27b0d260
--- /dev/null
+++ b/components/language/micropython/docs/esp8266/tutorial/filesystem.rst
@@ -0,0 +1,69 @@
+The internal filesystem
+=======================
+
+If your devices has 1Mbyte or more of storage then it will be set up (upon first
+boot) to contain a filesystem. This filesystem uses the FAT format and is
+stored in the flash after the MicroPython firmware.
+
+Creating and reading files
+--------------------------
+
+MicroPython on the ESP8266 supports the standard way of accessing files in
+Python, using the built-in ``open()`` function.
+
+To create a file try::
+
+ >>> f = open('data.txt', 'w')
+ >>> f.write('some data')
+ 9
+ >>> f.close()
+
+The "9" is the number of bytes that were written with the ``write()`` method.
+Then you can read back the contents of this new file using::
+
+ >>> f = open('data.txt')
+ >>> f.read()
+ 'some data'
+ >>> f.close()
+
+Note that the default mode when opening a file is to open it in read-only mode,
+and as a text file. Specify ``'wb'`` as the second argument to ``open()`` to
+open for writing in binary mode, and ``'rb'`` to open for reading in binary
+mode.
+
+Listing file and more
+---------------------
+
+The os module can be used for further control over the filesystem. First
+import the module::
+
+ >>> import os
+
+Then try listing the contents of the filesystem::
+
+ >>> os.listdir()
+ ['boot.py', 'port_config.py', 'data.txt']
+
+You can make directories::
+
+ >>> os.mkdir('dir')
+
+And remove entries::
+
+ >>> os.remove('data.txt')
+
+Start up scripts
+----------------
+
+There are two files that are treated specially by the ESP8266 when it starts up:
+boot.py and main.py. The boot.py script is executed first (if it exists) and
+then once it completes the main.py script is executed. You can create these
+files yourself and populate them with the code that you want to run when the
+device starts up.
+
+Accessing the filesystem via WebREPL
+------------------------------------
+
+You can access the filesystem over WebREPL using the web client in a browser
+or via the command-line tool. Please refer to Quick Reference and Tutorial
+sections for more information about WebREPL.
diff --git a/components/language/micropython/docs/esp8266/tutorial/index.rst b/components/language/micropython/docs/esp8266/tutorial/index.rst
new file mode 100644
index 00000000..79ebd922
--- /dev/null
+++ b/components/language/micropython/docs/esp8266/tutorial/index.rst
@@ -0,0 +1,35 @@
+.. _esp8266_tutorial:
+
+MicroPython tutorial for ESP8266
+================================
+
+This tutorial is intended to get you started using MicroPython on the ESP8266
+system-on-a-chip. If it is your first time it is recommended to follow the
+tutorial through in the order below. Otherwise the sections are mostly self
+contained, so feel free to skip to those that interest you.
+
+The tutorial does not assume that you know Python, but it also does not attempt
+to explain any of the details of the Python language. Instead it provides you
+with commands that are ready to run, and hopes that you will gain a bit of
+Python knowledge along the way. To learn more about Python itself please refer
+to ``__.
+
+.. toctree::
+ :maxdepth: 1
+ :numbered:
+
+ intro.rst
+ repl.rst
+ filesystem.rst
+ network_basics.rst
+ network_tcp.rst
+ pins.rst
+ pwm.rst
+ adc.rst
+ powerctrl.rst
+ onewire.rst
+ neopixel.rst
+ apa102.rst
+ dht.rst
+ ssd1306.rst
+ nextsteps.rst
diff --git a/components/language/micropython/docs/esp8266/tutorial/intro.rst b/components/language/micropython/docs/esp8266/tutorial/intro.rst
new file mode 100644
index 00000000..ac46e68b
--- /dev/null
+++ b/components/language/micropython/docs/esp8266/tutorial/intro.rst
@@ -0,0 +1,212 @@
+.. _intro:
+
+Getting started with MicroPython on the ESP8266
+===============================================
+
+Using MicroPython is a great way to get the most of your ESP8266 board. And
+vice versa, the ESP8266 chip is a great platform for using MicroPython. This
+tutorial will guide you through setting up MicroPython, getting a prompt, using
+WebREPL, connecting to the network and communicating with the Internet, using
+the hardware peripherals, and controlling some external components.
+
+Let's get started!
+
+Requirements
+------------
+
+The first thing you need is a board with an ESP8266 chip. The MicroPython
+software supports the ESP8266 chip itself and any board should work. The main
+characteristic of a board is how much flash it has, how the GPIO pins are
+connected to the outside world, and whether it includes a built-in USB-serial
+convertor to make the UART available to your PC.
+
+The minimum requirement for flash size is 1Mbyte. There is also a special
+build for boards with 512KB, but it is highly limited comparing to the
+normal build: there is no support for filesystem, and thus features which
+depend on it won't work (WebREPL, upip, etc.). As such, 512KB build will
+be more interesting for users who build from source and fine-tune parameters
+for their particular application.
+
+Names of pins will be given in this tutorial using the chip names (eg GPIO0)
+and it should be straightforward to find which pin this corresponds to on your
+particular board.
+
+Powering the board
+------------------
+
+If your board has a USB connector on it then most likely it is powered through
+this when connected to your PC. Otherwise you will need to power it directly.
+Please refer to the documentation for your board for further details.
+
+Getting the firmware
+--------------------
+
+The first thing you need to do is download the most recent MicroPython firmware
+.bin file to load onto your ESP8266 device. You can download it from the
+`MicroPython downloads page `_.
+From here, you have 3 main choices
+
+* Stable firmware builds for 1024kb modules and above.
+* Daily firmware builds for 1024kb modules and above.
+* Daily firmware builds for 512kb modules.
+
+If you are just starting with MicroPython, the best bet is to go for the Stable
+firmware builds. If you are an advanced, experienced MicroPython ESP8266 user
+who would like to follow development closely and help with testing new
+features, there are daily builds (note: you actually may need some
+development experience, e.g. being ready to follow git history to know
+what new changes and features were introduced).
+
+Support for 512kb modules is provided on a feature preview basis. For end
+users, it's recommended to use modules with flash of 1024kb or more. As
+such, only daily builds for 512kb modules are provided.
+
+Deploying the firmware
+----------------------
+
+Once you have the MicroPython firmware (compiled code), you need to load it onto
+your ESP8266 device. There are two main steps to do this: first you
+need to put your device in boot-loader mode, and second you need to copy across
+the firmware. The exact procedure for these steps is highly dependent on the
+particular board and you will need to refer to its documentation for details.
+
+If you have a board that has a USB connector, a USB-serial convertor, and has
+the DTR and RTS pins wired in a special way then deploying the firmware should
+be easy as all steps can be done automatically. Boards that have such features
+include the Adafruit Feather HUZZAH and NodeMCU boards.
+
+If you do not have such a board, you need keep GPIO0 pulled to ground and reset
+the device by pulling the reset pin to ground and releasing it again to enter
+programming mode.
+
+For best results it is recommended to first erase the entire flash of your
+device before putting on new MicroPython firmware.
+
+Currently we only support esptool.py to copy across the firmware. You can find
+this tool here: ` `__, or install it
+using pip::
+
+ pip install esptool
+
+Versions starting with 1.3 support both Python 2.7 and Python 3.4 (or newer).
+An older version (at least 1.2.1 is needed) works fine but will require Python
+2.7.
+
+Any other flashing program should work, so feel free to try them out or refer
+to the documentation for your board to see its recommendations.
+
+Using esptool.py you can erase the flash with the command::
+
+ esptool.py --port /dev/ttyUSB0 erase_flash
+
+And then deploy the new firmware using::
+
+ esptool.py --port /dev/ttyUSB0 --baud 460800 write_flash --flash_size=detect 0 esp8266-20170108-v1.8.7.bin
+
+You might need to change the "port" setting to something else relevant for your
+PC. You may also need to reduce the baudrate if you get errors when flashing
+(eg down to 115200). The filename of the firmware should also match the file
+that you have.
+
+For some boards with a particular FlashROM configuration (e.g. some variants of
+a NodeMCU board) you may need to manually set a compatible
+`SPI Flash Mode `_.
+You'd usually pick the fastest option that is compatible with your device, but
+the ``-fm dout`` option (the slowest option) should have the best compatibility::
+
+ esptool.py --port /dev/ttyUSB0 --baud 460800 write_flash --flash_size=detect -fm dout 0 esp8266-20170108-v1.8.7.bin
+
+If the above commands run without error then MicroPython should be installed on
+your board!
+
+If you pulled GPIO0 manually to ground to enter programming mode, release it
+now and reset the device by again pulling the reset pin to ground for a short
+duration.
+
+Serial prompt
+-------------
+
+Once you have the firmware on the device you can access the REPL (Python prompt)
+over UART0 (GPIO1=TX, GPIO3=RX), which might be connected to a USB-serial
+convertor, depending on your board. The baudrate is 115200. The next part of
+the tutorial will discuss the prompt in more detail.
+
+WiFi
+----
+
+After a fresh install and boot the device configures itself as a WiFi access
+point (AP) that you can connect to. The ESSID is of the form MicroPython-xxxxxx
+where the x's are replaced with part of the MAC address of your device (so will
+be the same everytime, and most likely different for all ESP8266 chips). The
+password for the WiFi is micropythoN (note the upper-case N). Its IP address
+will be 192.168.4.1 once you connect to its network. WiFi configuration will
+be discussed in more detail later in the tutorial.
+
+Troubleshooting installation problems
+-------------------------------------
+
+If you experience problems during flashing or with running firmware immediately
+after it, here are troubleshooting recommendations:
+
+* Be aware of and try to exclude hardware problems. There are 2 common problems:
+ bad power source quality and worn-out/defective FlashROM. Speaking of power
+ source, not just raw amperage is important, but also low ripple and noise/EMI
+ in general. If you experience issues with self-made or wall-wart style power
+ supply, try USB power from a computer. Unearthed power supplies are also known
+ to cause problems as they source of increased EMI (electromagnetic interference)
+ - at the very least, and may lead to electrical devices breakdown. So, you are
+ advised to avoid using unearthed power connections when working with ESP8266
+ and other boards. In regard to FlashROM hardware problems, there are independent
+ (not related to MicroPython in any way) reports
+ `(e.g.) `_
+ that on some ESP8266 modules, FlashROM can be programmed as little as 20 times
+ before programming errors occur. This is *much* less than 100,000 programming
+ cycles cited for FlashROM chips of a type used with ESP8266 by reputable
+ vendors, which points to either production rejects, or second-hand worn-out
+ flash chips to be used on some (apparently cheap) modules/boards. You may want
+ to use your best judgement about source, price, documentation, warranty,
+ post-sales support for the modules/boards you purchase.
+
+* The flashing instructions above use flashing speed of 460800 baud, which is
+ good compromise between speed and stability. However, depending on your
+ module/board, USB-UART convertor, cables, host OS, etc., the above baud
+ rate may be too high and lead to errors. Try a more common 115200 baud
+ rate instead in such cases.
+
+* If lower baud rate didn't help, you may want to try older version of
+ esptool.py, which had a different programming algorithm::
+
+ pip install esptool==1.0.1
+
+ This version doesn't support ``--flash_size=detect`` option, so you will
+ need to specify FlashROM size explicitly (in megabits). It also requires
+ Python 2.7, so you may need to use ``pip2`` instead of ``pip`` in the
+ command above.
+
+* The ``--flash_size`` option in the commands above is mandatory. Omitting
+ it will lead to a corrupted firmware.
+
+* To catch incorrect flash content (e.g. from a defective sector on a chip),
+ add ``--verify`` switch to the commands above.
+
+* Additionally, you can check the firmware integrity from a MicroPython REPL
+ prompt (assuming you were able to flash it and ``--verify`` option doesn't
+ report errors)::
+
+ import esp
+ esp.check_fw()
+
+ If the last output value is True, the firmware is OK. Otherwise, it's
+ corrupted and need to be reflashed correctly.
+
+* If you experience any issues with another flashing application (not
+ esptool.py), try esptool.py, it is a generally accepted flashing
+ application in the ESP8266 community.
+
+* If you still experience problems with even flashing the firmware, please
+ refer to esptool.py project page, https://github.com/espressif/esptool
+ for additional documentation and bug tracker where you can report problems.
+
+* If you are able to flash firmware, but ``--verify`` option or
+ ``esp.check_fw()`` return errors even after multiple retries, you
+ may have a defective FlashROM chip, as explained above.
diff --git a/components/language/micropython/docs/esp8266/tutorial/neopixel.rst b/components/language/micropython/docs/esp8266/tutorial/neopixel.rst
new file mode 100644
index 00000000..a1537526
--- /dev/null
+++ b/components/language/micropython/docs/esp8266/tutorial/neopixel.rst
@@ -0,0 +1,84 @@
+Controlling NeoPixels
+=====================
+
+NeoPixels, also known as WS2812 LEDs, are full-colour LEDs that are connected in
+serial, are individually addressable, and can have their red, green and blue
+components set between 0 and 255. They require precise timing to control them
+and there is a special neopixel module to do just this.
+
+To create a NeoPixel object do the following::
+
+ >>> import machine, neopixel
+ >>> np = neopixel.NeoPixel(machine.Pin(4), 8)
+
+This configures a NeoPixel strip on GPIO4 with 8 pixels. You can adjust the
+"4" (pin number) and the "8" (number of pixel) to suit your set up.
+
+To set the colour of pixels use::
+
+ >>> np[0] = (255, 0, 0) # set to red, full brightness
+ >>> np[1] = (0, 128, 0) # set to green, half brightness
+ >>> np[2] = (0, 0, 64) # set to blue, quarter brightness
+
+For LEDs with more than 3 colours, such as RGBW pixels or RGBY pixels, the
+NeoPixel class takes a ``bpp`` parameter. To setup a NeoPixel object for an
+RGBW Pixel, do the following::
+
+ >>> import machine, neopixel
+ >>> np = neopixel.NeoPixel(machine.Pin(4), 8, bpp=4)
+
+In a 4-bpp mode, remember to use 4-tuples instead of 3-tuples to set the colour.
+For example to set the first three pixels use::
+
+ >>> np[0] = (255, 0, 0, 128) # Orange in an RGBY Setup
+ >>> np[1] = (0, 255, 0, 128) # Yellow-green in an RGBY Setup
+ >>> np[2] = (0, 0, 255, 128) # Green-blue in an RGBY Setup
+
+Then use the ``write()`` method to output the colours to the LEDs::
+
+ >>> np.write()
+
+The following demo function makes a fancy show on the LEDs::
+
+ import time
+
+ def demo(np):
+ n = np.n
+
+ # cycle
+ for i in range(4 * n):
+ for j in range(n):
+ np[j] = (0, 0, 0)
+ np[i % n] = (255, 255, 255)
+ np.write()
+ time.sleep_ms(25)
+
+ # bounce
+ for i in range(4 * n):
+ for j in range(n):
+ np[j] = (0, 0, 128)
+ if (i // n) % 2 == 0:
+ np[i % n] = (0, 0, 0)
+ else:
+ np[n - 1 - (i % n)] = (0, 0, 0)
+ np.write()
+ time.sleep_ms(60)
+
+ # fade in/out
+ for i in range(0, 4 * 256, 8):
+ for j in range(n):
+ if (i // 256) % 2 == 0:
+ val = i & 0xff
+ else:
+ val = 255 - (i & 0xff)
+ np[j] = (val, 0, 0)
+ np.write()
+
+ # clear
+ for i in range(n):
+ np[i] = (0, 0, 0)
+ np.write()
+
+Execute it using::
+
+ >>> demo(np)
diff --git a/components/language/micropython/docs/esp8266/tutorial/network_basics.rst b/components/language/micropython/docs/esp8266/tutorial/network_basics.rst
new file mode 100644
index 00000000..95d8cba4
--- /dev/null
+++ b/components/language/micropython/docs/esp8266/tutorial/network_basics.rst
@@ -0,0 +1,81 @@
+Network basics
+==============
+
+The network module is used to configure the WiFi connection. There are two WiFi
+interfaces, one for the station (when the ESP8266 connects to a router) and one
+for the access point (for other devices to connect to the ESP8266). Create
+instances of these objects using::
+
+ >>> import network
+ >>> sta_if = network.WLAN(network.STA_IF)
+ >>> ap_if = network.WLAN(network.AP_IF)
+
+You can check if the interfaces are active by::
+
+ >>> sta_if.active()
+ False
+ >>> ap_if.active()
+ True
+
+You can also check the network settings of the interface by::
+
+ >>> ap_if.ifconfig()
+ ('192.168.4.1', '255.255.255.0', '192.168.4.1', '8.8.8.8')
+
+The returned values are: IP address, netmask, gateway, DNS.
+
+Configuration of the WiFi
+-------------------------
+
+Upon a fresh install the ESP8266 is configured in access point mode, so the
+AP_IF interface is active and the STA_IF interface is inactive. You can
+configure the module to connect to your own network using the STA_IF interface.
+
+First activate the station interface::
+
+ >>> sta_if.active(True)
+
+Then connect to your WiFi network::
+
+ >>> sta_if.connect('', '')
+
+To check if the connection is established use::
+
+ >>> sta_if.isconnected()
+
+Once established you can check the IP address::
+
+ >>> sta_if.ifconfig()
+ ('192.168.0.2', '255.255.255.0', '192.168.0.1', '8.8.8.8')
+
+You can then disable the access-point interface if you no longer need it::
+
+ >>> ap_if.active(False)
+
+Here is a function you can run (or put in your boot.py file) to automatically
+connect to your WiFi network::
+
+ def do_connect():
+ import network
+ sta_if = network.WLAN(network.STA_IF)
+ if not sta_if.isconnected():
+ print('connecting to network...')
+ sta_if.active(True)
+ sta_if.connect('', '')
+ while not sta_if.isconnected():
+ pass
+ print('network config:', sta_if.ifconfig())
+
+Sockets
+-------
+
+Once the WiFi is set up the way to access the network is by using sockets.
+A socket represents an endpoint on a network device, and when two sockets are
+connected together communication can proceed.
+Internet protocols are built on top of sockets, such as email (SMTP), the web
+(HTTP), telnet, ssh, among many others. Each of these protocols is assigned
+a specific port, which is just an integer. Given an IP address and a port
+number you can connect to a remote device and start talking with it.
+
+The next part of the tutorial discusses how to use sockets to do some common
+and useful network tasks.
diff --git a/components/language/micropython/docs/esp8266/tutorial/network_tcp.rst b/components/language/micropython/docs/esp8266/tutorial/network_tcp.rst
new file mode 100644
index 00000000..18916884
--- /dev/null
+++ b/components/language/micropython/docs/esp8266/tutorial/network_tcp.rst
@@ -0,0 +1,123 @@
+Network - TCP sockets
+=====================
+
+The building block of most of the internet is the TCP socket. These sockets
+provide a reliable stream of bytes between the connected network devices.
+This part of the tutorial will show how to use TCP sockets in a few different
+cases.
+
+Star Wars Asciimation
+---------------------
+
+The simplest thing to do is to download data from the internet. In this case
+we will use the Star Wars Asciimation service provided by the blinkenlights.nl
+website. It uses the telnet protocol on port 23 to stream data to anyone that
+connects. It's very simple to use because it doesn't require you to
+authenticate (give a username or password), you can just start downloading data
+straight away.
+
+The first thing to do is make sure we have the socket module available::
+
+ >>> import socket
+
+Then get the IP address of the server::
+
+ >>> addr_info = socket.getaddrinfo("towel.blinkenlights.nl", 23)
+
+The ``getaddrinfo`` function actually returns a list of addresses, and each
+address has more information than we need. We want to get just the first valid
+address, and then just the IP address and port of the server. To do this use::
+
+ >>> addr = addr_info[0][-1]
+
+If you type ``addr_info`` and ``addr`` at the prompt you will see exactly what
+information they hold.
+
+Using the IP address we can make a socket and connect to the server::
+
+ >>> s = socket.socket()
+ >>> s.connect(addr)
+
+Now that we are connected we can download and display the data::
+
+ >>> while True:
+ ... data = s.recv(500)
+ ... print(str(data, 'utf8'), end='')
+ ...
+
+When this loop executes it should start showing the animation (use ctrl-C to
+interrupt it).
+
+You should also be able to run this same code on your PC using normal Python if
+you want to try it out there.
+
+HTTP GET request
+----------------
+
+The next example shows how to download a webpage. HTTP uses port 80 and you
+first need to send a "GET" request before you can download anything. As part
+of the request you need to specify the page to retrieve.
+
+Let's define a function that can download and print a URL::
+
+ def http_get(url):
+ import socket
+ _, _, host, path = url.split('/', 3)
+ addr = socket.getaddrinfo(host, 80)[0][-1]
+ s = socket.socket()
+ s.connect(addr)
+ s.send(bytes('GET /%s HTTP/1.0\r\nHost: %s\r\n\r\n' % (path, host), 'utf8'))
+ while True:
+ data = s.recv(100)
+ if data:
+ print(str(data, 'utf8'), end='')
+ else:
+ break
+ s.close()
+
+Then you can try::
+
+ >>> http_get('http://micropython.org/ks/test.html')
+
+This should retrieve the webpage and print the HTML to the console.
+
+Simple HTTP server
+------------------
+
+The following code creates an simple HTTP server which serves a single webpage
+that contains a table with the state of all the GPIO pins::
+
+ import machine
+ pins = [machine.Pin(i, machine.Pin.IN) for i in (0, 2, 4, 5, 12, 13, 14, 15)]
+
+ html = """
+
+ ESP8266 Pins
+ ESP8266 Pins
+
+
+
+ """
+
+ import socket
+ addr = socket.getaddrinfo('0.0.0.0', 80)[0][-1]
+
+ s = socket.socket()
+ s.bind(addr)
+ s.listen(1)
+
+ print('listening on', addr)
+
+ while True:
+ cl, addr = s.accept()
+ print('client connected from', addr)
+ cl_file = cl.makefile('rwb', 0)
+ while True:
+ line = cl_file.readline()
+ if not line or line == b'\r\n':
+ break
+ rows = ['%s %d ' % (str(p), p.value()) for p in pins]
+ response = html % '\n'.join(rows)
+ cl.send('HTTP/1.0 200 OK\r\nContent-type: text/html\r\n\r\n')
+ cl.send(response)
+ cl.close()
diff --git a/components/language/micropython/docs/esp8266/tutorial/nextsteps.rst b/components/language/micropython/docs/esp8266/tutorial/nextsteps.rst
new file mode 100644
index 00000000..318bd7dd
--- /dev/null
+++ b/components/language/micropython/docs/esp8266/tutorial/nextsteps.rst
@@ -0,0 +1,12 @@
+Next steps
+==========
+
+That brings us to the end of the tutorial! Hopefully by now you have a good
+feel for the capabilities of MicroPython on the ESP8266 and understand how to
+control both the WiFi and IO aspects of the chip.
+
+There are many features that were not covered in this tutorial. The best way
+to learn about them is to read the full documentation of the modules, and to
+experiment!
+
+Good luck creating your Internet of Things devices!
diff --git a/components/language/micropython/docs/esp8266/tutorial/onewire.rst b/components/language/micropython/docs/esp8266/tutorial/onewire.rst
new file mode 100644
index 00000000..c2cede9e
--- /dev/null
+++ b/components/language/micropython/docs/esp8266/tutorial/onewire.rst
@@ -0,0 +1,37 @@
+Controlling 1-wire devices
+==========================
+
+The 1-wire bus is a serial bus that uses just a single wire for communication
+(in addition to wires for ground and power). The DS18B20 temperature sensor
+is a very popular 1-wire device, and here we show how to use the onewire module
+to read from such a device.
+
+For the following code to work you need to have at least one DS18S20 or DS18B20 temperature
+sensor with its data line connected to GPIO12. You must also power the sensors
+and connect a 4.7k Ohm resistor between the data pin and the power pin. ::
+
+ import time
+ import machine
+ import onewire, ds18x20
+
+ # the device is on GPIO12
+ dat = machine.Pin(12)
+
+ # create the onewire object
+ ds = ds18x20.DS18X20(onewire.OneWire(dat))
+
+ # scan for devices on the bus
+ roms = ds.scan()
+ print('found devices:', roms)
+
+ # loop 10 times and print all temperatures
+ for i in range(10):
+ print('temperatures:', end=' ')
+ ds.convert_temp()
+ time.sleep_ms(750)
+ for rom in roms:
+ print(ds.read_temp(rom), end=' ')
+ print()
+
+Note that you must execute the ``convert_temp()`` function to initiate a
+temperature reading, then wait at least 750ms before reading the value.
diff --git a/components/language/micropython/docs/esp8266/tutorial/pins.rst b/components/language/micropython/docs/esp8266/tutorial/pins.rst
new file mode 100644
index 00000000..d304cd55
--- /dev/null
+++ b/components/language/micropython/docs/esp8266/tutorial/pins.rst
@@ -0,0 +1,76 @@
+GPIO Pins
+=========
+
+The way to connect your board to the external world, and control other
+components, is through the GPIO pins. Not all pins are available to use,
+in most cases only pins 0, 2, 4, 5, 12, 13, 14, 15, and 16 can be used.
+
+The pins are available in the machine module, so make sure you import that
+first. Then you can create a pin using::
+
+ >>> pin = machine.Pin(0)
+
+Here, the "0" is the pin that you want to access. Usually you want to
+configure the pin to be input or output, and you do this when constructing
+it. To make an input pin use::
+
+ >>> pin = machine.Pin(0, machine.Pin.IN, machine.Pin.PULL_UP)
+
+You can either use PULL_UP or None for the input pull-mode. If it's
+not specified then it defaults to None, which is no pull resistor. GPIO16
+has no pull-up mode.
+You can read the value on the pin using::
+
+ >>> pin.value()
+ 0
+
+The pin on your board may return 0 or 1 here, depending on what it's connected
+to. To make an output pin use::
+
+ >>> pin = machine.Pin(0, machine.Pin.OUT)
+
+Then set its value using::
+
+ >>> pin.value(0)
+ >>> pin.value(1)
+
+Or::
+
+ >>> pin.off()
+ >>> pin.on()
+
+External interrupts
+-------------------
+
+All pins except number 16 can be configured to trigger a hard interrupt if their
+input changes. You can set code (a callback function) to be executed on the
+trigger.
+
+Let's first define a callback function, which must take a single argument,
+being the pin that triggered the function. We will make the function just print
+the pin::
+
+ >>> def callback(p):
+ ... print('pin change', p)
+
+Next we will create two pins and configure them as inputs::
+
+ >>> from machine import Pin
+ >>> p0 = Pin(0, Pin.IN)
+ >>> p2 = Pin(2, Pin.IN)
+
+An finally we need to tell the pins when to trigger, and the function to call
+when they detect an event::
+
+ >>> p0.irq(trigger=Pin.IRQ_FALLING, handler=callback)
+ >>> p2.irq(trigger=Pin.IRQ_RISING | Pin.IRQ_FALLING, handler=callback)
+
+We set pin 0 to trigger only on a falling edge of the input (when it goes from
+high to low), and set pin 2 to trigger on both a rising and falling edge. After
+entering this code you can apply high and low voltages to pins 0 and 2 to see
+the interrupt being executed.
+
+A hard interrupt will trigger as soon as the event occurs and will interrupt any
+running code, including Python code. As such your callback functions are
+limited in what they can do (they cannot allocate memory, for example) and
+should be as short and simple as possible.
diff --git a/components/language/micropython/docs/esp8266/tutorial/powerctrl.rst b/components/language/micropython/docs/esp8266/tutorial/powerctrl.rst
new file mode 100644
index 00000000..289b4c42
--- /dev/null
+++ b/components/language/micropython/docs/esp8266/tutorial/powerctrl.rst
@@ -0,0 +1,61 @@
+Power control
+=============
+
+The ESP8266 provides the ability to change the CPU frequency on the fly, and
+enter a deep-sleep state. Both can be used to manage power consumption.
+
+Changing the CPU frequency
+--------------------------
+
+The machine module has a function to get and set the CPU frequency. To get the
+current frequency use::
+
+ >>> import machine
+ >>> machine.freq()
+ 80000000
+
+By default the CPU runs at 80MHz. It can be changed to 160MHz if you need more
+processing power, at the expense of current consumption::
+
+ >>> machine.freq(160000000)
+ >>> machine.freq()
+ 160000000
+
+You can change to the higher frequency just while your code does the heavy
+processing and then change back when it's finished.
+
+Deep-sleep mode
+---------------
+
+The deep-sleep mode will shut down the ESP8266 and all its peripherals,
+including the WiFi (but not including the real-time-clock, which is used to wake
+the chip). This drastically reduces current consumption and is a good way to
+make devices that can run for a while on a battery.
+
+To be able to use the deep-sleep feature you must connect GPIO16 to the reset
+pin (RST on the Adafruit Feather HUZZAH board). Then the following code can be
+used to sleep and wake the device::
+
+ import machine
+
+ # configure RTC.ALARM0 to be able to wake the device
+ rtc = machine.RTC()
+ rtc.irq(trigger=rtc.ALARM0, wake=machine.DEEPSLEEP)
+
+ # set RTC.ALARM0 to fire after 10 seconds (waking the device)
+ rtc.alarm(rtc.ALARM0, 10000)
+
+ # put the device to sleep
+ machine.deepsleep()
+
+Note that when the chip wakes from a deep-sleep it is completely reset,
+including all of the memory. The boot scripts will run as usual and you can
+put code in them to check the reset cause to perhaps do something different if
+the device just woke from a deep-sleep. For example, to print the reset cause
+you can use::
+
+ if machine.reset_cause() == machine.DEEPSLEEP_RESET:
+ print('woke from a deep sleep')
+ else:
+ print('power on or hard reset')
+
diff --git a/components/language/micropython/docs/esp8266/tutorial/pwm.rst b/components/language/micropython/docs/esp8266/tutorial/pwm.rst
new file mode 100644
index 00000000..61eb190f
--- /dev/null
+++ b/components/language/micropython/docs/esp8266/tutorial/pwm.rst
@@ -0,0 +1,87 @@
+Pulse Width Modulation
+======================
+
+Pulse width modulation (PWM) is a way to get an artificial analog output on a
+digital pin. It achieves this by rapidly toggling the pin from low to high.
+There are two parameters associated with this: the frequency of the toggling,
+and the duty cycle. The duty cycle is defined to be how long the pin is high
+compared with the length of a single period (low plus high time). Maximum
+duty cycle is when the pin is high all of the time, and minimum is when it is
+low all of the time.
+
+On the ESP8266 the pins 0, 2, 4, 5, 12, 13, 14 and 15 all support PWM. The
+limitation is that they must all be at the same frequency, and the frequency
+must be between 1Hz and 1kHz.
+
+To use PWM on a pin you must first create the pin object, for example::
+
+ >>> import machine
+ >>> p12 = machine.Pin(12)
+
+Then create the PWM object using::
+
+ >>> pwm12 = machine.PWM(p12)
+
+You can set the frequency and duty cycle using::
+
+ >>> pwm12.freq(500)
+ >>> pwm12.duty(512)
+
+Note that the duty cycle is between 0 (all off) and 1023 (all on), with 512
+being a 50% duty. Values beyond this min/max will be clipped. If you
+print the PWM object then it will tell you its current configuration::
+
+ >>> pwm12
+ PWM(12, freq=500, duty=512)
+
+You can also call the ``freq()`` and ``duty()`` methods with no arguments to
+get their current values.
+
+The pin will continue to be in PWM mode until you deinitialise it using::
+
+ >>> pwm12.deinit()
+
+Fading an LED
+-------------
+
+Let's use the PWM feature to fade an LED. Assuming your board has an LED
+connected to pin 2 (ESP-12 modules do) we can create an LED-PWM object using::
+
+ >>> led = machine.PWM(machine.Pin(2), freq=1000)
+
+Notice that we can set the frequency in the PWM constructor.
+
+For the next part we will use timing and some math, so import these modules::
+
+ >>> import time, math
+
+Then create a function to pulse the LED::
+
+ >>> def pulse(l, t):
+ ... for i in range(20):
+ ... l.duty(int(math.sin(i / 10 * math.pi) * 500 + 500))
+ ... time.sleep_ms(t)
+
+You can try this function out using::
+
+ >>> pulse(led, 50)
+
+For a nice effect you can pulse many times in a row::
+
+ >>> for i in range(10):
+ ... pulse(led, 20)
+
+Remember you can use ctrl-C to interrupt the code.
+
+Control a hobby servo
+---------------------
+
+Hobby servo motors can be controlled using PWM. They require a frequency of
+50Hz and then a duty between about 40 and 115, with 77 being the centre value.
+If you connect a servo to the power and ground pins, and then the signal line
+to pin 12 (other pins will work just as well), you can control the motor using::
+
+ >>> servo = machine.PWM(machine.Pin(12), freq=50)
+ >>> servo.duty(40)
+ >>> servo.duty(115)
+ >>> servo.duty(77)
diff --git a/components/language/micropython/docs/esp8266/tutorial/repl.rst b/components/language/micropython/docs/esp8266/tutorial/repl.rst
new file mode 100644
index 00000000..196541bd
--- /dev/null
+++ b/components/language/micropython/docs/esp8266/tutorial/repl.rst
@@ -0,0 +1,212 @@
+Getting a MicroPython REPL prompt
+=================================
+
+REPL stands for Read Evaluate Print Loop, and is the name given to the
+interactive MicroPython prompt that you can access on the ESP8266. Using the
+REPL is by far the easiest way to test out your code and run commands.
+
+There are two ways to access the REPL: either via a wired connection through the
+UART serial port, or via WiFi.
+
+REPL over the serial port
+-------------------------
+
+The REPL is always available on the UART0 serial peripheral, which is connected
+to the pins GPIO1 for TX and GPIO3 for RX. The baudrate of the REPL is 115200.
+If your board has a USB-serial convertor on it then you should be able to access
+the REPL directly from your PC. Otherwise you will need to have a way of
+communicating with the UART.
+
+To access the prompt over USB-serial you need to use a terminal emulator program.
+On Windows TeraTerm is a good choice, on Mac you can use the built-in ``screen``
+program, and Linux has ``picocom`` and ``minicom``. Of course, there are many
+other terminal programs that will work, so pick your favourite!
+
+For example, on Linux you can try running::
+
+ picocom /dev/ttyUSB0 -b115200
+
+Once you have made the connection over the serial port you can test if it is
+working by hitting enter a few times. You should see the Python REPL prompt,
+indicated by ``>>>``.
+
+WebREPL - a prompt over WiFi
+----------------------------
+
+WebREPL allows you to use the Python prompt over WiFi, connecting through a
+browser. The latest versions of Firefox and Chrome are supported.
+
+For your convenience, WebREPL client is hosted at
+``__. Alternatively, you can install it
+locally from the the GitHub repository
+``__.
+
+Before connecting to WebREPL, you should set a password and enable it via
+a normal serial connection. Initial versions of MicroPython for ESP8266
+came with WebREPL automatically enabled on the boot and with the
+ability to set a password via WiFi on the first connection, but as WebREPL
+was becoming more widely known and popular, the initial setup has switched
+to a wired connection for improved security::
+
+ import webrepl_setup
+
+Follow the on-screen instructions and prompts. To make any changes active,
+you will need to reboot your device.
+
+To use WebREPL connect your computer to the ESP8266's access point
+(MicroPython-xxxxxx, see the previous section about this). If you have
+already reconfigured your ESP8266 to connect to a router then you can
+skip this part.
+
+Once you are on the same network as the ESP8266 you click the "Connect" button
+(if you are connecting via a router then you may need to change the IP address,
+by default the IP address is correct when connected to the ESP8266's access
+point). If the connection succeeds then you should see a password prompt.
+
+Once you type the password configured at the setup step above, press Enter once
+more and you should get a prompt looking like ``>>>``. You can now start
+typing Python commands!
+
+Using the REPL
+--------------
+
+Once you have a prompt you can start experimenting! Anything you type at the
+prompt will be executed after you press the Enter key. MicroPython will run
+the code that you enter and print the result (if there is one). If there is an
+error with the text that you enter then an error message is printed.
+
+Try typing the following at the prompt::
+
+ >>> print('hello esp8266!')
+ hello esp8266!
+
+Note that you shouldn't type the ``>>>`` arrows, they are there to indicate that
+you should type the text after it at the prompt. And then the line following is
+what the device should respond with. In the end, once you have entered the text
+``print("hello esp8266!")`` and pressed the Enter key, the output on your screen
+should look exactly like it does above.
+
+If you already know some python you can now try some basic commands here. For
+example::
+
+ >>> 1 + 2
+ 3
+ >>> 1 / 2
+ 0.5
+ >>> 12**34
+ 4922235242952026704037113243122008064
+
+If your board has an LED attached to GPIO2 (the ESP-12 modules do) then you can
+turn it on and off using the following code::
+
+ >>> import machine
+ >>> pin = machine.Pin(2, machine.Pin.OUT)
+ >>> pin.on()
+ >>> pin.off()
+
+Note that ``on`` method of a Pin might turn the LED off and ``off`` might
+turn it on (or vice versa), depending on how the LED is wired on your board.
+To resolve this, machine.Signal class is provided.
+
+Line editing
+~~~~~~~~~~~~
+
+You can edit the current line that you are entering using the left and right
+arrow keys to move the cursor, as well as the delete and backspace keys. Also,
+pressing Home or ctrl-A moves the cursor to the start of the line, and pressing
+End or ctrl-E moves to the end of the line.
+
+Input history
+~~~~~~~~~~~~~
+
+The REPL remembers a certain number of previous lines of text that you entered
+(up to 8 on the ESP8266). To recall previous lines use the up and down arrow
+keys.
+
+Tab completion
+~~~~~~~~~~~~~~
+
+Pressing the Tab key will do an auto-completion of the current word that you are
+entering. This can be very useful to find out functions and methods that a
+module or object has. Try it out by typing "ma" and then pressing Tab. It
+should complete to "machine" (assuming you imported machine in the above
+example). Then type "." and press Tab again to see a list of all the functions
+that the machine module has.
+
+Line continuation and auto-indent
+~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+
+Certain things that you type will need "continuing", that is, will need more
+lines of text to make a proper Python statement. In this case the prompt will
+change to ``...`` and the cursor will auto-indent the correct amount so you can
+start typing the next line straight away. Try this by defining the following
+function::
+
+ >>> def toggle(p):
+ ... p.value(not p.value())
+ ...
+ ...
+ ...
+ >>>
+
+In the above, you needed to press the Enter key three times in a row to finish
+the compound statement (that's the three lines with just dots on them). The
+other way to finish a compound statement is to press backspace to get to the
+start of the line, then press the Enter key. (If you did something wrong and
+want to escape the continuation mode then press ctrl-C; all lines will be
+ignored.)
+
+The function you just defined allows you to toggle a pin. The pin object you
+created earlier should still exist (recreate it if it doesn't) and you can
+toggle the LED using::
+
+ >>> toggle(pin)
+
+Let's now toggle the LED in a loop (if you don't have an LED then you can just
+print some text instead of calling toggle, to see the effect)::
+
+ >>> import time
+ >>> while True:
+ ... toggle(pin)
+ ... time.sleep_ms(500)
+ ...
+ ...
+ ...
+ >>>
+
+This will toggle the LED at 1Hz (half a second on, half a second off). To stop
+the toggling press ctrl-C, which will raise a KeyboardInterrupt exception and
+break out of the loop.
+
+The time module provides some useful functions for making delays and doing
+timing. Use tab completion to find out what they are and play around with them!
+
+Paste mode
+~~~~~~~~~~
+
+Pressing ctrl-E will enter a special paste mode. This allows you to copy and
+paste a chunk of text into the REPL. If you press ctrl-E you will see the
+paste-mode prompt::
+
+ paste mode; Ctrl-C to cancel, Ctrl-D to finish
+ ===
+
+You can then paste (or type) your text in. Note that none of the special keys
+or commands work in paste mode (eg Tab or backspace), they are just accepted
+as-is. Press ctrl-D to finish entering the text and execute it.
+
+Other control commands
+~~~~~~~~~~~~~~~~~~~~~~
+
+There are four other control commands:
+
+* Ctrl-A on a blank line will enter raw REPL mode. This is like a permanent
+ paste mode, except that characters are not echoed back.
+
+* Ctrl-B on a blank like goes to normal REPL mode.
+
+* Ctrl-C cancels any input, or interrupts the currently running code.
+
+* Ctrl-D on a blank line will do a soft reset.
+
+Note that ctrl-A and ctrl-D do not work with WebREPL.
diff --git a/components/language/micropython/docs/esp8266/tutorial/ssd1306.rst b/components/language/micropython/docs/esp8266/tutorial/ssd1306.rst
new file mode 100644
index 00000000..8651522e
--- /dev/null
+++ b/components/language/micropython/docs/esp8266/tutorial/ssd1306.rst
@@ -0,0 +1,93 @@
+.. _ssd1306:
+
+Using a SSD1306 OLED display
+============================
+
+The SSD1306 OLED display uses either a SPI or I2C interface and comes in a variety of
+sizes (128x64, 128x32, 72x40, 64x48) and colours (white, yellow, blue, yellow + blue).
+
+Hardware SPI interface::
+
+ from machine import Pin, SPI
+ import ssd1306
+
+ hspi = SPI(1) # sck=14 (scl), mosi=13 (sda), miso=12 (unused)
+
+ dc = Pin(4) # data/command
+ rst = Pin(5) # reset
+ cs = Pin(15) # chip select, some modules do not have a pin for this
+
+ display = ssd1306.SSD1306_SPI(128, 64, hspi, dc, rst, cs)
+
+Software SPI interface::
+
+ from machine import Pin, SoftSPI
+ import ssd1306
+
+ spi = SoftSPI(baudrate=500000, polarity=1, phase=0, sck=Pin(14), mosi=Pin(13), miso=Pin(12))
+
+ dc = Pin(4) # data/command
+ rst = Pin(5) # reset
+ cs = Pin(15) # chip select, some modules do not have a pin for this
+
+ display = ssd1306.SSD1306_SPI(128, 64, spi, dc, rst, cs)
+
+I2C interface::
+
+ from machine import Pin, I2C
+ import ssd1306
+
+ # using default address 0x3C
+ i2c = I2C(sda=Pin(4), scl=Pin(5))
+ display = ssd1306.SSD1306_I2C(128, 64, i2c)
+
+Print Hello World on the first line::
+
+ display.text('Hello, World!', 0, 0, 1)
+ display.show()
+
+Basic functions::
+
+ display.poweroff() # power off the display, pixels persist in memory
+ display.poweron() # power on the display, pixels redrawn
+ display.contrast(0) # dim
+ display.contrast(255) # bright
+ display.invert(1) # display inverted
+ display.invert(0) # display normal
+ display.rotate(True) # rotate 180 degrees
+ display.rotate(False) # rotate 0 degrees
+ display.show() # write the contents of the FrameBuffer to display memory
+
+Subclassing FrameBuffer provides support for graphics primitives::
+
+ display.fill(0) # fill entire screen with colour=0
+ display.pixel(0, 10) # get pixel at x=0, y=10
+ display.pixel(0, 10, 1) # set pixel at x=0, y=10 to colour=1
+ display.hline(0, 8, 4, 1) # draw horizontal line x=0, y=8, width=4, colour=1
+ display.vline(0, 8, 4, 1) # draw vertical line x=0, y=8, height=4, colour=1
+ display.line(0, 0, 127, 63, 1) # draw a line from 0,0 to 127,63
+ display.rect(10, 10, 107, 43, 1) # draw a rectangle outline 10,10 to 117,53, colour=1
+ display.fill_rect(10, 10, 107, 43, 1) # draw a solid rectangle 10,10 to 117,53, colour=1
+ display.text('Hello World', 0, 0, 1) # draw some text at x=0, y=0, colour=1
+ display.scroll(20, 0) # scroll 20 pixels to the right
+
+ # draw another FrameBuffer on top of the current one at the given coordinates
+ import framebuf
+ fbuf = framebuf.FrameBuffer(bytearray(8 * 8 * 1), 8, 8, framebuf.MONO_VLSB)
+ fbuf.line(0, 0, 7, 7, 1)
+ display.blit(fbuf, 10, 10, 0) # draw on top at x=10, y=10, key=0
+ display.show()
+
+Draw the MicroPython logo and print some text::
+
+ display.fill(0)
+ display.fill_rect(0, 0, 32, 32, 1)
+ display.fill_rect(2, 2, 28, 28, 0)
+ display.vline(9, 8, 22, 1)
+ display.vline(16, 2, 22, 1)
+ display.vline(23, 8, 22, 1)
+ display.fill_rect(26, 24, 2, 4, 1)
+ display.text('MicroPython', 40, 0, 1)
+ display.text('SSD1306', 40, 12, 1)
+ display.text('OLED 128x64', 40, 24, 1)
+ display.show()
diff --git a/components/language/micropython/docs/index.rst b/components/language/micropython/docs/index.rst
new file mode 100644
index 00000000..9a021b39
--- /dev/null
+++ b/components/language/micropython/docs/index.rst
@@ -0,0 +1,19 @@
+MicroPython documentation and references
+========================================
+
+.. toctree::
+
+ library/index.rst
+ reference/index.rst
+ genrst/index.rst
+ develop/index.rst
+ license.rst
+ pyboard/quickref.rst
+ esp8266/quickref.rst
+ esp32/quickref.rst
+ rp2/quickref.rst
+ mimxrt/quickref.rst
+ wipy/quickref.rst
+ unix/quickref.rst
+ zephyr/quickref.rst
+ renesas-ra/quickref.rst
diff --git a/components/language/micropython/docs/library/_thread.rst b/components/language/micropython/docs/library/_thread.rst
new file mode 100644
index 00000000..47c1c239
--- /dev/null
+++ b/components/language/micropython/docs/library/_thread.rst
@@ -0,0 +1,12 @@
+:mod:`_thread` -- multithreading support
+========================================
+
+.. module:: _thread
+ :synopsis: multithreading support
+
+|see_cpython_module| :mod:`python:_thread`.
+
+This module implements multithreading support.
+
+This module is highly experimental and its API is not yet fully settled
+and not yet described in this documentation.
diff --git a/components/language/micropython/docs/library/array.rst b/components/language/micropython/docs/library/array.rst
new file mode 100644
index 00000000..88d6d226
--- /dev/null
+++ b/components/language/micropython/docs/library/array.rst
@@ -0,0 +1,29 @@
+:mod:`array` -- arrays of numeric data
+======================================
+
+.. module:: array
+ :synopsis: efficient arrays of numeric data
+
+|see_cpython_module| :mod:`python:array`.
+
+Supported format codes: ``b``, ``B``, ``h``, ``H``, ``i``, ``I``, ``l``,
+``L``, ``q``, ``Q``, ``f``, ``d`` (the latter 2 depending on the
+floating-point support).
+
+Classes
+-------
+
+.. class:: array(typecode, [iterable])
+
+ Create array with elements of given type. Initial contents of the
+ array are given by *iterable*. If it is not provided, an empty
+ array is created.
+
+ .. method:: append(val)
+
+ Append new element *val* to the end of array, growing it.
+
+ .. method:: extend(iterable)
+
+ Append new elements as contained in *iterable* to the end of
+ array, growing it.
diff --git a/components/language/micropython/docs/library/binascii.rst b/components/language/micropython/docs/library/binascii.rst
new file mode 100644
index 00000000..6c02f019
--- /dev/null
+++ b/components/language/micropython/docs/library/binascii.rst
@@ -0,0 +1,38 @@
+:mod:`binascii` -- binary/ASCII conversions
+===========================================
+
+.. module:: binascii
+ :synopsis: binary/ASCII conversions
+
+|see_cpython_module| :mod:`python:binascii`.
+
+This module implements conversions between binary data and various
+encodings of it in ASCII form (in both directions).
+
+Functions
+---------
+
+.. function:: hexlify(data, [sep])
+
+ Convert the bytes in the *data* object to a hexadecimal representation.
+ Returns a bytes object.
+
+ If the additional argument *sep* is supplied it is used as a separator
+ between hexadecimal values.
+
+.. function:: unhexlify(data)
+
+ Convert hexadecimal data to binary representation. Returns bytes string.
+ (i.e. inverse of hexlify)
+
+.. function:: a2b_base64(data)
+
+ Decode base64-encoded data, ignoring invalid characters in the input.
+ Conforms to `RFC 2045 s.6.8 `_.
+ Returns a bytes object.
+
+.. function:: b2a_base64(data, *, newline=True)
+
+ Encode binary data in base64 format, as in `RFC 3548
+ `_. Returns the encoded data
+ followed by a newline character if newline is true, as a bytes object.
diff --git a/components/language/micropython/docs/library/bluetooth.rst b/components/language/micropython/docs/library/bluetooth.rst
new file mode 100644
index 00000000..7663199e
--- /dev/null
+++ b/components/language/micropython/docs/library/bluetooth.rst
@@ -0,0 +1,761 @@
+:mod:`bluetooth` --- low-level Bluetooth
+========================================
+
+.. module:: bluetooth
+ :synopsis: Low-level Bluetooth radio functionality
+
+This module provides an interface to a Bluetooth controller on a board.
+Currently this supports Bluetooth Low Energy (BLE) in Central, Peripheral,
+Broadcaster, and Observer roles, as well as GATT Server and Client and L2CAP
+connection-oriented-channels. A device may operate in multiple roles
+concurrently. Pairing (and bonding) is supported on some ports.
+
+This API is intended to match the low-level Bluetooth protocol and provide
+building-blocks for higher-level abstractions such as specific device types.
+
+.. note:: This module is still under development and its classes, functions,
+ methods and constants are subject to change.
+
+class BLE
+---------
+
+Constructor
+-----------
+
+.. class:: BLE()
+
+ Returns the singleton BLE object.
+
+Configuration
+-------------
+
+.. method:: BLE.active([active], /)
+
+ Optionally changes the active state of the BLE radio, and returns the
+ current state.
+
+ The radio must be made active before using any other methods on this class.
+
+.. method:: BLE.config('param', /)
+ BLE.config(*, param=value, ...)
+
+ Get or set configuration values of the BLE interface. To get a value the
+ parameter name should be quoted as a string, and just one parameter is
+ queried at a time. To set values use the keyword syntax, and one ore more
+ parameter can be set at a time.
+
+ Currently supported values are:
+
+ - ``'mac'``: The current address in use, depending on the current address mode.
+ This returns a tuple of ``(addr_type, addr)``.
+
+ See :meth:`gatts_write ` for details about address type.
+
+ This may only be queried while the interface is currently active.
+
+ - ``'addr_mode'``: Sets the address mode. Values can be:
+
+ * 0x00 - PUBLIC - Use the controller's public address.
+ * 0x01 - RANDOM - Use a generated static address.
+ * 0x02 - RPA - Use resolvable private addresses.
+ * 0x03 - NRPA - Use non-resolvable private addresses.
+
+ By default the interface mode will use a PUBLIC address if available, otherwise
+ it will use a RANDOM address.
+
+ - ``'gap_name'``: Get/set the GAP device name used by service 0x1800,
+ characteristic 0x2a00. This can be set at any time and changed multiple
+ times.
+
+ - ``'rxbuf'``: Get/set the size in bytes of the internal buffer used to store
+ incoming events. This buffer is global to the entire BLE driver and so
+ handles incoming data for all events, including all characteristics.
+ Increasing this allows better handling of bursty incoming data (for
+ example scan results) and the ability to receive larger characteristic values.
+
+ - ``'mtu'``: Get/set the MTU that will be used during a ATT MTU exchange. The
+ resulting MTU will be the minimum of this and the remote device's MTU.
+ ATT MTU exchange will not happen automatically (unless the remote device initiates
+ it), and must be manually initiated with
+ :meth:`gattc_exchange_mtu`.
+ Use the ``_IRQ_MTU_EXCHANGED`` event to discover the MTU for a given connection.
+
+ - ``'bond'``: Sets whether bonding will be enabled during pairing. When
+ enabled, pairing requests will set the "bond" flag and the keys will be stored
+ by both devices.
+
+ - ``'mitm'``: Sets whether MITM-protection is required for pairing.
+
+ - ``'io'``: Sets the I/O capabilities of this device.
+
+ Available options are::
+
+ _IO_CAPABILITY_DISPLAY_ONLY = const(0)
+ _IO_CAPABILITY_DISPLAY_YESNO = const(1)
+ _IO_CAPABILITY_KEYBOARD_ONLY = const(2)
+ _IO_CAPABILITY_NO_INPUT_OUTPUT = const(3)
+ _IO_CAPABILITY_KEYBOARD_DISPLAY = const(4)
+
+ - ``'le_secure'``: Sets whether "LE Secure" pairing is required. Default is
+ false (i.e. allow "Legacy Pairing").
+
+Event Handling
+--------------
+
+.. method:: BLE.irq(handler, /)
+
+ Registers a callback for events from the BLE stack. The *handler* takes two
+ arguments, ``event`` (which will be one of the codes below) and ``data``
+ (which is an event-specific tuple of values).
+
+ **Note:** As an optimisation to prevent unnecessary allocations, the ``addr``,
+ ``adv_data``, ``char_data``, ``notify_data``, and ``uuid`` entries in the
+ tuples are read-only memoryview instances pointing to :mod:`bluetooth`'s internal
+ ringbuffer, and are only valid during the invocation of the IRQ handler
+ function. If your program needs to save one of these values to access after
+ the IRQ handler has returned (e.g. by saving it in a class instance or global
+ variable), then it needs to take a copy of the data, either by using ``bytes()``
+ or ``bluetooth.UUID()``, like this::
+
+ connected_addr = bytes(addr) # equivalently: adv_data, char_data, or notify_data
+ matched_uuid = bluetooth.UUID(uuid)
+
+ For example, the IRQ handler for a scan result might inspect the ``adv_data``
+ to decide if it's the correct device, and only then copy the address data to be
+ used elsewhere in the program. And to print data from within the IRQ handler,
+ ``print(bytes(addr))`` will be needed.
+
+ An event handler showing all possible events::
+
+ def bt_irq(event, data):
+ if event == _IRQ_CENTRAL_CONNECT:
+ # A central has connected to this peripheral.
+ conn_handle, addr_type, addr = data
+ elif event == _IRQ_CENTRAL_DISCONNECT:
+ # A central has disconnected from this peripheral.
+ conn_handle, addr_type, addr = data
+ elif event == _IRQ_GATTS_WRITE:
+ # A client has written to this characteristic or descriptor.
+ conn_handle, attr_handle = data
+ elif event == _IRQ_GATTS_READ_REQUEST:
+ # A client has issued a read. Note: this is only supported on STM32.
+ # Return a non-zero integer to deny the read (see below), or zero (or None)
+ # to accept the read.
+ conn_handle, attr_handle = data
+ elif event == _IRQ_SCAN_RESULT:
+ # A single scan result.
+ addr_type, addr, adv_type, rssi, adv_data = data
+ elif event == _IRQ_SCAN_DONE:
+ # Scan duration finished or manually stopped.
+ pass
+ elif event == _IRQ_PERIPHERAL_CONNECT:
+ # A successful gap_connect().
+ conn_handle, addr_type, addr = data
+ elif event == _IRQ_PERIPHERAL_DISCONNECT:
+ # Connected peripheral has disconnected.
+ conn_handle, addr_type, addr = data
+ elif event == _IRQ_GATTC_SERVICE_RESULT:
+ # Called for each service found by gattc_discover_services().
+ conn_handle, start_handle, end_handle, uuid = data
+ elif event == _IRQ_GATTC_SERVICE_DONE:
+ # Called once service discovery is complete.
+ # Note: Status will be zero on success, implementation-specific value otherwise.
+ conn_handle, status = data
+ elif event == _IRQ_GATTC_CHARACTERISTIC_RESULT:
+ # Called for each characteristic found by gattc_discover_services().
+ conn_handle, def_handle, value_handle, properties, uuid = data
+ elif event == _IRQ_GATTC_CHARACTERISTIC_DONE:
+ # Called once service discovery is complete.
+ # Note: Status will be zero on success, implementation-specific value otherwise.
+ conn_handle, status = data
+ elif event == _IRQ_GATTC_DESCRIPTOR_RESULT:
+ # Called for each descriptor found by gattc_discover_descriptors().
+ conn_handle, dsc_handle, uuid = data
+ elif event == _IRQ_GATTC_DESCRIPTOR_DONE:
+ # Called once service discovery is complete.
+ # Note: Status will be zero on success, implementation-specific value otherwise.
+ conn_handle, status = data
+ elif event == _IRQ_GATTC_READ_RESULT:
+ # A gattc_read() has completed.
+ conn_handle, value_handle, char_data = data
+ elif event == _IRQ_GATTC_READ_DONE:
+ # A gattc_read() has completed.
+ # Note: The value_handle will be zero on btstack (but present on NimBLE).
+ # Note: Status will be zero on success, implementation-specific value otherwise.
+ conn_handle, value_handle, status = data
+ elif event == _IRQ_GATTC_WRITE_DONE:
+ # A gattc_write() has completed.
+ # Note: The value_handle will be zero on btstack (but present on NimBLE).
+ # Note: Status will be zero on success, implementation-specific value otherwise.
+ conn_handle, value_handle, status = data
+ elif event == _IRQ_GATTC_NOTIFY:
+ # A server has sent a notify request.
+ conn_handle, value_handle, notify_data = data
+ elif event == _IRQ_GATTC_INDICATE:
+ # A server has sent an indicate request.
+ conn_handle, value_handle, notify_data = data
+ elif event == _IRQ_GATTS_INDICATE_DONE:
+ # A client has acknowledged the indication.
+ # Note: Status will be zero on successful acknowledgment, implementation-specific value otherwise.
+ conn_handle, value_handle, status = data
+ elif event == _IRQ_MTU_EXCHANGED:
+ # ATT MTU exchange complete (either initiated by us or the remote device).
+ conn_handle, mtu = data
+ elif event == _IRQ_L2CAP_ACCEPT:
+ # A new channel has been accepted.
+ # Return a non-zero integer to reject the connection, or zero (or None) to accept.
+ conn_handle, cid, psm, our_mtu, peer_mtu = data
+ elif event == _IRQ_L2CAP_CONNECT:
+ # A new channel is now connected (either as a result of connecting or accepting).
+ conn_handle, cid, psm, our_mtu, peer_mtu = data
+ elif event == _IRQ_L2CAP_DISCONNECT:
+ # Existing channel has disconnected (status is zero), or a connection attempt failed (non-zero status).
+ conn_handle, cid, psm, status = data
+ elif event == _IRQ_L2CAP_RECV:
+ # New data is available on the channel. Use l2cap_recvinto to read.
+ conn_handle, cid = data
+ elif event == _IRQ_L2CAP_SEND_READY:
+ # A previous l2cap_send that returned False has now completed and the channel is ready to send again.
+ # If status is non-zero, then the transmit buffer overflowed and the application should re-send the data.
+ conn_handle, cid, status = data
+ elif event == _IRQ_CONNECTION_UPDATE:
+ # The remote device has updated connection parameters.
+ conn_handle, conn_interval, conn_latency, supervision_timeout, status = data
+ elif event == _IRQ_ENCRYPTION_UPDATE:
+ # The encryption state has changed (likely as a result of pairing or bonding).
+ conn_handle, encrypted, authenticated, bonded, key_size = data
+ elif event == _IRQ_GET_SECRET:
+ # Return a stored secret.
+ # If key is None, return the index'th value of this sec_type.
+ # Otherwise return the corresponding value for this sec_type and key.
+ sec_type, index, key = data
+ return value
+ elif event == _IRQ_SET_SECRET:
+ # Save a secret to the store for this sec_type and key.
+ sec_type, key, value = data
+ return True
+ elif event == _IRQ_PASSKEY_ACTION:
+ # Respond to a passkey request during pairing.
+ # See gap_passkey() for details.
+ # action will be an action that is compatible with the configured "io" config.
+ # passkey will be non-zero if action is "numeric comparison".
+ conn_handle, action, passkey = data
+
+
+The event codes are::
+
+ from micropython import const
+ _IRQ_CENTRAL_CONNECT = const(1)
+ _IRQ_CENTRAL_DISCONNECT = const(2)
+ _IRQ_GATTS_WRITE = const(3)
+ _IRQ_GATTS_READ_REQUEST = const(4)
+ _IRQ_SCAN_RESULT = const(5)
+ _IRQ_SCAN_DONE = const(6)
+ _IRQ_PERIPHERAL_CONNECT = const(7)
+ _IRQ_PERIPHERAL_DISCONNECT = const(8)
+ _IRQ_GATTC_SERVICE_RESULT = const(9)
+ _IRQ_GATTC_SERVICE_DONE = const(10)
+ _IRQ_GATTC_CHARACTERISTIC_RESULT = const(11)
+ _IRQ_GATTC_CHARACTERISTIC_DONE = const(12)
+ _IRQ_GATTC_DESCRIPTOR_RESULT = const(13)
+ _IRQ_GATTC_DESCRIPTOR_DONE = const(14)
+ _IRQ_GATTC_READ_RESULT = const(15)
+ _IRQ_GATTC_READ_DONE = const(16)
+ _IRQ_GATTC_WRITE_DONE = const(17)
+ _IRQ_GATTC_NOTIFY = const(18)
+ _IRQ_GATTC_INDICATE = const(19)
+ _IRQ_GATTS_INDICATE_DONE = const(20)
+ _IRQ_MTU_EXCHANGED = const(21)
+ _IRQ_L2CAP_ACCEPT = const(22)
+ _IRQ_L2CAP_CONNECT = const(23)
+ _IRQ_L2CAP_DISCONNECT = const(24)
+ _IRQ_L2CAP_RECV = const(25)
+ _IRQ_L2CAP_SEND_READY = const(26)
+ _IRQ_CONNECTION_UPDATE = const(27)
+ _IRQ_ENCRYPTION_UPDATE = const(28)
+ _IRQ_GET_SECRET = const(29)
+ _IRQ_SET_SECRET = const(30)
+
+For the ``_IRQ_GATTS_READ_REQUEST`` event, the available return codes are::
+
+ _GATTS_NO_ERROR = const(0x00)
+ _GATTS_ERROR_READ_NOT_PERMITTED = const(0x02)
+ _GATTS_ERROR_WRITE_NOT_PERMITTED = const(0x03)
+ _GATTS_ERROR_INSUFFICIENT_AUTHENTICATION = const(0x05)
+ _GATTS_ERROR_INSUFFICIENT_AUTHORIZATION = const(0x08)
+ _GATTS_ERROR_INSUFFICIENT_ENCRYPTION = const(0x0f)
+
+For the ``_IRQ_PASSKEY_ACTION`` event, the available actions are::
+
+ _PASSKEY_ACTION_NONE = const(0)
+ _PASSKEY_ACTION_INPUT = const(2)
+ _PASSKEY_ACTION_DISPLAY = const(3)
+ _PASSKEY_ACTION_NUMERIC_COMPARISON = const(4)
+
+In order to save space in the firmware, these constants are not included on the
+:mod:`bluetooth` module. Add the ones that you need from the list above to your
+program.
+
+
+Broadcaster Role (Advertiser)
+-----------------------------
+
+.. method:: BLE.gap_advertise(interval_us, adv_data=None, *, resp_data=None, connectable=True)
+
+ Starts advertising at the specified interval (in **micro**\ seconds). This
+ interval will be rounded down to the nearest 625us. To stop advertising, set
+ *interval_us* to ``None``.
+
+ *adv_data* and *resp_data* can be any type that implements the buffer
+ protocol (e.g. ``bytes``, ``bytearray``, ``str``). *adv_data* is included
+ in all broadcasts, and *resp_data* is send in reply to an active scan.
+
+ **Note:** if *adv_data* (or *resp_data*) is ``None``, then the data passed
+ to the previous call to ``gap_advertise`` will be re-used. This allows a
+ broadcaster to resume advertising with just ``gap_advertise(interval_us)``.
+ To clear the advertising payload pass an empty ``bytes``, i.e. ``b''``.
+
+
+Observer Role (Scanner)
+-----------------------
+
+.. method:: BLE.gap_scan(duration_ms, interval_us=1280000, window_us=11250, active=False, /)
+
+ Run a scan operation lasting for the specified duration (in **milli**\ seconds).
+
+ To scan indefinitely, set *duration_ms* to ``0``.
+
+ To stop scanning, set *duration_ms* to ``None``.
+
+ Use *interval_us* and *window_us* to optionally configure the duty cycle.
+ The scanner will run for *window_us* **micro**\ seconds every *interval_us*
+ **micro**\ seconds for a total of *duration_ms* **milli**\ seconds. The default
+ interval and window are 1.28 seconds and 11.25 milliseconds respectively
+ (background scanning).
+
+ For each scan result the ``_IRQ_SCAN_RESULT`` event will be raised, with event
+ data ``(addr_type, addr, adv_type, rssi, adv_data)``.
+
+ ``addr_type`` values indicate public or random addresses:
+ * 0x00 - PUBLIC
+ * 0x01 - RANDOM (either static, RPA, or NRPA, the type is encoded in the address itself)
+
+ ``adv_type`` values correspond to the Bluetooth Specification:
+
+ * 0x00 - ADV_IND - connectable and scannable undirected advertising
+ * 0x01 - ADV_DIRECT_IND - connectable directed advertising
+ * 0x02 - ADV_SCAN_IND - scannable undirected advertising
+ * 0x03 - ADV_NONCONN_IND - non-connectable undirected advertising
+ * 0x04 - SCAN_RSP - scan response
+
+ ``active`` can be set ``True`` if you want to receive scan responses in the results.
+
+ When scanning is stopped (either due to the duration finishing or when
+ explicitly stopped), the ``_IRQ_SCAN_DONE`` event will be raised.
+
+
+Central Role
+------------
+
+A central device can connect to peripherals that it has discovered using the observer role (see :meth:`gap_scan`) or with a known address.
+
+.. method:: BLE.gap_connect(addr_type, addr, scan_duration_ms=2000, min_conn_interval_us=None, max_conn_interval_us=None, /)
+
+ Connect to a peripheral.
+
+ See :meth:`gap_scan ` for details about address types.
+
+ To cancel an outstanding connection attempt early, call
+ ``gap_connect(None)``.
+
+ On success, the ``_IRQ_PERIPHERAL_CONNECT`` event will be raised. If
+ cancelling a connection attempt, the ``_IRQ_PERIPHERAL_DISCONNECT`` event
+ will be raised.
+
+ The device will wait up to *scan_duration_ms* to receive an advertising
+ payload from the device.
+
+ The connection interval can be configured in **micro**\ seconds using either
+ or both of *min_conn_interval_us* and *max_conn_interval_us*. Otherwise a
+ default interval will be chosen, typically between 30000 and 50000
+ microseconds. A shorter interval will increase throughput, at the expense
+ of power usage.
+
+
+Peripheral Role
+---------------
+
+A peripheral device is expected to send connectable advertisements (see
+:meth:`gap_advertise`). It will usually be acting as a GATT
+server, having first registered services and characteristics using
+:meth:`gatts_register_services`.
+
+When a central connects, the ``_IRQ_CENTRAL_CONNECT`` event will be raised.
+
+
+Central & Peripheral Roles
+--------------------------
+
+.. method:: BLE.gap_disconnect(conn_handle, /)
+
+ Disconnect the specified connection handle. This can either be a
+ central that has connected to this device (if acting as a peripheral)
+ or a peripheral that was previously connected to by this device (if acting
+ as a central).
+
+ On success, the ``_IRQ_PERIPHERAL_DISCONNECT`` or ``_IRQ_CENTRAL_DISCONNECT``
+ event will be raised.
+
+ Returns ``False`` if the connection handle wasn't connected, and ``True``
+ otherwise.
+
+
+GATT Server
+-----------
+
+A GATT server has a set of registered services. Each service may contain
+characteristics, which each have a value. Characteristics can also contain
+descriptors, which themselves have values.
+
+These values are stored locally, and are accessed by their "value handle" which
+is generated during service registration. They can also be read from or written
+to by a remote client device. Additionally, a server can "notify" a
+characteristic to a connected client via a connection handle.
+
+A device in either central or peripheral roles may function as a GATT server,
+however in most cases it will be more common for a peripheral device to act
+as the server.
+
+Characteristics and descriptors have a default maximum size of 20 bytes.
+Anything written to them by a client will be truncated to this length. However,
+any local write will increase the maximum size, so if you want to allow larger
+writes from a client to a given characteristic, use
+:meth:`gatts_write` after registration. e.g.
+``gatts_write(char_handle, bytes(100))``.
+
+.. method:: BLE.gatts_register_services(services_definition, /)
+
+ Configures the server with the specified services, replacing any
+ existing services.
+
+ *services_definition* is a list of **services**, where each **service** is a
+ two-element tuple containing a UUID and a list of **characteristics**.
+
+ Each **characteristic** is a two-or-three-element tuple containing a UUID, a
+ **flags** value, and optionally a list of *descriptors*.
+
+ Each **descriptor** is a two-element tuple containing a UUID and a **flags**
+ value.
+
+ The **flags** are a bitwise-OR combination of the flags defined below. These
+ set both the behaviour of the characteristic (or descriptor) as well as the
+ security and privacy requirements.
+
+ The return value is a list (one element per service) of tuples (each element
+ is a value handle). Characteristics and descriptor handles are flattened
+ into the same tuple, in the order that they are defined.
+
+ The following example registers two services (Heart Rate, and Nordic UART)::
+
+ HR_UUID = bluetooth.UUID(0x180D)
+ HR_CHAR = (bluetooth.UUID(0x2A37), bluetooth.FLAG_READ | bluetooth.FLAG_NOTIFY,)
+ HR_SERVICE = (HR_UUID, (HR_CHAR,),)
+ UART_UUID = bluetooth.UUID('6E400001-B5A3-F393-E0A9-E50E24DCCA9E')
+ UART_TX = (bluetooth.UUID('6E400003-B5A3-F393-E0A9-E50E24DCCA9E'), bluetooth.FLAG_READ | bluetooth.FLAG_NOTIFY,)
+ UART_RX = (bluetooth.UUID('6E400002-B5A3-F393-E0A9-E50E24DCCA9E'), bluetooth.FLAG_WRITE,)
+ UART_SERVICE = (UART_UUID, (UART_TX, UART_RX,),)
+ SERVICES = (HR_SERVICE, UART_SERVICE,)
+ ( (hr,), (tx, rx,), ) = bt.gatts_register_services(SERVICES)
+
+ The three value handles (``hr``, ``tx``, ``rx``) can be used with
+ :meth:`gatts_read `, :meth:`gatts_write `, :meth:`gatts_notify `, and
+ :meth:`gatts_indicate `.
+
+ **Note:** Advertising must be stopped before registering services.
+
+ Available flags for characteristics and descriptors are::
+
+ from micropython import const
+ _FLAG_BROADCAST = const(0x0001)
+ _FLAG_READ = const(0x0002)
+ _FLAG_WRITE_NO_RESPONSE = const(0x0004)
+ _FLAG_WRITE = const(0x0008)
+ _FLAG_NOTIFY = const(0x0010)
+ _FLAG_INDICATE = const(0x0020)
+ _FLAG_AUTHENTICATED_SIGNED_WRITE = const(0x0040)
+
+ _FLAG_AUX_WRITE = const(0x0100)
+ _FLAG_READ_ENCRYPTED = const(0x0200)
+ _FLAG_READ_AUTHENTICATED = const(0x0400)
+ _FLAG_READ_AUTHORIZED = const(0x0800)
+ _FLAG_WRITE_ENCRYPTED = const(0x1000)
+ _FLAG_WRITE_AUTHENTICATED = const(0x2000)
+ _FLAG_WRITE_AUTHORIZED = const(0x4000)
+
+ As for the IRQs above, any required constants should be added to your Python code.
+
+.. method:: BLE.gatts_read(value_handle, /)
+
+ Reads the local value for this handle (which has either been written by
+ :meth:`gatts_write ` or by a remote client).
+
+.. method:: BLE.gatts_write(value_handle, data, send_update=False, /)
+
+ Writes the local value for this handle, which can be read by a client.
+
+ If *send_update* is ``True``, then any subscribed clients will be notified
+ (or indicated, depending on what they're subscribed to and which operations
+ the characteristic supports) about this write.
+
+.. method:: BLE.gatts_notify(conn_handle, value_handle, data=None, /)
+
+ Sends a notification request to a connected client.
+
+ If *data* is not ``None``, then that value is sent to the client as part of
+ the notification. The local value will not be modified.
+
+ Otherwise, if *data* is ``None``, then the current local value (as
+ set with :meth:`gatts_write `) will be sent.
+
+ **Note:** The notification will be sent regardless of the subscription
+ status of the client to this characteristic.
+
+.. method:: BLE.gatts_indicate(conn_handle, value_handle, /)
+
+ Sends an indication request containing the characteristic's current value to
+ a connected client.
+
+ On acknowledgment (or failure, e.g. timeout), the
+ ``_IRQ_GATTS_INDICATE_DONE`` event will be raised.
+
+ **Note:** The indication will be sent regardless of the subscription
+ status of the client to this characteristic.
+
+.. method:: BLE.gatts_set_buffer(value_handle, len, append=False, /)
+
+ Sets the internal buffer size for a value in bytes. This will limit the
+ largest possible write that can be received. The default is 20.
+
+ Setting *append* to ``True`` will make all remote writes append to, rather
+ than replace, the current value. At most *len* bytes can be buffered in
+ this way. When you use :meth:`gatts_read `, the value will
+ be cleared after reading. This feature is useful when implementing something
+ like the Nordic UART Service.
+
+GATT Client
+-----------
+
+A GATT client can discover and read/write characteristics on a remote GATT server.
+
+It is more common for a central role device to act as the GATT client, however
+it's also possible for a peripheral to act as a client in order to discover
+information about the central that has connected to it (e.g. to read the
+device name from the device information service).
+
+.. method:: BLE.gattc_discover_services(conn_handle, uuid=None, /)
+
+ Query a connected server for its services.
+
+ Optionally specify a service *uuid* to query for that service only.
+
+ For each service discovered, the ``_IRQ_GATTC_SERVICE_RESULT`` event will
+ be raised, followed by ``_IRQ_GATTC_SERVICE_DONE`` on completion.
+
+.. method:: BLE.gattc_discover_characteristics(conn_handle, start_handle, end_handle, uuid=None, /)
+
+ Query a connected server for characteristics in the specified range.
+
+ Optionally specify a characteristic *uuid* to query for that
+ characteristic only.
+
+ You can use ``start_handle=1``, ``end_handle=0xffff`` to search for a
+ characteristic in any service.
+
+ For each characteristic discovered, the ``_IRQ_GATTC_CHARACTERISTIC_RESULT``
+ event will be raised, followed by ``_IRQ_GATTC_CHARACTERISTIC_DONE`` on completion.
+
+.. method:: BLE.gattc_discover_descriptors(conn_handle, start_handle, end_handle, /)
+
+ Query a connected server for descriptors in the specified range.
+
+ For each descriptor discovered, the ``_IRQ_GATTC_DESCRIPTOR_RESULT`` event
+ will be raised, followed by ``_IRQ_GATTC_DESCRIPTOR_DONE`` on completion.
+
+.. method:: BLE.gattc_read(conn_handle, value_handle, /)
+
+ Issue a remote read to a connected server for the specified
+ characteristic or descriptor handle.
+
+ When a value is available, the ``_IRQ_GATTC_READ_RESULT`` event will be
+ raised. Additionally, the ``_IRQ_GATTC_READ_DONE`` will be raised.
+
+.. method:: BLE.gattc_write(conn_handle, value_handle, data, mode=0, /)
+
+ Issue a remote write to a connected server for the specified
+ characteristic or descriptor handle.
+
+ The argument *mode* specifies the write behaviour, with the currently
+ supported values being:
+
+ * ``mode=0`` (default) is a write-without-response: the write will
+ be sent to the remote server but no confirmation will be
+ returned, and no event will be raised.
+ * ``mode=1`` is a write-with-response: the remote server is
+ requested to send a response/acknowledgement that it received the
+ data.
+
+ If a response is received from the remote server the
+ ``_IRQ_GATTC_WRITE_DONE`` event will be raised.
+
+.. method:: BLE.gattc_exchange_mtu(conn_handle, /)
+
+ Initiate MTU exchange with a connected server, using the preferred MTU
+ set using ``BLE.config(mtu=value)``.
+
+ The ``_IRQ_MTU_EXCHANGED`` event will be raised when MTU exchange
+ completes.
+
+ **Note:** MTU exchange is typically initiated by the central. When using
+ the BlueKitchen stack in the central role, it does not support a remote
+ peripheral initiating the MTU exchange. NimBLE works for both roles.
+
+
+L2CAP connection-oriented-channels
+----------------------------------
+
+ This feature allows for socket-like data exchange between two BLE devices.
+ Once the devices are connected via GAP, either device can listen for the
+ other to connect on a numeric PSM (Protocol/Service Multiplexer).
+
+ **Note:** This is currently only supported when using the NimBLE stack on
+ STM32 and Unix (not ESP32). Only one L2CAP channel may be active at a given
+ time (i.e. you cannot connect while listening).
+
+ Active L2CAP channels are identified by the connection handle that they were
+ established on and a CID (channel ID).
+
+ Connection-oriented channels have built-in credit-based flow control. Unlike
+ ATT, where devices negotiate a shared MTU, both the listening and connecting
+ devices each set an independent MTU which limits the maximum amount of
+ outstanding data that the remote device can send before it is fully consumed
+ in :meth:`l2cap_recvinto `.
+
+.. method:: BLE.l2cap_listen(psm, mtu, /)
+
+ Start listening for incoming L2CAP channel requests on the specified *psm*
+ with the local MTU set to *mtu*.
+
+ When a remote device initiates a connection, the ``_IRQ_L2CAP_ACCEPT``
+ event will be raised, which gives the listening server a chance to reject
+ the incoming connection (by returning a non-zero integer).
+
+ Once the connection is accepted, the ``_IRQ_L2CAP_CONNECT`` event will be
+ raised, allowing the server to obtain the channel id (CID) and the local and
+ remote MTU.
+
+ **Note:** It is not currently possible to stop listening.
+
+.. method:: BLE.l2cap_connect(conn_handle, psm, mtu, /)
+
+ Connect to a listening peer on the specified *psm* with local MTU set to *mtu*.
+
+ On successful connection, the the ``_IRQ_L2CAP_CONNECT`` event will be
+ raised, allowing the client to obtain the CID and the local and remote (peer) MTU.
+
+ An unsuccessful connection will raise the ``_IRQ_L2CAP_DISCONNECT`` event
+ with a non-zero status.
+
+.. method:: BLE.l2cap_disconnect(conn_handle, cid, /)
+
+ Disconnect an active L2CAP channel with the specified *conn_handle* and
+ *cid*.
+
+.. method:: BLE.l2cap_send(conn_handle, cid, buf, /)
+
+ Send the specified *buf* (which must support the buffer protocol) on the
+ L2CAP channel identified by *conn_handle* and *cid*.
+
+ The specified buffer cannot be larger than the remote (peer) MTU, and no
+ more than twice the size of the local MTU.
+
+ This will return ``False`` if the channel is now "stalled", which means that
+ :meth:`l2cap_send ` must not be called again until the
+ ``_IRQ_L2CAP_SEND_READY`` event is received (which will happen when the
+ remote device grants more credits, typically after it has received and
+ processed the data).
+
+.. method:: BLE.l2cap_recvinto(conn_handle, cid, buf, /)
+
+ Receive data from the specified *conn_handle* and *cid* into the provided
+ *buf* (which must support the buffer protocol, e.g. bytearray or
+ memoryview).
+
+ Returns the number of bytes read from the channel.
+
+ If *buf* is None, then returns the number of bytes available.
+
+ **Note:** After receiving the ``_IRQ_L2CAP_RECV`` event, the application should
+ continue calling :meth:`l2cap_recvinto ` until no more
+ bytes are available in the receive buffer (typically up to the size of the
+ remote (peer) MTU).
+
+ Until the receive buffer is empty, the remote device will not be granted
+ more channel credits and will be unable to send any more data.
+
+
+Pairing and bonding
+-------------------
+
+ Pairing allows a connection to be encrypted and authenticated via exchange
+ of secrets (with optional MITM protection via passkey authentication).
+
+ Bonding is the process of storing those secrets into non-volatile storage.
+ When bonded, a device is able to resolve a resolvable private address (RPA)
+ from another device based on the stored identity resolving key (IRK).
+ To support bonding, an application must implement the ``_IRQ_GET_SECRET``
+ and ``_IRQ_SET_SECRET`` events.
+
+ **Note:** This is currently only supported when using the NimBLE stack on
+ STM32 and Unix (not ESP32).
+
+.. method:: BLE.gap_pair(conn_handle, /)
+
+ Initiate pairing with the remote device.
+
+ Before calling this, ensure that the ``io``, ``mitm``, ``le_secure``, and
+ ``bond`` configuration options are set (via :meth:`config`).
+
+ On successful pairing, the ``_IRQ_ENCRYPTION_UPDATE`` event will be raised.
+
+.. method:: BLE.gap_passkey(conn_handle, action, passkey, /)
+
+ Respond to a ``_IRQ_PASSKEY_ACTION`` event for the specified *conn_handle*
+ and *action*.
+
+ The *passkey* is a numeric value and will depend on on the
+ *action* (which will depend on what I/O capability has been set):
+
+ * When the *action* is ``_PASSKEY_ACTION_INPUT``, then the application should
+ prompt the user to enter the passkey that is shown on the remote device.
+ * When the *action* is ``_PASSKEY_ACTION_DISPLAY``, then the application should
+ generate a random 6-digit passkey and show it to the user.
+ * When the *action* is ``_PASSKEY_ACTION_NUMERIC_COMPARISON``, then the application
+ should show the passkey that was provided in the ``_IRQ_PASSKEY_ACTION`` event
+ and then respond with either ``0`` (cancel pairing), or ``1`` (accept pairing).
+
+
+class UUID
+----------
+
+
+Constructor
+-----------
+
+.. class:: UUID(value, /)
+
+ Creates a UUID instance with the specified **value**.
+
+ The **value** can be either:
+
+ - A 16-bit integer. e.g. ``0x2908``.
+ - A 128-bit UUID string. e.g. ``'6E400001-B5A3-F393-E0A9-E50E24DCCA9E'``.
diff --git a/components/language/micropython/docs/library/btree.rst b/components/language/micropython/docs/library/btree.rst
new file mode 100644
index 00000000..c093f970
--- /dev/null
+++ b/components/language/micropython/docs/library/btree.rst
@@ -0,0 +1,159 @@
+:mod:`btree` -- simple BTree database
+=====================================
+
+.. module:: btree
+ :synopsis: simple BTree database
+
+The ``btree`` module implements a simple key-value database using external
+storage (disk files, or in general case, a random-access `stream`). Keys are
+stored sorted in the database, and besides efficient retrieval by a key
+value, a database also supports efficient ordered range scans (retrieval
+of values with the keys in a given range). On the application interface
+side, BTree database work as close a possible to a way standard `dict`
+type works, one notable difference is that both keys and values must
+be `bytes` objects (so, if you want to store objects of other types, you
+need to serialize them to `bytes` first).
+
+The module is based on the well-known BerkelyDB library, version 1.xx.
+
+Example::
+
+ import btree
+
+ # First, we need to open a stream which holds a database
+ # This is usually a file, but can be in-memory database
+ # using io.BytesIO, a raw flash partition, etc.
+ # Oftentimes, you want to create a database file if it doesn't
+ # exist and open if it exists. Idiom below takes care of this.
+ # DO NOT open database with "a+b" access mode.
+ try:
+ f = open("mydb", "r+b")
+ except OSError:
+ f = open("mydb", "w+b")
+
+ # Now open a database itself
+ db = btree.open(f)
+
+ # The keys you add will be sorted internally in the database
+ db[b"3"] = b"three"
+ db[b"1"] = b"one"
+ db[b"2"] = b"two"
+
+ # Assume that any changes are cached in memory unless
+ # explicitly flushed (or database closed). Flush database
+ # at the end of each "transaction".
+ db.flush()
+
+ # Prints b'two'
+ print(db[b"2"])
+
+ # Iterate over sorted keys in the database, starting from b"2"
+ # until the end of the database, returning only values.
+ # Mind that arguments passed to values() method are *key* values.
+ # Prints:
+ # b'two'
+ # b'three'
+ for word in db.values(b"2"):
+ print(word)
+
+ del db[b"2"]
+
+ # No longer true, prints False
+ print(b"2" in db)
+
+ # Prints:
+ # b"1"
+ # b"3"
+ for key in db:
+ print(key)
+
+ db.close()
+
+ # Don't forget to close the underlying stream!
+ f.close()
+
+
+Functions
+---------
+
+.. function:: open(stream, *, flags=0, pagesize=0, cachesize=0, minkeypage=0)
+
+ Open a database from a random-access `stream` (like an open file). All
+ other parameters are optional and keyword-only, and allow to tweak advanced
+ parameters of the database operation (most users will not need them):
+
+ * *flags* - Currently unused.
+ * *pagesize* - Page size used for the nodes in BTree. Acceptable range
+ is 512-65536. If 0, a port-specific default will be used, optimized for
+ port's memory usage and/or performance.
+ * *cachesize* - Suggested memory cache size in bytes. For a
+ board with enough memory using larger values may improve performance.
+ Cache policy is as follows: entire cache is not allocated at once;
+ instead, accessing a new page in database will allocate a memory buffer
+ for it, until value specified by *cachesize* is reached. Then, these
+ buffers will be managed using LRU (least recently used) policy. More
+ buffers may still be allocated if needed (e.g., if a database contains
+ big keys and/or values). Allocated cache buffers aren't reclaimed.
+ * *minkeypage* - Minimum number of keys to store per page. Default value
+ of 0 equivalent to 2.
+
+ Returns a BTree object, which implements a dictionary protocol (set
+ of methods), and some additional methods described below.
+
+Methods
+-------
+
+.. method:: btree.close()
+
+ Close the database. It's mandatory to close the database at the end of
+ processing, as some unwritten data may be still in the cache. Note that
+ this does not close underlying stream with which the database was opened,
+ it should be closed separately (which is also mandatory to make sure that
+ data flushed from buffer to the underlying storage).
+
+.. method:: btree.flush()
+
+ Flush any data in cache to the underlying stream.
+
+.. method:: btree.__getitem__(key)
+ btree.get(key, default=None, /)
+ btree.__setitem__(key, val)
+ btree.__delitem__(key)
+ btree.__contains__(key)
+
+ Standard dictionary methods.
+
+.. method:: btree.__iter__()
+
+ A BTree object can be iterated over directly (similar to a dictionary)
+ to get access to all keys in order.
+
+.. method:: btree.keys([start_key, [end_key, [flags]]])
+ btree.values([start_key, [end_key, [flags]]])
+ btree.items([start_key, [end_key, [flags]]])
+
+ These methods are similar to standard dictionary methods, but also can
+ take optional parameters to iterate over a key sub-range, instead of
+ the entire database. Note that for all 3 methods, *start_key* and
+ *end_key* arguments represent key values. For example, `values()`
+ method will iterate over values corresponding to they key range
+ given. None values for *start_key* means "from the first key", no
+ *end_key* or its value of None means "until the end of database".
+ By default, range is inclusive of *start_key* and exclusive of
+ *end_key*, you can include *end_key* in iteration by passing *flags*
+ of `btree.INCL`. You can iterate in descending key direction
+ by passing *flags* of `btree.DESC`. The flags values can be ORed
+ together.
+
+Constants
+---------
+
+.. data:: INCL
+
+ A flag for `keys()`, `values()`, `items()` methods to specify that
+ scanning should be inclusive of the end key.
+
+.. data:: DESC
+
+ A flag for `keys()`, `values()`, `items()` methods to specify that
+ scanning should be in descending direction of keys.
diff --git a/components/language/micropython/docs/library/builtins.rst b/components/language/micropython/docs/library/builtins.rst
new file mode 100644
index 00000000..7a0229c2
--- /dev/null
+++ b/components/language/micropython/docs/library/builtins.rst
@@ -0,0 +1,195 @@
+:mod:`builtins` -- builtin functions and exceptions
+===================================================
+
+All builtin functions and exceptions are described here. They are also
+available via ``builtins`` module.
+
+Functions and types
+-------------------
+
+.. function:: abs()
+
+.. function:: all()
+
+.. function:: any()
+
+.. function:: bin()
+
+.. class:: bool()
+
+.. class:: bytearray()
+
+.. class:: bytes()
+
+ |see_cpython| `python:bytes`.
+
+.. function:: callable()
+
+.. function:: chr()
+
+.. function:: classmethod()
+
+.. function:: compile()
+
+.. class:: complex()
+
+.. function:: delattr(obj, name)
+
+ The argument *name* should be a string, and this function deletes the named
+ attribute from the object given by *obj*.
+
+.. class:: dict()
+
+.. function:: dir()
+
+.. function:: divmod()
+
+.. function:: enumerate()
+
+.. function:: eval()
+
+.. function:: exec()
+
+.. function:: filter()
+
+.. class:: float()
+
+.. class:: frozenset()
+
+.. function:: getattr()
+
+.. function:: globals()
+
+.. function:: hasattr()
+
+.. function:: hash()
+
+.. function:: hex()
+
+.. function:: id()
+
+.. function:: input()
+
+.. class:: int()
+
+ .. classmethod:: from_bytes(bytes, byteorder)
+
+ In MicroPython, `byteorder` parameter must be positional (this is
+ compatible with CPython).
+
+ .. method:: to_bytes(size, byteorder)
+
+ In MicroPython, `byteorder` parameter must be positional (this is
+ compatible with CPython).
+
+.. function:: isinstance()
+
+.. function:: issubclass()
+
+.. function:: iter()
+
+.. function:: len()
+
+.. class:: list()
+
+.. function:: locals()
+
+.. function:: map()
+
+.. function:: max()
+
+.. class:: memoryview()
+
+.. function:: min()
+
+.. function:: next()
+
+.. class:: object()
+
+.. function:: oct()
+
+.. function:: open()
+
+.. function:: ord()
+
+.. function:: pow()
+
+.. function:: print()
+
+.. function:: property()
+
+.. function:: range()
+
+.. function:: repr()
+
+.. function:: reversed()
+
+.. function:: round()
+
+.. class:: set()
+
+.. function:: setattr()
+
+.. class:: slice()
+
+ The *slice* builtin is the type that slice objects have.
+
+.. function:: sorted()
+
+.. function:: staticmethod()
+
+.. class:: str()
+
+.. function:: sum()
+
+.. function:: super()
+
+.. class:: tuple()
+
+.. function:: type()
+
+.. function:: zip()
+
+
+Exceptions
+----------
+
+.. exception:: AssertionError
+
+.. exception:: AttributeError
+
+.. exception:: Exception
+
+.. exception:: ImportError
+
+.. exception:: IndexError
+
+.. exception:: KeyboardInterrupt
+
+.. exception:: KeyError
+
+.. exception:: MemoryError
+
+.. exception:: NameError
+
+.. exception:: NotImplementedError
+
+.. exception:: OSError
+
+.. exception:: RuntimeError
+
+.. exception:: StopIteration
+
+.. exception:: SyntaxError
+
+.. exception:: SystemExit
+
+ |see_cpython| `python:SystemExit`.
+
+.. exception:: TypeError
+
+ |see_cpython| `python:TypeError`.
+
+.. exception:: ValueError
+
+.. exception:: ZeroDivisionError
diff --git a/components/language/micropython/docs/library/cmath.rst b/components/language/micropython/docs/library/cmath.rst
new file mode 100644
index 00000000..59e4ec17
--- /dev/null
+++ b/components/language/micropython/docs/library/cmath.rst
@@ -0,0 +1,63 @@
+:mod:`cmath` -- mathematical functions for complex numbers
+==========================================================
+
+.. module:: cmath
+ :synopsis: mathematical functions for complex numbers
+
+|see_cpython_module| :mod:`python:cmath`.
+
+The ``cmath`` module provides some basic mathematical functions for
+working with complex numbers.
+
+Availability: not available on WiPy and ESP8266. Floating point support
+required for this module.
+
+Functions
+---------
+
+.. function:: cos(z)
+
+ Return the cosine of ``z``.
+
+.. function:: exp(z)
+
+ Return the exponential of ``z``.
+
+.. function:: log(z)
+
+ Return the natural logarithm of ``z``. The branch cut is along the negative real axis.
+
+.. function:: log10(z)
+
+ Return the base-10 logarithm of ``z``. The branch cut is along the negative real axis.
+
+.. function:: phase(z)
+
+ Returns the phase of the number ``z``, in the range (-pi, +pi].
+
+.. function:: polar(z)
+
+ Returns, as a tuple, the polar form of ``z``.
+
+.. function:: rect(r, phi)
+
+ Returns the complex number with modulus ``r`` and phase ``phi``.
+
+.. function:: sin(z)
+
+ Return the sine of ``z``.
+
+.. function:: sqrt(z)
+
+ Return the square-root of ``z``.
+
+Constants
+---------
+
+.. data:: e
+
+ base of the natural logarithm
+
+.. data:: pi
+
+ the ratio of a circle's circumference to its diameter
diff --git a/components/language/micropython/docs/library/collections.rst b/components/language/micropython/docs/library/collections.rst
new file mode 100644
index 00000000..6cf2c096
--- /dev/null
+++ b/components/language/micropython/docs/library/collections.rst
@@ -0,0 +1,82 @@
+:mod:`collections` -- collection and container types
+====================================================
+
+.. module:: collections
+ :synopsis: collection and container types
+
+|see_cpython_module| :mod:`python:collections`.
+
+This module implements advanced collection and container types to
+hold/accumulate various objects.
+
+Classes
+-------
+
+.. class:: deque(iterable, maxlen[, flags])
+
+ Deques (double-ended queues) are a list-like container that support O(1)
+ appends and pops from either side of the deque. New deques are created
+ using the following arguments:
+
+ - *iterable* must be the empty tuple, and the new deque is created empty.
+
+ - *maxlen* must be specified and the deque will be bounded to this
+ maximum length. Once the deque is full, any new items added will
+ discard items from the opposite end.
+
+ - The optional *flags* can be 1 to check for overflow when adding items.
+
+ As well as supporting `bool` and `len`, deque objects have the following
+ methods:
+
+ .. method:: deque.append(x)
+
+ Add *x* to the right side of the deque.
+ Raises IndexError if overflow checking is enabled and there is no more room left.
+
+ .. method:: deque.popleft()
+
+ Remove and return an item from the left side of the deque.
+ Raises IndexError if no items are present.
+
+.. function:: namedtuple(name, fields)
+
+ This is factory function to create a new namedtuple type with a specific
+ name and set of fields. A namedtuple is a subclass of tuple which allows
+ to access its fields not just by numeric index, but also with an attribute
+ access syntax using symbolic field names. Fields is a sequence of strings
+ specifying field names. For compatibility with CPython it can also be a
+ a string with space-separated field named (but this is less efficient).
+ Example of use::
+
+ from collections import namedtuple
+
+ MyTuple = namedtuple("MyTuple", ("id", "name"))
+ t1 = MyTuple(1, "foo")
+ t2 = MyTuple(2, "bar")
+ print(t1.name)
+ assert t2.name == t2[1]
+
+.. class:: OrderedDict(...)
+
+ ``dict`` type subclass which remembers and preserves the order of keys
+ added. When ordered dict is iterated over, keys/items are returned in
+ the order they were added::
+
+ from collections import OrderedDict
+
+ # To make benefit of ordered keys, OrderedDict should be initialized
+ # from sequence of (key, value) pairs.
+ d = OrderedDict([("z", 1), ("a", 2)])
+ # More items can be added as usual
+ d["w"] = 5
+ d["b"] = 3
+ for k, v in d.items():
+ print(k, v)
+
+ Output::
+
+ z 1
+ a 2
+ w 5
+ b 3
diff --git a/components/language/micropython/docs/library/cryptolib.rst b/components/language/micropython/docs/library/cryptolib.rst
new file mode 100644
index 00000000..e02fb0d2
--- /dev/null
+++ b/components/language/micropython/docs/library/cryptolib.rst
@@ -0,0 +1,40 @@
+:mod:`cryptolib` -- cryptographic ciphers
+=========================================
+
+.. module:: cryptolib
+ :synopsis: cryptographic ciphers
+
+Classes
+-------
+
+.. class:: aes
+
+ .. classmethod:: __init__(key, mode, [IV])
+
+ Initialize cipher object, suitable for encryption/decryption. Note:
+ after initialization, cipher object can be use only either for
+ encryption or decryption. Running decrypt() operation after encrypt()
+ or vice versa is not supported.
+
+ Parameters are:
+
+ * *key* is an encryption/decryption key (bytes-like).
+ * *mode* is:
+
+ * ``1`` (or ``cryptolib.MODE_ECB`` if it exists) for Electronic Code Book (ECB).
+ * ``2`` (or ``cryptolib.MODE_CBC`` if it exists) for Cipher Block Chaining (CBC).
+ * ``6`` (or ``cryptolib.MODE_CTR`` if it exists) for Counter mode (CTR).
+
+ * *IV* is an initialization vector for CBC mode.
+ * For Counter mode, *IV* is the initial value for the counter.
+
+ .. method:: encrypt(in_buf, [out_buf])
+
+ Encrypt *in_buf*. If no *out_buf* is given result is returned as a
+ newly allocated `bytes` object. Otherwise, result is written into
+ mutable buffer *out_buf*. *in_buf* and *out_buf* can also refer
+ to the same mutable buffer, in which case data is encrypted in-place.
+
+ .. method:: decrypt(in_buf, [out_buf])
+
+ Like `encrypt()`, but for decryption.
diff --git a/components/language/micropython/docs/library/errno.rst b/components/language/micropython/docs/library/errno.rst
new file mode 100644
index 00000000..82303bfc
--- /dev/null
+++ b/components/language/micropython/docs/library/errno.rst
@@ -0,0 +1,34 @@
+:mod:`errno` -- system error codes
+==================================
+
+.. module:: errno
+ :synopsis: system error codes
+
+|see_cpython_module| :mod:`python:errno`.
+
+This module provides access to symbolic error codes for `OSError` exception.
+A particular inventory of codes depends on :term:`MicroPython port`.
+
+Constants
+---------
+
+.. data:: EEXIST, EAGAIN, etc.
+
+ Error codes, based on ANSI C/POSIX standard. All error codes start with
+ "E". As mentioned above, inventory of the codes depends on
+ :term:`MicroPython port`. Errors are usually accessible as ``exc.errno``
+ where ``exc`` is an instance of `OSError`. Usage example::
+
+ try:
+ os.mkdir("my_dir")
+ except OSError as exc:
+ if exc.errno == errno.EEXIST:
+ print("Directory already exists")
+
+.. data:: errorcode
+
+ Dictionary mapping numeric error codes to strings with symbolic error
+ code (see above)::
+
+ >>> print(errno.errorcode[errno.EEXIST])
+ EEXIST
diff --git a/components/language/micropython/docs/library/esp.rst b/components/language/micropython/docs/library/esp.rst
new file mode 100644
index 00000000..8920c824
--- /dev/null
+++ b/components/language/micropython/docs/library/esp.rst
@@ -0,0 +1,116 @@
+:mod:`esp` --- functions related to the ESP8266 and ESP32
+=========================================================
+
+.. module:: esp
+ :synopsis: functions related to the ESP8266 and ESP32
+
+The ``esp`` module contains specific functions related to both the ESP8266 and
+ESP32 modules. Some functions are only available on one or the other of these
+ports.
+
+
+Functions
+---------
+
+.. function:: sleep_type([sleep_type])
+
+ **Note**: ESP8266 only
+
+ Get or set the sleep type.
+
+ If the *sleep_type* parameter is provided, sets the sleep type to its
+ value. If the function is called without parameters, returns the current
+ sleep type.
+
+ The possible sleep types are defined as constants:
+
+ * ``SLEEP_NONE`` -- all functions enabled,
+ * ``SLEEP_MODEM`` -- modem sleep, shuts down the WiFi Modem circuit.
+ * ``SLEEP_LIGHT`` -- light sleep, shuts down the WiFi Modem circuit
+ and suspends the processor periodically.
+
+ The system enters the set sleep mode automatically when possible.
+
+.. function:: deepsleep(time_us=0, /)
+
+ **Note**: ESP8266 only - use `machine.deepsleep()` on ESP32
+
+ Enter deep sleep.
+
+ The whole module powers down, except for the RTC clock circuit, which can
+ be used to restart the module after the specified time if the pin 16 is
+ connected to the reset pin. Otherwise the module will sleep until manually
+ reset.
+
+.. function:: flash_id()
+
+ **Note**: ESP8266 only
+
+ Read the device ID of the flash memory.
+
+.. function:: flash_size()
+
+ Read the total size of the flash memory.
+
+.. function:: flash_user_start()
+
+ Read the memory offset at which the user flash space begins.
+
+.. function:: flash_read(byte_offset, length_or_buffer)
+
+.. function:: flash_write(byte_offset, bytes)
+
+.. function:: flash_erase(sector_no)
+
+.. function:: osdebug(level)
+
+ Turn esp os debugging messages on or off.
+
+ The *level* parameter sets the threshold for the log messages for all esp components.
+ The log levels are defined as constants:
+
+ * ``LOG_NONE`` -- No log output
+ * ``LOG_ERROR`` -- Critical errors, software module can not recover on its own
+ * ``LOG_WARN`` -- Error conditions from which recovery measures have been taken
+ * ``LOG_INFO`` -- Information messages which describe normal flow of events
+ * ``LOG_DEBUG`` -- Extra information which is not necessary for normal use (values, pointers, sizes, etc)
+ * ``LOG_VERBOSE`` -- Bigger chunks of debugging information, or frequent messages
+ which can potentially flood the output
+
+.. function:: set_native_code_location(start, length)
+
+ **Note**: ESP8266 only
+
+ Set the location that native code will be placed for execution after it is
+ compiled. Native code is emitted when the ``@micropython.native``,
+ ``@micropython.viper`` and ``@micropython.asm_xtensa`` decorators are applied
+ to a function. The ESP8266 must execute code from either iRAM or the lower
+ 1MByte of flash (which is memory mapped), and this function controls the
+ location.
+
+ If *start* and *length* are both ``None`` then the native code location is
+ set to the unused portion of memory at the end of the iRAM1 region. The
+ size of this unused portion depends on the firmware and is typically quite
+ small (around 500 bytes), and is enough to store a few very small
+ functions. The advantage of using this iRAM1 region is that it does not
+ get worn out by writing to it.
+
+ If neither *start* nor *length* are ``None`` then they should be integers.
+ *start* should specify the byte offset from the beginning of the flash at
+ which native code should be stored. *length* specifies how many bytes of
+ flash from *start* can be used to store native code. *start* and *length*
+ should be multiples of the sector size (being 4096 bytes). The flash will
+ be automatically erased before writing to it so be sure to use a region of
+ flash that is not otherwise used, for example by the firmware or the
+ filesystem.
+
+ When using the flash to store native code *start+length* must be less
+ than or equal to 1MByte. Note that the flash can be worn out if repeated
+ erasures (and writes) are made so use this feature sparingly.
+ In particular, native code needs to be recompiled and rewritten to flash
+ on each boot (including wake from deepsleep).
+
+ In both cases above, using iRAM1 or flash, if there is no more room left
+ in the specified region then the use of a native decorator on a function
+ will lead to `MemoryError` exception being raised during compilation of
+ that function.
diff --git a/components/language/micropython/docs/library/esp32.rst b/components/language/micropython/docs/library/esp32.rst
new file mode 100644
index 00000000..33480034
--- /dev/null
+++ b/components/language/micropython/docs/library/esp32.rst
@@ -0,0 +1,348 @@
+.. currentmodule:: esp32
+
+:mod:`esp32` --- functionality specific to the ESP32
+====================================================
+
+.. module:: esp32
+ :synopsis: functionality specific to the ESP32
+
+The ``esp32`` module contains functions and classes specifically aimed at
+controlling ESP32 modules.
+
+
+Functions
+---------
+
+.. function:: wake_on_touch(wake)
+
+ Configure whether or not a touch will wake the device from sleep.
+ *wake* should be a boolean value.
+
+.. function:: wake_on_ext0(pin, level)
+
+ Configure how EXT0 wakes the device from sleep. *pin* can be ``None``
+ or a valid Pin object. *level* should be ``esp32.WAKEUP_ALL_LOW`` or
+ ``esp32.WAKEUP_ANY_HIGH``.
+
+.. function:: wake_on_ext1(pins, level)
+
+ Configure how EXT1 wakes the device from sleep. *pins* can be ``None``
+ or a tuple/list of valid Pin objects. *level* should be ``esp32.WAKEUP_ALL_LOW``
+ or ``esp32.WAKEUP_ANY_HIGH``.
+
+.. function:: gpio_deep_sleep_hold(enable)
+
+ Configure whether non-RTC GPIO pin configuration is retained during
+ deep-sleep mode for held pads. *enable* should be a boolean value.
+
+.. function:: raw_temperature()
+
+ Read the raw value of the internal temperature sensor, returning an integer.
+
+.. function:: hall_sensor()
+
+ Read the raw value of the internal Hall sensor, returning an integer.
+
+.. function:: idf_heap_info(capabilities)
+
+ Returns information about the ESP-IDF heap memory regions. One of them contains
+ the MicroPython heap and the others are used by ESP-IDF, e.g., for network
+ buffers and other data. This data is useful to get a sense of how much memory
+ is available to ESP-IDF and the networking stack in particular. It may shed
+ some light on situations where ESP-IDF operations fail due to allocation failures.
+ The information returned is *not* useful to troubleshoot Python allocation failures,
+ use `micropython.mem_info()` instead.
+
+ The capabilities parameter corresponds to ESP-IDF's ``MALLOC_CAP_XXX`` values but the
+ two most useful ones are predefined as `esp32.HEAP_DATA` for data heap regions and
+ `esp32.HEAP_EXEC` for executable regions as used by the native code emitter.
+
+ The return value is a list of 4-tuples, where each 4-tuple corresponds to one heap
+ and contains: the total bytes, the free bytes, the largest free block, and
+ the minimum free seen over time.
+
+ Example after booting::
+
+ >>> import esp32; esp32.idf_heap_info(esp32.HEAP_DATA)
+ [(240, 0, 0, 0), (7288, 0, 0, 0), (16648, 4, 4, 4), (79912, 35712, 35512, 35108),
+ (15072, 15036, 15036, 15036), (113840, 0, 0, 0)]
+
+Flash partitions
+----------------
+
+This class gives access to the partitions in the device's flash memory and includes
+methods to enable over-the-air (OTA) updates.
+
+.. class:: Partition(id, block_size=4096, /)
+
+ Create an object representing a partition. *id* can be a string which is the label
+ of the partition to retrieve, or one of the constants: ``BOOT`` or ``RUNNING``.
+ *block_size* specifies the byte size of an individual block.
+
+.. classmethod:: Partition.find(type=TYPE_APP, subtype=0xff, label=None, block_size=4096)
+
+ Find a partition specified by *type*, *subtype* and *label*. Returns a
+ (possibly empty) list of Partition objects. Note: ``subtype=0xff`` matches any subtype
+ and ``label=None`` matches any label.
+
+ *block_size* specifies the byte size of an individual block used by the returned
+ objects.
+
+.. method:: Partition.info()
+
+ Returns a 6-tuple ``(type, subtype, addr, size, label, encrypted)``.
+
+.. method:: Partition.readblocks(block_num, buf)
+ Partition.readblocks(block_num, buf, offset)
+.. method:: Partition.writeblocks(block_num, buf)
+ Partition.writeblocks(block_num, buf, offset)
+.. method:: Partition.ioctl(cmd, arg)
+
+ These methods implement the simple and :ref:`extended
+ ` block protocol defined by
+ :class:`os.AbstractBlockDev`.
+
+.. method:: Partition.set_boot()
+
+ Sets the partition as the boot partition.
+
+.. method:: Partition.get_next_update()
+
+ Gets the next update partition after this one, and returns a new Partition object.
+ Typical usage is ``Partition(Partition.RUNNING).get_next_update()``
+ which returns the next partition to update given the current running one.
+
+.. classmethod:: Partition.mark_app_valid_cancel_rollback()
+
+ Signals that the current boot is considered successful.
+ Calling ``mark_app_valid_cancel_rollback`` is required on the first boot of a new
+ partition to avoid an automatic rollback at the next boot.
+ This uses the ESP-IDF "app rollback" feature with "CONFIG_BOOTLOADER_APP_ROLLBACK_ENABLE"
+ and an ``OSError(-261)`` is raised if called on firmware that doesn't have the
+ feature enabled.
+ It is OK to call ``mark_app_valid_cancel_rollback`` on every boot and it is not
+ necessary when booting firmare that was loaded using esptool.
+
+Constants
+~~~~~~~~~
+
+.. data:: Partition.BOOT
+ Partition.RUNNING
+
+ Used in the `Partition` constructor to fetch various partitions: ``BOOT`` is the
+ partition that will be booted at the next reset and ``RUNNING`` is the currently
+ running partition.
+
+.. data:: Partition.TYPE_APP
+ Partition.TYPE_DATA
+
+ Used in `Partition.find` to specify the partition type: ``APP`` is for bootable
+ firmware partitions (typically labelled ``factory``, ``ota_0``, ``ota_1``), and
+ ``DATA`` is for other partitions, e.g. ``nvs``, ``otadata``, ``phy_init``, ``vfs``.
+
+.. data:: HEAP_DATA
+ HEAP_EXEC
+
+ Used in `idf_heap_info`.
+
+.. _esp32.RMT:
+
+RMT
+---
+
+The RMT (Remote Control) module, specific to the ESP32, was originally designed
+to send and receive infrared remote control signals. However, due to a flexible
+design and very accurate (as low as 12.5ns) pulse generation, it can also be
+used to transmit or receive many other types of digital signals::
+
+ import esp32
+ from machine import Pin
+
+ r = esp32.RMT(0, pin=Pin(18), clock_div=8)
+ r # RMT(channel=0, pin=18, source_freq=80000000, clock_div=8, idle_level=0)
+
+ # To apply a carrier frequency to the high output
+ r = esp32.RMT(0, pin=Pin(18), clock_div=8, tx_carrier=(38000, 50, 1))
+
+ # The channel resolution is 100ns (1/(source_freq/clock_div)).
+ r.write_pulses((1, 20, 2, 40), 0) # Send 0 for 100ns, 1 for 2000ns, 0 for 200ns, 1 for 4000ns
+
+The input to the RMT module is an 80MHz clock (in the future it may be able to
+configure the input clock but, for now, it's fixed). ``clock_div`` *divides*
+the clock input which determines the resolution of the RMT channel. The
+numbers specified in ``write_pulses`` are multiplied by the resolution to
+define the pulses.
+
+``clock_div`` is an 8-bit divider (0-255) and each pulse can be defined by
+multiplying the resolution by a 15-bit (0-32,768) number. There are eight
+channels (0-7) and each can have a different clock divider.
+
+So, in the example above, the 80MHz clock is divided by 8. Thus the
+resolution is (1/(80Mhz/8)) 100ns. Since the ``start`` level is 0 and toggles
+with each number, the bitstream is ``0101`` with durations of [100ns, 2000ns,
+100ns, 4000ns].
+
+For more details see Espressif's `ESP-IDF RMT documentation.
+`_.
+
+.. Warning::
+ The current MicroPython RMT implementation lacks some features, most notably
+ receiving pulses. RMT should be considered a
+ *beta feature* and the interface may change in the future.
+
+
+.. class:: RMT(channel, *, pin=None, clock_div=8, idle_level=False, tx_carrier=None)
+
+ This class provides access to one of the eight RMT channels. *channel* is
+ required and identifies which RMT channel (0-7) will be configured. *pin*,
+ also required, configures which Pin is bound to the RMT channel. *clock_div*
+ is an 8-bit clock divider that divides the source clock (80MHz) to the RMT
+ channel allowing the resolution to be specified. *idle_level* specifies
+ what level the output will be when no transmission is in progress and can
+ be any value that converts to a boolean, with ``True`` representing high
+ voltage and ``False`` representing low.
+
+ To enable the transmission carrier feature, *tx_carrier* should be a tuple
+ of three positive integers: carrier frequency, duty percent (``0`` to
+ ``100``) and the output level to apply the carrier to (a boolean as per
+ *idle_level*).
+
+.. method:: RMT.source_freq()
+
+ Returns the source clock frequency. Currently the source clock is not
+ configurable so this will always return 80MHz.
+
+.. method:: RMT.clock_div()
+
+ Return the clock divider. Note that the channel resolution is
+ ``1 / (source_freq / clock_div)``.
+
+.. method:: RMT.wait_done(*, timeout=0)
+
+ Returns ``True`` if the channel is idle or ``False`` if a sequence of
+ pulses started with `RMT.write_pulses` is being transmitted. If the
+ *timeout* keyword argument is given then block for up to this many
+ milliseconds for transmission to complete.
+
+.. method:: RMT.loop(enable_loop)
+
+ Configure looping on the channel. *enable_loop* is bool, set to ``True`` to
+ enable looping on the *next* call to `RMT.write_pulses`. If called with
+ ``False`` while a looping sequence is currently being transmitted then the
+ current loop iteration will be completed and then transmission will stop.
+
+.. method:: RMT.write_pulses(duration, data=True)
+
+ Begin transmitting a sequence. There are three ways to specify this:
+
+ **Mode 1:** *duration* is a list or tuple of durations. The optional *data*
+ argument specifies the initial output level. The output level will toggle
+ after each duration.
+
+ **Mode 2:** *duration* is a positive integer and *data* is a list or tuple
+ of output levels. *duration* specifies a fixed duration for each.
+
+ **Mode 3:** *duration* and *data* are lists or tuples of equal length,
+ specifying individual durations and the output level for each.
+
+ Durations are in integer units of the channel resolution (as described
+ above), between 1 and 32767 units. Output levels are any value that can
+ be converted to a boolean, with ``True`` representing high voltage and
+ ``False`` representing low.
+
+ If transmission of an earlier sequence is in progress then this method will
+ block until that transmission is complete before beginning the new sequence.
+
+ If looping has been enabled with `RMT.loop`, the sequence will be
+ repeated indefinitely. Further calls to this method will block until the
+ end of the current loop iteration before immediately beginning to loop the
+ new sequence of pulses. Looping sequences longer than 126 pulses is not
+ supported by the hardware.
+
+.. staticmethod:: RMT.bitstream_channel([value])
+
+ Select which RMT channel is used by the `machine.bitstream` implementation.
+ *value* can be ``None`` or a valid RMT channel number. The default RMT
+ channel is the highest numbered one.
+
+ Passing in ``None`` disables the use of RMT and instead selects a bit-banging
+ implementation for `machine.bitstream`.
+
+ Passing in no argument will not change the channel. This function returns
+ the current channel number.
+
+Ultra-Low-Power co-processor
+----------------------------
+
+.. class:: ULP()
+
+ This class provides access to the Ultra-Low-Power co-processor.
+
+.. method:: ULP.set_wakeup_period(period_index, period_us)
+
+ Set the wake-up period.
+
+.. method:: ULP.load_binary(load_addr, program_binary)
+
+ Load a *program_binary* into the ULP at the given *load_addr*.
+
+.. method:: ULP.run(entry_point)
+
+ Start the ULP running at the given *entry_point*.
+
+
+Constants
+---------
+
+.. data:: esp32.WAKEUP_ALL_LOW
+ esp32.WAKEUP_ANY_HIGH
+
+ Selects the wake level for pins.
+
+Non-Volatile Storage
+--------------------
+
+This class gives access to the Non-Volatile storage managed by ESP-IDF. The NVS is partitioned
+into namespaces and each namespace contains typed key-value pairs. The keys are strings and the
+values may be various integer types, strings, and binary blobs. The driver currently only
+supports 32-bit signed integers and blobs.
+
+.. warning::
+
+ Changes to NVS need to be committed to flash by calling the commit method. Failure
+ to call commit results in changes being lost at the next reset.
+
+.. class:: NVS(namespace)
+
+ Create an object providing access to a namespace (which is automatically created if not
+ present).
+
+.. method:: NVS.set_i32(key, value)
+
+ Sets a 32-bit signed integer value for the specified key. Remember to call *commit*!
+
+.. method:: NVS.get_i32(key)
+
+ Returns the signed integer value for the specified key. Raises an OSError if the key does not
+ exist or has a different type.
+
+.. method:: NVS.set_blob(key, value)
+
+ Sets a binary blob value for the specified key. The value passed in must support the buffer
+ protocol, e.g. bytes, bytearray, str. (Note that esp-idf distinguishes blobs and strings, this
+ method always writes a blob even if a string is passed in as value.)
+ Remember to call *commit*!
+
+.. method:: NVS.get_blob(key, buffer)
+
+ Reads the value of the blob for the specified key into the buffer, which must be a bytearray.
+ Returns the actual length read. Raises an OSError if the key does not exist, has a different
+ type, or if the buffer is too small.
+
+.. method:: NVS.erase_key(key)
+
+ Erases a key-value pair.
+
+.. method:: NVS.commit()
+
+ Commits changes made by *set_xxx* methods to flash.
diff --git a/components/language/micropython/docs/library/framebuf.rst b/components/language/micropython/docs/library/framebuf.rst
new file mode 100644
index 00000000..098ada81
--- /dev/null
+++ b/components/language/micropython/docs/library/framebuf.rst
@@ -0,0 +1,168 @@
+:mod:`framebuf` --- frame buffer manipulation
+=============================================
+
+.. module:: framebuf
+ :synopsis: Frame buffer manipulation
+
+This module provides a general frame buffer which can be used to create
+bitmap images, which can then be sent to a display.
+
+class FrameBuffer
+-----------------
+
+The FrameBuffer class provides a pixel buffer which can be drawn upon with
+pixels, lines, rectangles, text and even other FrameBuffer's. It is useful
+when generating output for displays.
+
+For example::
+
+ import framebuf
+
+ # FrameBuffer needs 2 bytes for every RGB565 pixel
+ fbuf = framebuf.FrameBuffer(bytearray(100 * 10 * 2), 100, 10, framebuf.RGB565)
+
+ fbuf.fill(0)
+ fbuf.text('MicroPython!', 0, 0, 0xffff)
+ fbuf.hline(0, 9, 96, 0xffff)
+
+Constructors
+------------
+
+.. class:: FrameBuffer(buffer, width, height, format, stride=width, /)
+
+ Construct a FrameBuffer object. The parameters are:
+
+ - *buffer* is an object with a buffer protocol which must be large
+ enough to contain every pixel defined by the width, height and
+ format of the FrameBuffer.
+ - *width* is the width of the FrameBuffer in pixels
+ - *height* is the height of the FrameBuffer in pixels
+ - *format* specifies the type of pixel used in the FrameBuffer;
+ permissible values are listed under Constants below. These set the
+ number of bits used to encode a color value and the layout of these
+ bits in *buffer*.
+ Where a color value c is passed to a method, c is a small integer
+ with an encoding that is dependent on the format of the FrameBuffer.
+ - *stride* is the number of pixels between each horizontal line
+ of pixels in the FrameBuffer. This defaults to *width* but may
+ need adjustments when implementing a FrameBuffer within another
+ larger FrameBuffer or screen. The *buffer* size must accommodate
+ an increased step size.
+
+ One must specify valid *buffer*, *width*, *height*, *format* and
+ optionally *stride*. Invalid *buffer* size or dimensions may lead to
+ unexpected errors.
+
+Drawing primitive shapes
+------------------------
+
+The following methods draw shapes onto the FrameBuffer.
+
+.. method:: FrameBuffer.fill(c)
+
+ Fill the entire FrameBuffer with the specified color.
+
+.. method:: FrameBuffer.pixel(x, y[, c])
+
+ If *c* is not given, get the color value of the specified pixel.
+ If *c* is given, set the specified pixel to the given color.
+
+.. method:: FrameBuffer.hline(x, y, w, c)
+.. method:: FrameBuffer.vline(x, y, h, c)
+.. method:: FrameBuffer.line(x1, y1, x2, y2, c)
+
+ Draw a line from a set of coordinates using the given color and
+ a thickness of 1 pixel. The `line` method draws the line up to
+ a second set of coordinates whereas the `hline` and `vline`
+ methods draw horizontal and vertical lines respectively up to
+ a given length.
+
+.. method:: FrameBuffer.rect(x, y, w, h, c)
+.. method:: FrameBuffer.fill_rect(x, y, w, h, c)
+
+ Draw a rectangle at the given location, size and color. The `rect`
+ method draws only a 1 pixel outline whereas the `fill_rect` method
+ draws both the outline and interior.
+
+Drawing text
+------------
+
+.. method:: FrameBuffer.text(s, x, y[, c])
+
+ Write text to the FrameBuffer using the the coordinates as the upper-left
+ corner of the text. The color of the text can be defined by the optional
+ argument but is otherwise a default value of 1. All characters have
+ dimensions of 8x8 pixels and there is currently no way to change the font.
+
+
+Other methods
+-------------
+
+.. method:: FrameBuffer.scroll(xstep, ystep)
+
+ Shift the contents of the FrameBuffer by the given vector. This may
+ leave a footprint of the previous colors in the FrameBuffer.
+
+.. method:: FrameBuffer.blit(fbuf, x, y, key=-1, palette=None)
+
+ Draw another FrameBuffer on top of the current one at the given coordinates.
+ If *key* is specified then it should be a color integer and the
+ corresponding color will be considered transparent: all pixels with that
+ color value will not be drawn.
+
+ The *palette* argument enables blitting between FrameBuffers with differing
+ formats. Typical usage is to render a monochrome or grayscale glyph/icon to
+ a color display. The *palette* is a FrameBuffer instance whose format is
+ that of the current FrameBuffer. The *palette* height is one pixel and its
+ pixel width is the number of colors in the source FrameBuffer. The *palette*
+ for an N-bit source needs 2**N pixels; the *palette* for a monochrome source
+ would have 2 pixels representing background and foreground colors. The
+ application assigns a color to each pixel in the *palette*. The color of the
+ current pixel will be that of that *palette* pixel whose x position is the
+ color of the corresponding source pixel.
+
+Constants
+---------
+
+.. data:: framebuf.MONO_VLSB
+
+ Monochrome (1-bit) color format
+ This defines a mapping where the bits in a byte are vertically mapped with
+ bit 0 being nearest the top of the screen. Consequently each byte occupies
+ 8 vertical pixels. Subsequent bytes appear at successive horizontal
+ locations until the rightmost edge is reached. Further bytes are rendered
+ at locations starting at the leftmost edge, 8 pixels lower.
+
+.. data:: framebuf.MONO_HLSB
+
+ Monochrome (1-bit) color format
+ This defines a mapping where the bits in a byte are horizontally mapped.
+ Each byte occupies 8 horizontal pixels with bit 7 being the leftmost.
+ Subsequent bytes appear at successive horizontal locations until the
+ rightmost edge is reached. Further bytes are rendered on the next row, one
+ pixel lower.
+
+.. data:: framebuf.MONO_HMSB
+
+ Monochrome (1-bit) color format
+ This defines a mapping where the bits in a byte are horizontally mapped.
+ Each byte occupies 8 horizontal pixels with bit 0 being the leftmost.
+ Subsequent bytes appear at successive horizontal locations until the
+ rightmost edge is reached. Further bytes are rendered on the next row, one
+ pixel lower.
+
+.. data:: framebuf.RGB565
+
+ Red Green Blue (16-bit, 5+6+5) color format
+
+.. data:: framebuf.GS2_HMSB
+
+ Grayscale (2-bit) color format
+
+.. data:: framebuf.GS4_HMSB
+
+ Grayscale (4-bit) color format
+
+.. data:: framebuf.GS8
+
+ Grayscale (8-bit) color format
diff --git a/components/language/micropython/docs/library/gc.rst b/components/language/micropython/docs/library/gc.rst
new file mode 100644
index 00000000..c823aed3
--- /dev/null
+++ b/components/language/micropython/docs/library/gc.rst
@@ -0,0 +1,66 @@
+:mod:`gc` -- control the garbage collector
+==========================================
+
+.. module:: gc
+ :synopsis: control the garbage collector
+
+|see_cpython_module| :mod:`python:gc`.
+
+Functions
+---------
+
+.. function:: enable()
+
+ Enable automatic garbage collection.
+
+.. function:: disable()
+
+ Disable automatic garbage collection. Heap memory can still be allocated,
+ and garbage collection can still be initiated manually using :meth:`gc.collect`.
+
+.. function:: collect()
+
+ Run a garbage collection.
+
+.. function:: mem_alloc()
+
+ Return the number of bytes of heap RAM that are allocated.
+
+ .. admonition:: Difference to CPython
+ :class: attention
+
+ This function is MicroPython extension.
+
+.. function:: mem_free()
+
+ Return the number of bytes of available heap RAM, or -1 if this amount
+ is not known.
+
+ .. admonition:: Difference to CPython
+ :class: attention
+
+ This function is MicroPython extension.
+
+.. function:: threshold([amount])
+
+ Set or query the additional GC allocation threshold. Normally, a collection
+ is triggered only when a new allocation cannot be satisfied, i.e. on an
+ out-of-memory (OOM) condition. If this function is called, in addition to
+ OOM, a collection will be triggered each time after *amount* bytes have been
+ allocated (in total, since the previous time such an amount of bytes
+ have been allocated). *amount* is usually specified as less than the
+ full heap size, with the intention to trigger a collection earlier than when the
+ heap becomes exhausted, and in the hope that an early collection will prevent
+ excessive memory fragmentation. This is a heuristic measure, the effect
+ of which will vary from application to application, as well as
+ the optimal value of the *amount* parameter.
+
+ Calling the function without argument will return the current value of
+ the threshold. A value of -1 means a disabled allocation threshold.
+
+ .. admonition:: Difference to CPython
+ :class: attention
+
+ This function is a MicroPython extension. CPython has a similar
+ function - ``set_threshold()``, but due to different GC
+ implementations, its signature and semantics are different.
diff --git a/components/language/micropython/docs/library/hashlib.rst b/components/language/micropython/docs/library/hashlib.rst
new file mode 100644
index 00000000..e5d8dd88
--- /dev/null
+++ b/components/language/micropython/docs/library/hashlib.rst
@@ -0,0 +1,57 @@
+:mod:`hashlib` -- hashing algorithms
+====================================
+
+.. module:: hashlib
+ :synopsis: hashing algorithms
+
+|see_cpython_module| :mod:`python:hashlib`.
+
+This module implements binary data hashing algorithms. The exact inventory
+of available algorithms depends on a board. Among the algorithms which may
+be implemented:
+
+* SHA256 - The current generation, modern hashing algorithm (of SHA2 series).
+ It is suitable for cryptographically-secure purposes. Included in the
+ MicroPython core and any board is recommended to provide this, unless
+ it has particular code size constraints.
+
+* SHA1 - A previous generation algorithm. Not recommended for new usages,
+ but SHA1 is a part of number of Internet standards and existing
+ applications, so boards targeting network connectivity and
+ interoperability will try to provide this.
+
+* MD5 - A legacy algorithm, not considered cryptographically secure. Only
+ selected boards, targeting interoperability with legacy applications,
+ will offer this.
+
+Constructors
+------------
+
+.. class:: hashlib.sha256([data])
+
+ Create an SHA256 hasher object and optionally feed ``data`` into it.
+
+.. class:: hashlib.sha1([data])
+
+ Create an SHA1 hasher object and optionally feed ``data`` into it.
+
+.. class:: hashlib.md5([data])
+
+ Create an MD5 hasher object and optionally feed ``data`` into it.
+
+Methods
+-------
+
+.. method:: hash.update(data)
+
+ Feed more binary data into hash.
+
+.. method:: hash.digest()
+
+ Return hash for all data passed through hash, as a bytes object. After this
+ method is called, more data cannot be fed into the hash any longer.
+
+.. method:: hash.hexdigest()
+
+ This method is NOT implemented. Use ``binascii.hexlify(hash.digest())``
+ to achieve a similar effect.
diff --git a/components/language/micropython/docs/library/heapq.rst b/components/language/micropython/docs/library/heapq.rst
new file mode 100644
index 00000000..673871c5
--- /dev/null
+++ b/components/language/micropython/docs/library/heapq.rst
@@ -0,0 +1,31 @@
+:mod:`heapq` -- heap queue algorithm
+====================================
+
+.. module:: heapq
+ :synopsis: heap queue algorithm
+
+|see_cpython_module| :mod:`python:heapq`.
+
+This module implements the
+`min heap queue algorithm `_.
+
+A heap queue is essentially a list that has its elements stored in such a way
+that the first item of the list is always the smallest.
+
+Functions
+---------
+
+.. function:: heappush(heap, item)
+
+ Push the ``item`` onto the ``heap``.
+
+.. function:: heappop(heap)
+
+ Pop the first item from the ``heap``, and return it. Raise ``IndexError`` if
+ ``heap`` is empty.
+
+ The returned item will be the smallest item in the ``heap``.
+
+.. function:: heapify(x)
+
+ Convert the list ``x`` into a heap. This is an in-place operation.
diff --git a/components/language/micropython/docs/library/index.rst b/components/language/micropython/docs/library/index.rst
new file mode 100644
index 00000000..ffd373a4
--- /dev/null
+++ b/components/language/micropython/docs/library/index.rst
@@ -0,0 +1,198 @@
+.. _micropython_lib:
+
+MicroPython libraries
+=====================
+
+.. warning::
+
+ Important summary of this section
+
+ * MicroPython provides built-in modules that mirror the functionality of the
+ Python standard library (e.g. :mod:`os`, :mod:`time`), as well as
+ MicroPython-specific modules (e.g. :mod:`bluetooth`, :mod:`machine`).
+ * Most standard library modules implement a subset of the functionality of
+ the equivalent Python module, and in a few cases provide some
+ MicroPython-specific extensions (e.g. :mod:`array`, :mod:`os`)
+ * Due to resource constraints or other limitations, some ports or firmware
+ versions may not include all the functionality documented here.
+ * To allow for extensibility, the built-in modules can be extended from
+ Python code loaded onto the device.
+
+This chapter describes modules (function and class libraries) which are built
+into MicroPython. This documentation in general aspires to describe all modules
+and functions/classes which are implemented in the MicroPython project.
+However, MicroPython is highly configurable, and each port to a particular
+board/embedded system may include only a subset of the available MicroPython
+libraries.
+
+With that in mind, please be warned that some functions/classes in a module (or
+even the entire module) described in this documentation **may be unavailable**
+in a particular build of MicroPython on a particular system. The best place to
+find general information of the availability/non-availability of a particular
+feature is the "General Information" section which contains information
+pertaining to a specific :term:`MicroPython port`.
+
+On some ports you are able to discover the available, built-in libraries that
+can be imported by entering the following at the :term:`REPL`::
+
+ help('modules')
+
+Beyond the built-in libraries described in this documentation, many more
+modules from the Python standard library, as well as further MicroPython
+extensions to it, can be found in :term:`micropython-lib`.
+
+Python standard libraries and micro-libraries
+---------------------------------------------
+
+The following standard Python libraries have been "micro-ified" to fit in with
+the philosophy of MicroPython. They provide the core functionality of that
+module and are intended to be a drop-in replacement for the standard Python
+library.
+
+.. toctree::
+ :maxdepth: 1
+
+ array.rst
+ binascii.rst
+ builtins.rst
+ cmath.rst
+ collections.rst
+ errno.rst
+ gc.rst
+ hashlib.rst
+ heapq.rst
+ io.rst
+ json.rst
+ math.rst
+ os.rst
+ random.rst
+ re.rst
+ select.rst
+ socket.rst
+ ssl.rst
+ struct.rst
+ sys.rst
+ time.rst
+ uasyncio.rst
+ zlib.rst
+ _thread.rst
+
+
+MicroPython-specific libraries
+------------------------------
+
+Functionality specific to the MicroPython implementation is available in
+the following libraries.
+
+.. toctree::
+ :maxdepth: 1
+
+ bluetooth.rst
+ btree.rst
+ cryptolib.rst
+ framebuf.rst
+ machine.rst
+ micropython.rst
+ neopixel.rst
+ network.rst
+ uctypes.rst
+
+The following libraries provide drivers for hardware components.
+
+.. toctree::
+ :maxdepth: 1
+
+ wm8960.rst
+
+
+Port-specific libraries
+-----------------------
+
+In some cases the following port/board-specific libraries have functions or
+classes similar to those in the :mod:`machine` library. Where this occurs, the
+entry in the port specific library exposes hardware functionality unique to
+that platform.
+
+To write portable code use functions and classes from the :mod:`machine` module.
+To access platform-specific hardware use the appropriate library, e.g.
+:mod:`pyb` in the case of the Pyboard.
+
+
+Libraries specific to the pyboard
+~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+
+The following libraries are specific to the pyboard.
+
+.. toctree::
+ :maxdepth: 2
+
+ pyb.rst
+ stm.rst
+ lcd160cr.rst
+
+
+Libraries specific to the WiPy
+~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+
+The following libraries and classes are specific to the WiPy.
+
+.. toctree::
+ :maxdepth: 2
+
+ wipy.rst
+ machine.ADCWiPy.rst
+ machine.TimerWiPy.rst
+
+
+Libraries specific to the ESP8266 and ESP32
+~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+
+The following libraries are specific to the ESP8266 and ESP32.
+
+.. toctree::
+ :maxdepth: 2
+
+ esp.rst
+ esp32.rst
+
+
+Libraries specific to the RP2040
+~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+
+The following libraries are specific to the RP2040, as used in the Raspberry Pi Pico.
+
+.. toctree::
+ :maxdepth: 2
+
+ rp2.rst
+
+Libraries specific to Zephyr
+~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+
+The following libraries are specific to the Zephyr port.
+
+.. toctree::
+ :maxdepth: 2
+
+ zephyr.rst
+
+Extending built-in libraries from Python
+----------------------------------------
+
+In most cases, the above modules are actually named ``umodule`` rather than
+``module``, but MicroPython will alias any module prefixed with a ``u`` to the
+non-``u`` version. However a file (or :term:`frozen module`) named
+``module.py`` will take precedence over this alias.
+
+This allows the user to provide an extended implementation of a built-in library
+(perhaps to provide additional CPython compatibility). The user-provided module
+(in ``module.py``) can still use the built-in functionality by importing
+``umodule`` directly. This is used extensively in :term:`micropython-lib`. See
+:ref:`packages` for more information.
+
+This applies to both the Python standard libraries (e.g. ``os``, ``time``, etc),
+but also the MicroPython libraries too (e.g. ``machine``, ``bluetooth``, etc).
+The main exception is the port-specific libraries (``pyb``, ``esp``, etc).
+
+*Other than when you specifically want to force the use of the built-in module,
+we recommend always using ``import module`` rather than ``import umodule``.*
diff --git a/components/language/micropython/docs/library/io.rst b/components/language/micropython/docs/library/io.rst
new file mode 100644
index 00000000..6b4b9f1a
--- /dev/null
+++ b/components/language/micropython/docs/library/io.rst
@@ -0,0 +1,131 @@
+:mod:`io` -- input/output streams
+=================================
+
+.. module:: io
+ :synopsis: input/output streams
+
+|see_cpython_module| :mod:`python:io`.
+
+This module contains additional types of `stream` (file-like) objects
+and helper functions.
+
+Conceptual hierarchy
+--------------------
+
+.. admonition:: Difference to CPython
+ :class: attention
+
+ Conceptual hierarchy of stream base classes is simplified in MicroPython,
+ as described in this section.
+
+(Abstract) base stream classes, which serve as a foundation for behaviour
+of all the concrete classes, adhere to few dichotomies (pair-wise
+classifications) in CPython. In MicroPython, they are somewhat simplified
+and made implicit to achieve higher efficiencies and save resources.
+
+An important dichotomy in CPython is unbuffered vs buffered streams. In
+MicroPython, all streams are currently unbuffered. This is because all
+modern OSes, and even many RTOSes and filesystem drivers already perform
+buffering on their side. Adding another layer of buffering is counter-
+productive (an issue known as "bufferbloat") and takes precious memory.
+Note that there still cases where buffering may be useful, so we may
+introduce optional buffering support at a later time.
+
+But in CPython, another important dichotomy is tied with "bufferedness" -
+it's whether a stream may incur short read/writes or not. A short read
+is when a user asks e.g. 10 bytes from a stream, but gets less, similarly
+for writes. In CPython, unbuffered streams are automatically short
+operation susceptible, while buffered are guarantee against them. The
+no short read/writes is an important trait, as it allows to develop
+more concise and efficient programs - something which is highly desirable
+for MicroPython. So, while MicroPython doesn't support buffered streams,
+it still provides for no-short-operations streams. Whether there will
+be short operations or not depends on each particular class' needs, but
+developers are strongly advised to favour no-short-operations behaviour
+for the reasons stated above. For example, MicroPython sockets are
+guaranteed to avoid short read/writes. Actually, at this time, there is
+no example of a short-operations stream class in the core, and one would
+be a port-specific class, where such a need is governed by hardware
+peculiarities.
+
+The no-short-operations behaviour gets tricky in case of non-blocking
+streams, blocking vs non-blocking behaviour being another CPython dichotomy,
+fully supported by MicroPython. Non-blocking streams never wait for
+data either to arrive or be written - they read/write whatever possible,
+or signal lack of data (or ability to write data). Clearly, this conflicts
+with "no-short-operations" policy, and indeed, a case of non-blocking
+buffered (and this no-short-ops) streams is convoluted in CPython - in
+some places, such combination is prohibited, in some it's undefined or
+just not documented, in some cases it raises verbose exceptions. The
+matter is much simpler in MicroPython: non-blocking stream are important
+for efficient asynchronous operations, so this property prevails on
+the "no-short-ops" one. So, while blocking streams will avoid short
+reads/writes whenever possible (the only case to get a short read is
+if end of file is reached, or in case of error (but errors don't
+return short data, but raise exceptions)), non-blocking streams may
+produce short data to avoid blocking the operation.
+
+The final dichotomy is binary vs text streams. MicroPython of course
+supports these, but while in CPython text streams are inherently
+buffered, they aren't in MicroPython. (Indeed, that's one of the cases
+for which we may introduce buffering support.)
+
+Note that for efficiency, MicroPython doesn't provide abstract base
+classes corresponding to the hierarchy above, and it's not possible
+to implement, or subclass, a stream class in pure Python.
+
+Functions
+---------
+
+.. function:: open(name, mode='r', **kwargs)
+
+ Open a file. Builtin ``open()`` function is aliased to this function.
+ All ports (which provide access to file system) are required to support
+ *mode* parameter, but support for other arguments vary by port.
+
+Classes
+-------
+
+.. class:: FileIO(...)
+
+ This is type of a file open in binary mode, e.g. using ``open(name, "rb")``.
+ You should not instantiate this class directly.
+
+.. class:: TextIOWrapper(...)
+
+ This is type of a file open in text mode, e.g. using ``open(name, "rt")``.
+ You should not instantiate this class directly.
+
+.. class:: StringIO([string])
+.. class:: BytesIO([string])
+
+ In-memory file-like objects for input/output. `StringIO` is used for
+ text-mode I/O (similar to a normal file opened with "t" modifier).
+ `BytesIO` is used for binary-mode I/O (similar to a normal file
+ opened with "b" modifier). Initial contents of file-like objects
+ can be specified with *string* parameter (should be normal string
+ for `StringIO` or bytes object for `BytesIO`). All the usual file
+ methods like ``read()``, ``write()``, ``seek()``, ``flush()``,
+ ``close()`` are available on these objects, and additionally, a
+ following method:
+
+ .. method:: getvalue()
+
+ Get the current contents of the underlying buffer which holds data.
+
+.. class:: StringIO(alloc_size)
+ :noindex:
+.. class:: BytesIO(alloc_size)
+ :noindex:
+
+ Create an empty `StringIO`/`BytesIO` object, preallocated to hold up
+ to *alloc_size* number of bytes. That means that writing that amount
+ of bytes won't lead to reallocation of the buffer, and thus won't hit
+ out-of-memory situation or lead to memory fragmentation. These constructors
+ are a MicroPython extension and are recommended for usage only in special
+ cases and in system-level libraries, not for end-user applications.
+
+ .. admonition:: Difference to CPython
+ :class: attention
+
+ These constructors are a MicroPython extension.
diff --git a/components/language/micropython/docs/library/json.rst b/components/language/micropython/docs/library/json.rst
new file mode 100644
index 00000000..f1d6364f
--- /dev/null
+++ b/components/language/micropython/docs/library/json.rst
@@ -0,0 +1,41 @@
+:mod:`json` -- JSON encoding and decoding
+=========================================
+
+.. module:: json
+ :synopsis: JSON encoding and decoding
+
+|see_cpython_module| :mod:`python:json`.
+
+This modules allows to convert between Python objects and the JSON
+data format.
+
+Functions
+---------
+
+.. function:: dump(obj, stream, separators=None)
+
+ Serialise *obj* to a JSON string, writing it to the given *stream*.
+
+ If specified, separators should be an ``(item_separator, key_separator)``
+ tuple. The default is ``(', ', ': ')``. To get the most compact JSON
+ representation, you should specify ``(',', ':')`` to eliminate whitespace.
+
+.. function:: dumps(obj, separators=None)
+
+ Return *obj* represented as a JSON string.
+
+ The arguments have the same meaning as in `dump`.
+
+.. function:: load(stream)
+
+ Parse the given *stream*, interpreting it as a JSON string and
+ deserialising the data to a Python object. The resulting object is
+ returned.
+
+ Parsing continues until end-of-file is encountered.
+ A :exc:`ValueError` is raised if the data in *stream* is not correctly formed.
+
+.. function:: loads(str)
+
+ Parse the JSON *str* and return an object. Raises :exc:`ValueError` if the
+ string is not correctly formed.
diff --git a/components/language/micropython/docs/library/lcd160cr.rst b/components/language/micropython/docs/library/lcd160cr.rst
new file mode 100644
index 00000000..25903eb2
--- /dev/null
+++ b/components/language/micropython/docs/library/lcd160cr.rst
@@ -0,0 +1,394 @@
+:mod:`lcd160cr` --- control of LCD160CR display
+===============================================
+
+.. module:: lcd160cr
+ :synopsis: control of LCD160CR display
+
+This module provides control of the MicroPython LCD160CR display.
+
+.. image:: http://micropython.org/resources/LCD160CRv10-persp.jpg
+ :alt: LCD160CRv1.0 picture
+ :width: 640px
+
+Further resources are available via the following links:
+
+* `LCD160CRv1.0 reference manual `_ (100KiB PDF)
+* `LCD160CRv1.0 schematics `_ (1.6MiB PDF)
+
+class LCD160CR
+--------------
+
+The LCD160CR class provides an interface to the display. Create an
+instance of this class and use its methods to draw to the LCD and get
+the status of the touch panel.
+
+For example::
+
+ import lcd160cr
+
+ lcd = lcd160cr.LCD160CR('X')
+ lcd.set_orient(lcd160cr.PORTRAIT)
+ lcd.set_pos(0, 0)
+ lcd.set_text_color(lcd.rgb(255, 0, 0), lcd.rgb(0, 0, 0))
+ lcd.set_font(1)
+ lcd.write('Hello MicroPython!')
+ print('touch:', lcd.get_touch())
+
+Constructors
+------------
+
+.. class:: LCD160CR(connect=None, *, pwr=None, i2c=None, spi=None, i2c_addr=98)
+
+ Construct an LCD160CR object. The parameters are:
+
+ - *connect* is a string specifying the physical connection of the LCD
+ display to the board; valid values are "X", "Y", "XY", "YX".
+ Use "X" when the display is connected to a pyboard in the X-skin
+ position, and "Y" when connected in the Y-skin position. "XY"
+ and "YX" are used when the display is connected to the right or
+ left side of the pyboard, respectively.
+ - *pwr* is a Pin object connected to the LCD's power/enabled pin.
+ - *i2c* is an I2C object connected to the LCD's I2C interface.
+ - *spi* is an SPI object connected to the LCD's SPI interface.
+ - *i2c_addr* is the I2C address of the display.
+
+ One must specify either a valid *connect* or all of *pwr*, *i2c* and *spi*.
+ If a valid *connect* is given then any of *pwr*, *i2c* or *spi* which are
+ not passed as parameters (i.e. they are ``None``) will be created based on the
+ value of *connect*. This allows to override the default interface to the
+ display if needed.
+
+ The default values are:
+
+ - "X" is for the X-skin and uses:
+ ``pwr=Pin("X4")``, ``i2c=I2C("X")``, ``spi=SPI("X")``
+ - "Y" is for the Y-skin and uses:
+ ``pwr=Pin("Y4")``, ``i2c=I2C("Y")``, ``spi=SPI("Y")``
+ - "XY" is for the right-side and uses:
+ ``pwr=Pin("X4")``, ``i2c=I2C("Y")``, ``spi=SPI("X")``
+ - "YX" is for the left-side and uses:
+ ``pwr=Pin("Y4")``, ``i2c=I2C("X")``, ``spi=SPI("Y")``
+
+ See `this image `_
+ for how the display can be connected to the pyboard.
+
+Static methods
+--------------
+
+.. staticmethod:: LCD160CR.rgb(r, g, b)
+
+ Return a 16-bit integer representing the given rgb color values. The
+ 16-bit value can be used to set the font color (see
+ :meth:`LCD160CR.set_text_color`) pen color (see :meth:`LCD160CR.set_pen`)
+ and draw individual pixels.
+
+.. staticmethod:: LCD160CR.clip_line(data, w, h):
+
+ Clip the given line data. This is for internal use.
+
+Instance members
+----------------
+
+The following instance members are publicly accessible.
+
+.. data:: LCD160CR.w
+.. data:: LCD160CR.h
+
+ The width and height of the display, respectively, in pixels. These
+ members are updated when calling :meth:`LCD160CR.set_orient` and should
+ be considered read-only.
+
+Setup commands
+--------------
+
+.. method:: LCD160CR.set_power(on)
+
+ Turn the display on or off, depending on the given value of *on*: 0 or ``False``
+ will turn the display off, and 1 or ``True`` will turn it on.
+
+.. method:: LCD160CR.set_orient(orient)
+
+ Set the orientation of the display. The *orient* parameter can be one
+ of `PORTRAIT`, `LANDSCAPE`, `PORTRAIT_UPSIDEDOWN`, `LANDSCAPE_UPSIDEDOWN`.
+
+.. method:: LCD160CR.set_brightness(value)
+
+ Set the brightness of the display, between 0 and 31.
+
+.. method:: LCD160CR.set_i2c_addr(addr)
+
+ Set the I2C address of the display. The *addr* value must have the
+ lower 2 bits cleared.
+
+.. method:: LCD160CR.set_uart_baudrate(baudrate)
+
+ Set the baudrate of the UART interface.
+
+.. method:: LCD160CR.set_startup_deco(value)
+
+ Set the start-up decoration of the display. The *value* parameter can be a
+ logical or of `STARTUP_DECO_NONE`, `STARTUP_DECO_MLOGO`, `STARTUP_DECO_INFO`.
+
+.. method:: LCD160CR.save_to_flash()
+
+ Save the following parameters to flash so they persist on restart and power up:
+ initial decoration, orientation, brightness, UART baud rate, I2C address.
+
+Pixel access methods
+--------------------
+
+The following methods manipulate individual pixels on the display.
+
+.. method:: LCD160CR.set_pixel(x, y, c)
+
+ Set the specified pixel to the given color. The color should be a 16-bit
+ integer and can be created by :meth:`LCD160CR.rgb`.
+
+.. method:: LCD160CR.get_pixel(x, y)
+
+ Get the 16-bit value of the specified pixel.
+
+.. method:: LCD160CR.get_line(x, y, buf)
+
+ Low-level method to get a line of pixels into the given buffer.
+ To read *n* pixels *buf* should be *2*n+1* bytes in length. The first byte
+ is a dummy byte and should be ignored, and subsequent bytes represent the
+ pixels in the line starting at coordinate *(x, y)*.
+
+.. method:: LCD160CR.screen_dump(buf, x=0, y=0, w=None, h=None)
+
+ Dump the contents of the screen to the given buffer. The parameters *x* and *y*
+ specify the starting coordinate, and *w* and *h* the size of the region. If *w*
+ or *h* are ``None`` then they will take on their maximum values, set by the size
+ of the screen minus the given *x* and *y* values. *buf* should be large enough
+ to hold ``2*w*h`` bytes. If it's smaller then only the initial horizontal lines
+ will be stored.
+
+.. method:: LCD160CR.screen_load(buf)
+
+ Load the entire screen from the given buffer.
+
+Drawing text
+------------
+
+To draw text one sets the position, color and font, and then uses
+`LCD160CR.write` to draw the text.
+
+.. method:: LCD160CR.set_pos(x, y)
+
+ Set the position for text output using :meth:`LCD160CR.write`. The position
+ is the upper-left corner of the text.
+
+.. method:: LCD160CR.set_text_color(fg, bg)
+
+ Set the foreground and background color of the text.
+
+.. method:: LCD160CR.set_font(font, scale=0, bold=0, trans=0, scroll=0)
+
+ Set the font for the text. Subsequent calls to `write` will use the newly
+ configured font. The parameters are:
+
+ - *font* is the font family to use, valid values are 0, 1, 2, 3.
+ - *scale* is a scaling value for each character pixel, where the pixels
+ are drawn as a square with side length equal to *scale + 1*. The value
+ can be between 0 and 63.
+ - *bold* controls the number of pixels to overdraw each character pixel,
+ making a bold effect. The lower 2 bits of *bold* are the number of
+ pixels to overdraw in the horizontal direction, and the next 2 bits are
+ for the vertical direction. For example, a *bold* value of 5 will
+ overdraw 1 pixel in both the horizontal and vertical directions.
+ - *trans* can be either 0 or 1 and if set to 1 the characters will be
+ drawn with a transparent background.
+ - *scroll* can be either 0 or 1 and if set to 1 the display will do a
+ soft scroll if the text moves to the next line.
+
+.. method:: LCD160CR.write(s)
+
+ Write text to the display, using the current position, color and font.
+ As text is written the position is automatically incremented. The
+ display supports basic VT100 control codes such as newline and backspace.
+
+Drawing primitive shapes
+------------------------
+
+Primitive drawing commands use a foreground and background color set by the
+`set_pen` method.
+
+.. method:: LCD160CR.set_pen(line, fill)
+
+ Set the line and fill color for primitive shapes.
+
+.. method:: LCD160CR.erase()
+
+ Erase the entire display to the pen fill color.
+
+.. method:: LCD160CR.dot(x, y)
+
+ Draw a single pixel at the given location using the pen line color.
+
+.. method:: LCD160CR.rect(x, y, w, h)
+.. method:: LCD160CR.rect_outline(x, y, w, h)
+.. method:: LCD160CR.rect_interior(x, y, w, h)
+
+ Draw a rectangle at the given location and size using the pen line
+ color for the outline, and the pen fill color for the interior.
+ The `rect` method draws the outline and interior, while the other methods
+ just draw one or the other.
+
+.. method:: LCD160CR.line(x1, y1, x2, y2)
+
+ Draw a line between the given coordinates using the pen line color.
+
+.. method:: LCD160CR.dot_no_clip(x, y)
+.. method:: LCD160CR.rect_no_clip(x, y, w, h)
+.. method:: LCD160CR.rect_outline_no_clip(x, y, w, h)
+.. method:: LCD160CR.rect_interior_no_clip(x, y, w, h)
+.. method:: LCD160CR.line_no_clip(x1, y1, x2, y2)
+
+ These methods are as above but don't do any clipping on the input
+ coordinates. They are faster than the clipping versions and can be
+ used when you know that the coordinates are within the display.
+
+.. method:: LCD160CR.poly_dot(data)
+
+ Draw a sequence of dots using the pen line color.
+ The *data* should be a buffer of bytes, with each successive pair of
+ bytes corresponding to coordinate pairs (x, y).
+
+.. method:: LCD160CR.poly_line(data)
+
+ Similar to :meth:`LCD160CR.poly_dot` but draws lines between the dots.
+
+Touch screen methods
+--------------------
+
+.. method:: LCD160CR.touch_config(calib=False, save=False, irq=None)
+
+ Configure the touch panel:
+
+ - If *calib* is ``True`` then the call will trigger a touch calibration of
+ the resistive touch sensor. This requires the user to touch various
+ parts of the screen.
+ - If *save* is ``True`` then the touch parameters will be saved to NVRAM
+ to persist across reset/power up.
+ - If *irq* is ``True`` then the display will be configured to pull the IRQ
+ line low when a touch force is detected. If *irq* is ``False`` then this
+ feature is disabled. If *irq* is ``None`` (the default value) then no
+ change is made to this setting.
+
+.. method:: LCD160CR.is_touched()
+
+ Returns a boolean: ``True`` if there is currently a touch force on the screen,
+ ``False`` otherwise.
+
+.. method:: LCD160CR.get_touch()
+
+ Returns a 3-tuple of: *(active, x, y)*. If there is currently a touch force
+ on the screen then *active* is 1, otherwise it is 0. The *x* and *y* values
+ indicate the position of the current or most recent touch.
+
+Advanced commands
+-----------------
+
+.. method:: LCD160CR.set_spi_win(x, y, w, h)
+
+ Set the window that SPI data is written to.
+
+.. method:: LCD160CR.fast_spi(flush=True)
+
+ Ready the display to accept RGB pixel data on the SPI bus, resetting the location
+ of the first byte to go to the top-left corner of the window set by
+ :meth:`LCD160CR.set_spi_win`.
+ The method returns an SPI object which can be used to write the pixel data.
+
+ Pixels should be sent as 16-bit RGB values in the 5-6-5 format. The destination
+ counter will increase as data is sent, and data can be sent in arbitrary sized
+ chunks. Once the destination counter reaches the end of the window specified by
+ :meth:`LCD160CR.set_spi_win` it will wrap around to the top-left corner of that window.
+
+.. method:: LCD160CR.show_framebuf(buf)
+
+ Show the given buffer on the display. *buf* should be an array of bytes containing
+ the 16-bit RGB values for the pixels, and they will be written to the area
+ specified by :meth:`LCD160CR.set_spi_win`, starting from the top-left corner.
+
+ The `framebuf `_ module can be used to construct frame buffers
+ and provides drawing primitives. Using a frame buffer will improve
+ performance of animations when compared to drawing directly to the screen.
+
+.. method:: LCD160CR.set_scroll(on)
+
+ Turn scrolling on or off. This controls globally whether any window regions will
+ scroll.
+
+.. method:: LCD160CR.set_scroll_win(win, x=-1, y=0, w=0, h=0, vec=0, pat=0, fill=0x07e0, color=0)
+
+ Configure a window region for scrolling:
+
+ - *win* is the window id to configure. There are 0..7 standard windows for
+ general purpose use. Window 8 is the text scroll window (the ticker).
+ - *x*, *y*, *w*, *h* specify the location of the window in the display.
+ - *vec* specifies the direction and speed of scroll: it is a 16-bit value
+ of the form ``0bF.ddSSSSSSSSSSSS``. *dd* is 0, 1, 2, 3 for +x, +y, -x,
+ -y scrolling. *F* sets the speed format, with 0 meaning that the window
+ is shifted *S % 256* pixel every frame, and 1 meaning that the window
+ is shifted 1 pixel every *S* frames.
+ - *pat* is a 16-bit pattern mask for the background.
+ - *fill* is the fill color.
+ - *color* is the extra color, either of the text or pattern foreground.
+
+.. method:: LCD160CR.set_scroll_win_param(win, param, value)
+
+ Set a single parameter of a scrolling window region:
+
+ - *win* is the window id, 0..8.
+ - *param* is the parameter number to configure, 0..7, and corresponds
+ to the parameters in the `set_scroll_win` method.
+ - *value* is the value to set.
+
+.. method:: LCD160CR.set_scroll_buf(s)
+
+ Set the string for scrolling in window 8. The parameter *s* must be a string
+ with length 32 or less.
+
+.. method:: LCD160CR.jpeg(buf)
+
+ Display a JPEG. *buf* should contain the entire JPEG data. JPEG data should
+ not include EXIF information. The following encodings are supported: Baseline
+ DCT, Huffman coding, 8 bits per sample, 3 color components, YCbCr4:2:2.
+ The origin of the JPEG is set by :meth:`LCD160CR.set_pos`.
+
+.. method:: LCD160CR.jpeg_start(total_len)
+.. method:: LCD160CR.jpeg_data(buf)
+
+ Display a JPEG with the data split across multiple buffers. There must be
+ a single call to `jpeg_start` to begin with, specifying the total number of
+ bytes in the JPEG. Then this number of bytes must be transferred to the
+ display using one or more calls to the `jpeg_data` command.
+
+.. method:: LCD160CR.feed_wdt()
+
+ The first call to this method will start the display's internal watchdog
+ timer. Subsequent calls will feed the watchdog. The timeout is roughly 30
+ seconds.
+
+.. method:: LCD160CR.reset()
+
+ Reset the display.
+
+Constants
+---------
+
+.. data:: lcd160cr.PORTRAIT
+ lcd160cr.LANDSCAPE
+ lcd160cr.PORTRAIT_UPSIDEDOWN
+ lcd160cr.LANDSCAPE_UPSIDEDOWN
+
+ Orientations of the display, used by :meth:`LCD160CR.set_orient`.
+
+.. data:: lcd160cr.STARTUP_DECO_NONE
+ lcd160cr.STARTUP_DECO_MLOGO
+ lcd160cr.STARTUP_DECO_INFO
+
+ Types of start-up decoration, can be OR'ed together, used by
+ :meth:`LCD160CR.set_startup_deco`.
diff --git a/components/language/micropython/docs/library/machine.ADC.rst b/components/language/micropython/docs/library/machine.ADC.rst
new file mode 100644
index 00000000..eb538a44
--- /dev/null
+++ b/components/language/micropython/docs/library/machine.ADC.rst
@@ -0,0 +1,66 @@
+.. currentmodule:: machine
+.. _machine.ADC:
+
+class ADC -- analog to digital conversion
+=========================================
+
+The ADC class provides an interface to analog-to-digital convertors, and
+represents a single endpoint that can sample a continuous voltage and
+convert it to a discretised value.
+
+For extra control over ADC sampling see :ref:`machine.ADCBlock `.
+
+Example usage::
+
+ from machine import ADC
+
+ adc = ADC(pin) # create an ADC object acting on a pin
+ val = adc.read_u16() # read a raw analog value in the range 0-65535
+ val = adc.read_uv() # read an analog value in microvolts
+
+Constructors
+------------
+
+.. class:: ADC(id, *, sample_ns, atten)
+
+ Access the ADC associated with a source identified by *id*. This
+ *id* may be an integer (usually specifying a channel number), a
+ :ref:`Pin ` object, or other value supported by the
+ underlying machine.
+
+ If additional keyword-arguments are given then they will configure
+ various aspects of the ADC. If not given, these settings will take
+ previous or default values. The settings are:
+
+ - *sample_ns* is the sampling time in nanoseconds.
+
+ - *atten* specifies the input attenuation.
+
+Methods
+-------
+
+.. method:: ADC.init(*, sample_ns, atten)
+
+ Apply the given settings to the ADC. Only those arguments that are
+ specified will be changed. See the ADC constructor above for what the
+ arguments are.
+
+.. method:: ADC.block()
+
+ Return the :ref:`ADCBlock ` instance associated with
+ this ADC object.
+
+ This method only exists if the port supports the
+ :ref:`ADCBlock ` class.
+
+.. method:: ADC.read_u16()
+
+ Take an analog reading and return an integer in the range 0-65535.
+ The return value represents the raw reading taken by the ADC, scaled
+ such that the minimum value is 0 and the maximum value is 65535.
+
+.. method:: ADC.read_uv()
+
+ Take an analog reading and return an integer value with units of
+ microvolts. It is up to the particular port whether or not this value
+ is calibrated, and how calibration is done.
diff --git a/components/language/micropython/docs/library/machine.ADCBlock.rst b/components/language/micropython/docs/library/machine.ADCBlock.rst
new file mode 100644
index 00000000..56a468dd
--- /dev/null
+++ b/components/language/micropython/docs/library/machine.ADCBlock.rst
@@ -0,0 +1,58 @@
+.. currentmodule:: machine
+.. _machine.ADCBlock:
+
+class ADCBlock -- control ADC peripherals
+=========================================
+
+The ADCBlock class provides access to an ADC peripheral which has a
+number of channels that can be used to sample analog values. It allows
+finer control over configuration of :ref:`machine.ADC `
+objects, which do the actual sampling.
+
+This class is not always available.
+
+Example usage::
+
+ from machine import ADCBlock
+
+ block = ADCBlock(id, bits=12) # create an ADCBlock with 12-bit resolution
+ adc = block.connect(4, pin) # connect channel 4 to the given pin
+ val = adc.read_uv() # read an analog value
+
+Constructors
+------------
+
+.. class:: ADCBlock(id, *, bits)
+
+ Access the ADC peripheral identified by *id*, which may be an integer
+ or string.
+
+ The *bits* argument, if given, sets the resolution in bits of the
+ conversion process. If not specified then the previous or default
+ resolution is used.
+
+Methods
+-------
+
+.. method:: ADCBlock.init(*, bits)
+
+ Configure the ADC peripheral. *bits* will set the resolution of the
+ conversion process.
+
+.. method:: ADCBlock.connect(channel)
+ ADCBlock.connect(source)
+ ADCBlock.connect(channel, source)
+
+ Connect up a channel on the ADC peripheral so it is ready for sampling,
+ and return an :ref:`ADC ` object that represents that connection.
+
+ The *channel* argument must be an integer, and *source* must be an object
+ (for example a :ref:`Pin `) which can be connected up for sampling.
+
+ If only *channel* is given then it is configured for sampling.
+
+ If only *source* is given then that object is connected to a default
+ channel ready for sampling.
+
+ If both *channel* and *source* are given then they are connected together
+ and made ready for sampling.
diff --git a/components/language/micropython/docs/library/machine.ADCWiPy.rst b/components/language/micropython/docs/library/machine.ADCWiPy.rst
new file mode 100644
index 00000000..d4ccde20
--- /dev/null
+++ b/components/language/micropython/docs/library/machine.ADCWiPy.rst
@@ -0,0 +1,81 @@
+.. currentmodule:: machine
+.. _machine.ADCWiPy:
+
+class ADCWiPy -- analog to digital conversion
+=============================================
+
+.. note::
+
+ This class is a non-standard ADC implementation for the WiPy.
+ It is available simply as ``machine.ADC`` on the WiPy but is named in the
+ documentation below as ``machine.ADCWiPy`` to distinguish it from the
+ more general :ref:`machine.ADC ` class.
+
+Usage::
+
+ import machine
+
+ adc = machine.ADC() # create an ADC object
+ apin = adc.channel(pin='GP3') # create an analog pin on GP3
+ val = apin() # read an analog value
+
+Constructors
+------------
+
+.. class:: ADCWiPy(id=0, *, bits=12)
+
+ Create an ADC object associated with the given pin.
+ This allows you to then read analog values on that pin.
+ For more info check the `pinout and alternate functions
+ table. `_
+
+ .. warning::
+
+ ADC pin input range is 0-1.4V (being 1.8V the absolute maximum that it
+ can withstand). When GP2, GP3, GP4 or GP5 are remapped to the
+ ADC block, 1.8 V is the maximum. If these pins are used in digital mode,
+ then the maximum allowed input is 3.6V.
+
+Methods
+-------
+
+.. method:: ADCWiPy.channel(id, *, pin)
+
+ Create an analog pin. If only channel ID is given, the correct pin will
+ be selected. Alternatively, only the pin can be passed and the correct
+ channel will be selected. Examples::
+
+ # all of these are equivalent and enable ADC channel 1 on GP3
+ apin = adc.channel(1)
+ apin = adc.channel(pin='GP3')
+ apin = adc.channel(id=1, pin='GP3')
+
+.. method:: ADCWiPy.init()
+
+ Enable the ADC block.
+
+.. method:: ADCWiPy.deinit()
+
+ Disable the ADC block.
+
+class ADCChannel --- read analog values from internal or external sources
+=========================================================================
+
+ADC channels can be connected to internal points of the MCU or to GPIO pins.
+ADC channels are created using the ADC.channel method.
+
+.. method:: adcchannel()
+
+ Fast method to read the channel value.
+
+.. method:: adcchannel.value()
+
+ Read the channel value.
+
+.. method:: adcchannel.init()
+
+ Re-init (and effectively enable) the ADC channel.
+
+.. method:: adcchannel.deinit()
+
+ Disable the ADC channel.
diff --git a/components/language/micropython/docs/library/machine.I2C.rst b/components/language/micropython/docs/library/machine.I2C.rst
new file mode 100644
index 00000000..82a88390
--- /dev/null
+++ b/components/language/micropython/docs/library/machine.I2C.rst
@@ -0,0 +1,200 @@
+.. currentmodule:: machine
+.. _machine.I2C:
+
+class I2C -- a two-wire serial protocol
+=======================================
+
+I2C is a two-wire protocol for communicating between devices. At the physical
+level it consists of 2 wires: SCL and SDA, the clock and data lines respectively.
+
+I2C objects are created attached to a specific bus. They can be initialised
+when created, or initialised later on.
+
+Printing the I2C object gives you information about its configuration.
+
+Both hardware and software I2C implementations exist via the
+:ref:`machine.I2C ` and `machine.SoftI2C` classes. Hardware I2C uses
+underlying hardware support of the system to perform the reads/writes and is
+usually efficient and fast but may have restrictions on which pins can be used.
+Software I2C is implemented by bit-banging and can be used on any pin but is not
+as efficient. These classes have the same methods available and differ primarily
+in the way they are constructed.
+
+Example usage::
+
+ from machine import I2C
+
+ i2c = I2C(freq=400000) # create I2C peripheral at frequency of 400kHz
+ # depending on the port, extra parameters may be required
+ # to select the peripheral and/or pins to use
+
+ i2c.scan() # scan for peripherals, returning a list of 7-bit addresses
+
+ i2c.writeto(42, b'123') # write 3 bytes to peripheral with 7-bit address 42
+ i2c.readfrom(42, 4) # read 4 bytes from peripheral with 7-bit address 42
+
+ i2c.readfrom_mem(42, 8, 3) # read 3 bytes from memory of peripheral 42,
+ # starting at memory-address 8 in the peripheral
+ i2c.writeto_mem(42, 2, b'\x10') # write 1 byte to memory of peripheral 42
+ # starting at address 2 in the peripheral
+
+Constructors
+------------
+
+.. class:: I2C(id, *, scl, sda, freq=400000)
+
+ Construct and return a new I2C object using the following parameters:
+
+ - *id* identifies a particular I2C peripheral. Allowed values for
+ depend on the particular port/board
+ - *scl* should be a pin object specifying the pin to use for SCL.
+ - *sda* should be a pin object specifying the pin to use for SDA.
+ - *freq* should be an integer which sets the maximum frequency
+ for SCL.
+
+ Note that some ports/boards will have default values of *scl* and *sda*
+ that can be changed in this constructor. Others will have fixed values
+ of *scl* and *sda* that cannot be changed.
+
+.. _machine.SoftI2C:
+.. class:: SoftI2C(scl, sda, *, freq=400000, timeout=50000)
+
+ Construct a new software I2C object. The parameters are:
+
+ - *scl* should be a pin object specifying the pin to use for SCL.
+ - *sda* should be a pin object specifying the pin to use for SDA.
+ - *freq* should be an integer which sets the maximum frequency
+ for SCL.
+ - *timeout* is the maximum time in microseconds to wait for clock
+ stretching (SCL held low by another device on the bus), after
+ which an ``OSError(ETIMEDOUT)`` exception is raised.
+
+General Methods
+---------------
+
+.. method:: I2C.init(scl, sda, *, freq=400000)
+
+ Initialise the I2C bus with the given arguments:
+
+ - *scl* is a pin object for the SCL line
+ - *sda* is a pin object for the SDA line
+ - *freq* is the SCL clock rate
+
+.. method:: I2C.deinit()
+
+ Turn off the I2C bus.
+
+ Availability: WiPy.
+
+.. method:: I2C.scan()
+
+ Scan all I2C addresses between 0x08 and 0x77 inclusive and return a list of
+ those that respond. A device responds if it pulls the SDA line low after
+ its address (including a write bit) is sent on the bus.
+
+Primitive I2C operations
+------------------------
+
+The following methods implement the primitive I2C controller bus operations and can
+be combined to make any I2C transaction. They are provided if you need more
+control over the bus, otherwise the standard methods (see below) can be used.
+
+These methods are only available on the `machine.SoftI2C` class.
+
+.. method:: I2C.start()
+
+ Generate a START condition on the bus (SDA transitions to low while SCL is high).
+
+.. method:: I2C.stop()
+
+ Generate a STOP condition on the bus (SDA transitions to high while SCL is high).
+
+.. method:: I2C.readinto(buf, nack=True, /)
+
+ Reads bytes from the bus and stores them into *buf*. The number of bytes
+ read is the length of *buf*. An ACK will be sent on the bus after
+ receiving all but the last byte. After the last byte is received, if *nack*
+ is true then a NACK will be sent, otherwise an ACK will be sent (and in this
+ case the peripheral assumes more bytes are going to be read in a later call).
+
+.. method:: I2C.write(buf)
+
+ Write the bytes from *buf* to the bus. Checks that an ACK is received
+ after each byte and stops transmitting the remaining bytes if a NACK is
+ received. The function returns the number of ACKs that were received.
+
+Standard bus operations
+-----------------------
+
+The following methods implement the standard I2C controller read and write
+operations that target a given peripheral device.
+
+.. method:: I2C.readfrom(addr, nbytes, stop=True, /)
+
+ Read *nbytes* from the peripheral specified by *addr*.
+ If *stop* is true then a STOP condition is generated at the end of the transfer.
+ Returns a `bytes` object with the data read.
+
+.. method:: I2C.readfrom_into(addr, buf, stop=True, /)
+
+ Read into *buf* from the peripheral specified by *addr*.
+ The number of bytes read will be the length of *buf*.
+ If *stop* is true then a STOP condition is generated at the end of the transfer.
+
+ The method returns ``None``.
+
+.. method:: I2C.writeto(addr, buf, stop=True, /)
+
+ Write the bytes from *buf* to the peripheral specified by *addr*. If a
+ NACK is received following the write of a byte from *buf* then the
+ remaining bytes are not sent. If *stop* is true then a STOP condition is
+ generated at the end of the transfer, even if a NACK is received.
+ The function returns the number of ACKs that were received.
+
+.. method:: I2C.writevto(addr, vector, stop=True, /)
+
+ Write the bytes contained in *vector* to the peripheral specified by *addr*.
+ *vector* should be a tuple or list of objects with the buffer protocol.
+ The *addr* is sent once and then the bytes from each object in *vector*
+ are written out sequentially. The objects in *vector* may be zero bytes
+ in length in which case they don't contribute to the output.
+
+ If a NACK is received following the write of a byte from one of the
+ objects in *vector* then the remaining bytes, and any remaining objects,
+ are not sent. If *stop* is true then a STOP condition is generated at
+ the end of the transfer, even if a NACK is received. The function
+ returns the number of ACKs that were received.
+
+Memory operations
+-----------------
+
+Some I2C devices act as a memory device (or set of registers) that can be read
+from and written to. In this case there are two addresses associated with an
+I2C transaction: the peripheral address and the memory address. The following
+methods are convenience functions to communicate with such devices.
+
+.. method:: I2C.readfrom_mem(addr, memaddr, nbytes, *, addrsize=8)
+
+ Read *nbytes* from the peripheral specified by *addr* starting from the memory
+ address specified by *memaddr*.
+ The argument *addrsize* specifies the address size in bits.
+ Returns a `bytes` object with the data read.
+
+.. method:: I2C.readfrom_mem_into(addr, memaddr, buf, *, addrsize=8)
+
+ Read into *buf* from the peripheral specified by *addr* starting from the
+ memory address specified by *memaddr*. The number of bytes read is the
+ length of *buf*.
+ The argument *addrsize* specifies the address size in bits (on ESP8266
+ this argument is not recognised and the address size is always 8 bits).
+
+ The method returns ``None``.
+
+.. method:: I2C.writeto_mem(addr, memaddr, buf, *, addrsize=8)
+
+ Write *buf* to the peripheral specified by *addr* starting from the
+ memory address specified by *memaddr*.
+ The argument *addrsize* specifies the address size in bits (on ESP8266
+ this argument is not recognised and the address size is always 8 bits).
+
+ The method returns ``None``.
diff --git a/components/language/micropython/docs/library/machine.I2S.rst b/components/language/micropython/docs/library/machine.I2S.rst
new file mode 100644
index 00000000..b602ac65
--- /dev/null
+++ b/components/language/micropython/docs/library/machine.I2S.rst
@@ -0,0 +1,166 @@
+.. currentmodule:: machine
+.. _machine.I2S:
+
+class I2S -- Inter-IC Sound bus protocol
+========================================
+
+I2S is a synchronous serial protocol used to connect digital audio devices.
+At the physical level, a bus consists of 3 lines: SCK, WS, SD.
+The I2S class supports controller operation. Peripheral operation is not supported.
+
+The I2S class is currently available as a Technical Preview. During the preview period, feedback from
+users is encouraged. Based on this feedback, the I2S class API and implementation may be changed.
+
+I2S objects can be created and initialized using::
+
+ from machine import I2S
+ from machine import Pin
+
+ # ESP32
+ sck_pin = Pin(14) # Serial clock output
+ ws_pin = Pin(13) # Word clock output
+ sd_pin = Pin(12) # Serial data output
+
+ or
+
+ # PyBoards
+ sck_pin = Pin("Y6") # Serial clock output
+ ws_pin = Pin("Y5") # Word clock output
+ sd_pin = Pin("Y8") # Serial data output
+
+ audio_out = I2S(2,
+ sck=sck_pin, ws=ws_pin, sd=sd_pin,
+ mode=I2S.TX,
+ bits=16,
+ format=I2S.MONO,
+ rate=44100,
+ ibuf=20000)
+
+ audio_in = I2S(2,
+ sck=sck_pin, ws=ws_pin, sd=sd_pin,
+ mode=I2S.RX,
+ bits=32,
+ format=I2S.STEREO,
+ rate=22050,
+ ibuf=20000)
+
+3 modes of operation are supported:
+ - blocking
+ - non-blocking
+ - uasyncio
+
+blocking::
+
+ num_written = audio_out.write(buf) # blocks until buf emptied
+
+ num_read = audio_in.readinto(buf) # blocks until buf filled
+
+non-blocking::
+
+ audio_out.irq(i2s_callback) # i2s_callback is called when buf is emptied
+ num_written = audio_out.write(buf) # returns immediately
+
+ audio_in.irq(i2s_callback) # i2s_callback is called when buf is filled
+ num_read = audio_in.readinto(buf) # returns immediately
+
+uasyncio::
+
+ swriter = uasyncio.StreamWriter(audio_out)
+ swriter.write(buf)
+ await swriter.drain()
+
+ sreader = uasyncio.StreamReader(audio_in)
+ num_read = await sreader.readinto(buf)
+
+Some codec devices like the WM8960 or SGTL5000 require separate initialization
+before they can operate with the I2S class. For these, separate drivers are
+supplied, which also offer methods for controlling volume, audio processing and
+other things. For these drivers see:
+
+- :ref:`wm8960`
+
+Constructor
+-----------
+
+.. class:: I2S(id, *, sck, ws, sd, mck=None, mode, bits, format, rate, ibuf)
+
+ Construct an I2S object of the given id:
+
+ - ``id`` identifies a particular I2S bus; it is board and port specific
+
+ Keyword-only parameters that are supported on all ports:
+
+ - ``sck`` is a pin object for the serial clock line
+ - ``ws`` is a pin object for the word select line
+ - ``sd`` is a pin object for the serial data line
+ - ``mck`` is a pin object for the master clock line;
+ master clock frequency is sampling rate * 256
+ - ``mode`` specifies receive or transmit
+ - ``bits`` specifies sample size (bits), 16 or 32
+ - ``format`` specifies channel format, STEREO or MONO
+ - ``rate`` specifies audio sampling rate (Hz);
+ this is the frequency of the ``ws`` signal
+ - ``ibuf`` specifies internal buffer length (bytes)
+
+ For all ports, DMA runs continuously in the background and allows user applications to perform other operations while
+ sample data is transfered between the internal buffer and the I2S peripheral unit.
+ Increasing the size of the internal buffer has the potential to increase the time that user applications can perform non-I2S operations
+ before underflow (e.g. ``write`` method) or overflow (e.g. ``readinto`` method).
+
+Methods
+-------
+
+.. method:: I2S.init(sck, ...)
+
+ see Constructor for argument descriptions
+
+.. method:: I2S.deinit()
+
+ Deinitialize the I2S bus
+
+.. method:: I2S.readinto(buf)
+
+ Read audio samples into the buffer specified by ``buf``. ``buf`` must support the buffer protocol, such as bytearray or array.
+ "buf" byte ordering is little-endian. For Stereo format, left channel sample precedes right channel sample. For Mono format,
+ the left channel sample data is used.
+ Returns number of bytes read
+
+.. method:: I2S.write(buf)
+
+ Write audio samples contained in ``buf``. ``buf`` must support the buffer protocol, such as bytearray or array.
+ "buf" byte ordering is little-endian. For Stereo format, left channel sample precedes right channel sample. For Mono format,
+ the sample data is written to both the right and left channels.
+ Returns number of bytes written
+
+.. method:: I2S.irq(handler)
+
+ Set a callback. ``handler`` is called when ``buf`` is emptied (``write`` method) or becomes full (``readinto`` method).
+ Setting a callback changes the ``write`` and ``readinto`` methods to non-blocking operation.
+ ``handler`` is called in the context of the MicroPython scheduler.
+
+.. staticmethod:: I2S.shift(*, buf, bits, shift)
+
+ bitwise shift of all samples contained in ``buf``. ``bits`` specifies sample size in bits. ``shift`` specifies the number of bits to shift each sample.
+ Positive for left shift, negative for right shift.
+ Typically used for volume control. Each bit shift changes sample volume by 6dB.
+
+Constants
+---------
+
+.. data:: I2S.RX
+
+ for initialising the I2S bus ``mode`` to receive
+
+.. data:: I2S.TX
+
+ for initialising the I2S bus ``mode`` to transmit
+
+.. data:: I2S.STEREO
+
+ for initialising the I2S bus ``format`` to stereo
+
+.. data:: I2S.MONO
+
+ for initialising the I2S bus ``format`` to mono
+
+
diff --git a/components/language/micropython/docs/library/machine.PWM.rst b/components/language/micropython/docs/library/machine.PWM.rst
new file mode 100644
index 00000000..4b743557
--- /dev/null
+++ b/components/language/micropython/docs/library/machine.PWM.rst
@@ -0,0 +1,122 @@
+.. currentmodule:: machine
+.. _machine.PWM:
+
+class PWM -- pulse width modulation
+===================================
+
+This class provides pulse width modulation output.
+
+Example usage::
+
+ from machine import PWM
+
+ pwm = PWM(pin) # create a PWM object on a pin
+ pwm.duty_u16(32768) # set duty to 50%
+
+ # reinitialise with a period of 200us, duty of 5us
+ pwm.init(freq=5000, duty_ns=5000)
+
+ pwm.duty_ns(3000) # set pulse width to 3us
+
+ pwm.deinit()
+
+Constructors
+------------
+
+.. class:: PWM(dest, *, freq, duty_u16, duty_ns)
+
+ Construct and return a new PWM object using the following parameters:
+
+ - *dest* is the entity on which the PWM is output, which is usually a
+ :ref:`machine.Pin ` object, but a port may allow other values,
+ like integers.
+ - *freq* should be an integer which sets the frequency in Hz for the
+ PWM cycle.
+ - *duty_u16* sets the duty cycle as a ratio ``duty_u16 / 65535``.
+ - *duty_ns* sets the pulse width in nanoseconds.
+
+ Setting *freq* may affect other PWM objects if the objects share the same
+ underlying PWM generator (this is hardware specific).
+ Only one of *duty_u16* and *duty_ns* should be specified at a time.
+
+Methods
+-------
+
+.. method:: PWM.init(*, freq, duty_u16, duty_ns)
+
+ Modify settings for the PWM object. See the above constructor for details
+ about the parameters.
+
+.. method:: PWM.deinit()
+
+ Disable the PWM output.
+
+.. method:: PWM.freq([value])
+
+ Get or set the current frequency of the PWM output.
+
+ With no arguments the frequency in Hz is returned.
+
+ With a single *value* argument the frequency is set to that value in Hz. The
+ method may raise a ``ValueError`` if the frequency is outside the valid range.
+
+.. method:: PWM.duty_u16([value])
+
+ Get or set the current duty cycle of the PWM output, as an unsigned 16-bit
+ value in the range 0 to 65535 inclusive.
+
+ With no arguments the duty cycle is returned.
+
+ With a single *value* argument the duty cycle is set to that value, measured
+ as the ratio ``value / 65535``.
+
+.. method:: PWM.duty_ns([value])
+
+ Get or set the current pulse width of the PWM output, as a value in nanoseconds.
+
+ With no arguments the pulse width in nanoseconds is returned.
+
+ With a single *value* argument the pulse width is set to that value.
+
+Specific PWM class implementations
+----------------------------------
+
+The following concrete class(es) implement enhancements to the PWM class.
+
+ | :ref:`pyb.Timer for PyBoard `
+
+Limitations of PWM
+------------------
+
+* Not all frequencies can be generated with absolute accuracy due to
+ the discrete nature of the computing hardware. Typically the PWM frequency
+ is obtained by dividing some integer base frequency by an integer divider.
+ For example, if the base frequency is 80MHz and the required PWM frequency is
+ 300kHz the divider must be a non-integer number 80000000 / 300000 = 266.67.
+ After rounding the divider is set to 267 and the PWM frequency will be
+ 80000000 / 267 = 299625.5 Hz, not 300kHz. If the divider is set to 266 then
+ the PWM frequency will be 80000000 / 266 = 300751.9 Hz, but again not 300kHz.
+
+ Some ports like the RP2040 one use a fractional divider, which allow a finer
+ granularity of the frequency at higher frequencies by switching the PWM
+ pulse duration between two adjacent values, such that the resulting average
+ frequency is more close to the intended one, at the cost of spectral purity.
+
+* The duty cycle has the same discrete nature and its absolute accuracy is not
+ achievable. On most hardware platforms the duty will be applied at the next
+ frequency period. Therefore, you should wait more than "1/frequency" before
+ measuring the duty.
+
+* The frequency and the duty cycle resolution are usually interdependent.
+ The higher the PWM frequency the lower the duty resolution which is available,
+ and vice versa. For example, a 300kHz PWM frequency can have a duty cycle
+ resolution of 8 bit, not 16-bit as may be expected. In this case, the lowest
+ 8 bits of *duty_u16* are insignificant. So::
+
+ pwm=PWM(Pin(13), freq=300_000, duty_u16=2**16//2)
+
+ and::
+
+ pwm=PWM(Pin(13), freq=300_000, duty_u16=2**16//2 + 255)
+
+ will generate PWM with the same 50% duty cycle.
diff --git a/components/language/micropython/docs/library/machine.Pin.rst b/components/language/micropython/docs/library/machine.Pin.rst
new file mode 100644
index 00000000..49fb66be
--- /dev/null
+++ b/components/language/micropython/docs/library/machine.Pin.rst
@@ -0,0 +1,276 @@
+.. currentmodule:: machine
+.. _machine.Pin:
+
+class Pin -- control I/O pins
+=============================
+
+A pin object is used to control I/O pins (also known as GPIO - general-purpose
+input/output). Pin objects are commonly associated with a physical pin that can
+drive an output voltage and read input voltages. The pin class has methods to set the mode of
+the pin (IN, OUT, etc) and methods to get and set the digital logic level.
+For analog control of a pin, see the :class:`ADC` class.
+
+A pin object is constructed by using an identifier which unambiguously
+specifies a certain I/O pin. The allowed forms of the identifier and the
+physical pin that the identifier maps to are port-specific. Possibilities
+for the identifier are an integer, a string or a tuple with port and pin
+number.
+
+Usage Model::
+
+ from machine import Pin
+
+ # create an output pin on pin #0
+ p0 = Pin(0, Pin.OUT)
+
+ # set the value low then high
+ p0.value(0)
+ p0.value(1)
+
+ # create an input pin on pin #2, with a pull up resistor
+ p2 = Pin(2, Pin.IN, Pin.PULL_UP)
+
+ # read and print the pin value
+ print(p2.value())
+
+ # reconfigure pin #0 in input mode with a pull down resistor
+ p0.init(p0.IN, p0.PULL_DOWN)
+
+ # configure an irq callback
+ p0.irq(lambda p:print(p))
+
+Constructors
+------------
+
+.. class:: Pin(id, mode=-1, pull=-1, *, value=None, drive=0, alt=-1)
+
+ Access the pin peripheral (GPIO pin) associated with the given ``id``. If
+ additional arguments are given in the constructor then they are used to initialise
+ the pin. Any settings that are not specified will remain in their previous state.
+
+ The arguments are:
+
+ - ``id`` is mandatory and can be an arbitrary object. Among possible value
+ types are: int (an internal Pin identifier), str (a Pin name), and tuple
+ (pair of [port, pin]).
+
+ - ``mode`` specifies the pin mode, which can be one of:
+
+ - ``Pin.IN`` - Pin is configured for input. If viewed as an output the pin
+ is in high-impedance state.
+
+ - ``Pin.OUT`` - Pin is configured for (normal) output.
+
+ - ``Pin.OPEN_DRAIN`` - Pin is configured for open-drain output. Open-drain
+ output works in the following way: if the output value is set to 0 the pin
+ is active at a low level; if the output value is 1 the pin is in a high-impedance
+ state. Not all ports implement this mode, or some might only on certain pins.
+
+ - ``Pin.ALT`` - Pin is configured to perform an alternative function, which is
+ port specific. For a pin configured in such a way any other Pin methods
+ (except :meth:`Pin.init`) are not applicable (calling them will lead to undefined,
+ or a hardware-specific, result). Not all ports implement this mode.
+
+ - ``Pin.ALT_OPEN_DRAIN`` - The Same as ``Pin.ALT``, but the pin is configured as
+ open-drain. Not all ports implement this mode.
+
+ - ``Pin.ANALOG`` - Pin is configured for analog input, see the :class:`ADC` class.
+
+ - ``pull`` specifies if the pin has a (weak) pull resistor attached, and can be
+ one of:
+
+ - ``None`` - No pull up or down resistor.
+ - ``Pin.PULL_UP`` - Pull up resistor enabled.
+ - ``Pin.PULL_DOWN`` - Pull down resistor enabled.
+
+ - ``value`` is valid only for Pin.OUT and Pin.OPEN_DRAIN modes and specifies initial
+ output pin value if given, otherwise the state of the pin peripheral remains
+ unchanged.
+
+ - ``drive`` specifies the output power of the pin and can be one of: ``Pin.DRIVE_0``,
+ ``Pin.DRIVE_1``, etc., increasing in drive strength. The actual current driving
+ capabilities are port dependent. Not all ports implement this argument.
+
+ - ``alt`` specifies an alternate function for the pin and the values it can take are
+ port dependent. This argument is valid only for ``Pin.ALT`` and ``Pin.ALT_OPEN_DRAIN``
+ modes. It may be used when a pin supports more than one alternate function. If only
+ one pin alternate function is supported the this argument is not required. Not all
+ ports implement this argument.
+
+ As specified above, the Pin class allows to set an alternate function for a particular
+ pin, but it does not specify any further operations on such a pin. Pins configured in
+ alternate-function mode are usually not used as GPIO but are instead driven by other
+ hardware peripherals. The only operation supported on such a pin is re-initialising,
+ by calling the constructor or :meth:`Pin.init` method. If a pin that is configured in
+ alternate-function mode is re-initialised with ``Pin.IN``, ``Pin.OUT``, or
+ ``Pin.OPEN_DRAIN``, the alternate function will be removed from the pin.
+
+Methods
+-------
+
+.. method:: Pin.init(mode=-1, pull=-1, *, value=None, drive=0, alt=-1)
+
+ Re-initialise the pin using the given parameters. Only those arguments that
+ are specified will be set. The rest of the pin peripheral state will remain
+ unchanged. See the constructor documentation for details of the arguments.
+
+ Returns ``None``.
+
+.. method:: Pin.value([x])
+
+ This method allows to set and get the value of the pin, depending on whether
+ the argument ``x`` is supplied or not.
+
+ If the argument is omitted then this method gets the digital logic level of
+ the pin, returning 0 or 1 corresponding to low and high voltage signals
+ respectively. The behaviour of this method depends on the mode of the pin:
+
+ - ``Pin.IN`` - The method returns the actual input value currently present
+ on the pin.
+ - ``Pin.OUT`` - The behaviour and return value of the method is undefined.
+ - ``Pin.OPEN_DRAIN`` - If the pin is in state '0' then the behaviour and
+ return value of the method is undefined. Otherwise, if the pin is in
+ state '1', the method returns the actual input value currently present
+ on the pin.
+
+ If the argument is supplied then this method sets the digital logic level of
+ the pin. The argument ``x`` can be anything that converts to a boolean.
+ If it converts to ``True``, the pin is set to state '1', otherwise it is set
+ to state '0'. The behaviour of this method depends on the mode of the pin:
+
+ - ``Pin.IN`` - The value is stored in the output buffer for the pin. The
+ pin state does not change, it remains in the high-impedance state. The
+ stored value will become active on the pin as soon as it is changed to
+ ``Pin.OUT`` or ``Pin.OPEN_DRAIN`` mode.
+ - ``Pin.OUT`` - The output buffer is set to the given value immediately.
+ - ``Pin.OPEN_DRAIN`` - If the value is '0' the pin is set to a low voltage
+ state. Otherwise the pin is set to high-impedance state.
+
+ When setting the value this method returns ``None``.
+
+.. method:: Pin.__call__([x])
+
+ Pin objects are callable. The call method provides a (fast) shortcut to set
+ and get the value of the pin. It is equivalent to Pin.value([x]).
+ See :meth:`Pin.value` for more details.
+
+.. method:: Pin.on()
+
+ Set pin to "1" output level.
+
+.. method:: Pin.off()
+
+ Set pin to "0" output level.
+
+.. method:: Pin.irq(handler=None, trigger=(Pin.IRQ_FALLING | Pin.IRQ_RISING), *, priority=1, wake=None, hard=False)
+
+ Configure an interrupt handler to be called when the trigger source of the
+ pin is active. If the pin mode is ``Pin.IN`` then the trigger source is
+ the external value on the pin. If the pin mode is ``Pin.OUT`` then the
+ trigger source is the output buffer of the pin. Otherwise, if the pin mode
+ is ``Pin.OPEN_DRAIN`` then the trigger source is the output buffer for
+ state '0' and the external pin value for state '1'.
+
+ The arguments are:
+
+ - ``handler`` is an optional function to be called when the interrupt
+ triggers. The handler must take exactly one argument which is the
+ ``Pin`` instance.
+
+ - ``trigger`` configures the event which can generate an interrupt.
+ Possible values are:
+
+ - ``Pin.IRQ_FALLING`` interrupt on falling edge.
+ - ``Pin.IRQ_RISING`` interrupt on rising edge.
+ - ``Pin.IRQ_LOW_LEVEL`` interrupt on low level.
+ - ``Pin.IRQ_HIGH_LEVEL`` interrupt on high level.
+
+ These values can be OR'ed together to trigger on multiple events.
+
+ - ``priority`` sets the priority level of the interrupt. The values it
+ can take are port-specific, but higher values always represent higher
+ priorities.
+
+ - ``wake`` selects the power mode in which this interrupt can wake up the
+ system. It can be ``machine.IDLE``, ``machine.SLEEP`` or ``machine.DEEPSLEEP``.
+ These values can also be OR'ed together to make a pin generate interrupts in
+ more than one power mode.
+
+ - ``hard`` if true a hardware interrupt is used. This reduces the delay
+ between the pin change and the handler being called. Hard interrupt
+ handlers may not allocate memory; see :ref:`isr_rules`.
+ Not all ports support this argument.
+
+ This method returns a callback object.
+
+The following methods are not part of the core Pin API and only implemented on certain ports.
+
+.. method:: Pin.low()
+
+ Set pin to "0" output level.
+
+ Availability: nrf, rp2, stm32 ports.
+
+.. method:: Pin.high()
+
+ Set pin to "1" output level.
+
+ Availability: nrf, rp2, stm32 ports.
+
+.. method:: Pin.mode([mode])
+
+ Get or set the pin mode.
+ See the constructor documentation for details of the ``mode`` argument.
+
+ Availability: cc3200, stm32 ports.
+
+.. method:: Pin.pull([pull])
+
+ Get or set the pin pull state.
+ See the constructor documentation for details of the ``pull`` argument.
+
+ Availability: cc3200, stm32 ports.
+
+.. method:: Pin.drive([drive])
+
+ Get or set the pin drive strength.
+ See the constructor documentation for details of the ``drive`` argument.
+
+ Availability: cc3200 port.
+
+Constants
+---------
+
+The following constants are used to configure the pin objects. Note that
+not all constants are available on all ports.
+
+.. data:: Pin.IN
+ Pin.OUT
+ Pin.OPEN_DRAIN
+ Pin.ALT
+ Pin.ALT_OPEN_DRAIN
+ Pin.ANALOG
+
+ Selects the pin mode.
+
+.. data:: Pin.PULL_UP
+ Pin.PULL_DOWN
+ Pin.PULL_HOLD
+
+ Selects whether there is a pull up/down resistor. Use the value
+ ``None`` for no pull.
+
+.. data:: Pin.DRIVE_0
+ Pin.DRIVE_1
+ Pin.DRIVE_2
+
+ Selects the pin drive strength. A port may define additional drive
+ constants with increasing number corresponding to increasing drive
+ strength.
+
+.. data:: Pin.IRQ_FALLING
+ Pin.IRQ_RISING
+ Pin.IRQ_LOW_LEVEL
+ Pin.IRQ_HIGH_LEVEL
+
+ Selects the IRQ trigger type.
diff --git a/components/language/micropython/docs/library/machine.RTC.rst b/components/language/micropython/docs/library/machine.RTC.rst
new file mode 100644
index 00000000..be2be2ee
--- /dev/null
+++ b/components/language/micropython/docs/library/machine.RTC.rst
@@ -0,0 +1,83 @@
+.. currentmodule:: machine
+.. _machine.RTC:
+
+class RTC -- real time clock
+============================
+
+The RTC is an independent clock that keeps track of the date
+and time.
+
+Example usage::
+
+ rtc = machine.RTC()
+ rtc.datetime((2020, 1, 21, 2, 10, 32, 36, 0))
+ print(rtc.datetime())
+
+
+Constructors
+------------
+
+.. class:: RTC(id=0, ...)
+
+ Create an RTC object. See init for parameters of initialization.
+
+Methods
+-------
+
+.. method:: RTC.datetime([datetimetuple])
+
+ Get or set the date and time of the RTC.
+
+ With no arguments, this method returns an 8-tuple with the current
+ date and time. With 1 argument (being an 8-tuple) it sets the date
+ and time.
+
+ The 8-tuple has the following format:
+
+ (year, month, day, weekday, hours, minutes, seconds, subseconds)
+
+ The meaning of the ``subseconds`` field is hardware dependent.
+
+.. method:: RTC.init(datetime)
+
+ Initialise the RTC. Datetime is a tuple of the form:
+
+ ``(year, month, day[, hour[, minute[, second[, microsecond[, tzinfo]]]]])``
+
+.. method:: RTC.now()
+
+ Get get the current datetime tuple.
+
+.. method:: RTC.deinit()
+
+ Resets the RTC to the time of January 1, 2015 and starts running it again.
+
+.. method:: RTC.alarm(id, time, *, repeat=False)
+
+ Set the RTC alarm. Time might be either a millisecond value to program the alarm to
+ current time + time_in_ms in the future, or a datetimetuple. If the time passed is in
+ milliseconds, repeat can be set to ``True`` to make the alarm periodic.
+
+.. method:: RTC.alarm_left(alarm_id=0)
+
+ Get the number of milliseconds left before the alarm expires.
+
+.. method:: RTC.cancel(alarm_id=0)
+
+ Cancel a running alarm.
+
+.. method:: RTC.irq(*, trigger, handler=None, wake=machine.IDLE)
+
+ Create an irq object triggered by a real time clock alarm.
+
+ - ``trigger`` must be ``RTC.ALARM0``
+ - ``handler`` is the function to be called when the callback is triggered.
+ - ``wake`` specifies the sleep mode from where this interrupt can wake
+ up the system.
+
+Constants
+---------
+
+.. data:: RTC.ALARM0
+
+ irq trigger source
diff --git a/components/language/micropython/docs/library/machine.SD.rst b/components/language/micropython/docs/library/machine.SD.rst
new file mode 100644
index 00000000..c736dc4d
--- /dev/null
+++ b/components/language/micropython/docs/library/machine.SD.rst
@@ -0,0 +1,47 @@
+.. currentmodule:: machine
+.. _machine.SD:
+
+class SD -- secure digital memory card (cc3200 port only)
+=========================================================
+
+.. warning::
+
+ This is a non-standard class and is only available on the cc3200 port.
+
+
+The SD card class allows to configure and enable the memory card
+module of the WiPy and automatically mount it as ``/sd`` as part
+of the file system. There are several pin combinations that can be
+used to wire the SD card socket to the WiPy and the pins used can
+be specified in the constructor. Please check the `pinout and alternate functions
+table. `_ for
+more info regarding the pins which can be remapped to be used with a SD card.
+
+Example usage::
+
+ from machine import SD
+ import os
+ # clk cmd and dat0 pins must be passed along with
+ # their respective alternate functions
+ sd = machine.SD(pins=('GP10', 'GP11', 'GP15'))
+ os.mount(sd, '/sd')
+ # do normal file operations
+
+Constructors
+------------
+
+.. class:: SD(id,... )
+
+ Create a SD card object. See ``init()`` for parameters if initialization.
+
+Methods
+-------
+
+.. method:: SD.init(id=0, pins=('GP10', 'GP11', 'GP15'))
+
+ Enable the SD card. In order to initialize the card, give it a 3-tuple:
+ ``(clk_pin, cmd_pin, dat0_pin)``.
+
+.. method:: SD.deinit()
+
+ Disable the SD card.
diff --git a/components/language/micropython/docs/library/machine.SDCard.rst b/components/language/micropython/docs/library/machine.SDCard.rst
new file mode 100644
index 00000000..cde0bd1d
--- /dev/null
+++ b/components/language/micropython/docs/library/machine.SDCard.rst
@@ -0,0 +1,167 @@
+.. currentmodule:: machine
+.. _machine.SDCard:
+
+class SDCard -- secure digital memory card
+==========================================
+
+SD cards are one of the most common small form factor removable storage media.
+SD cards come in a variety of sizes and physical form factors. MMC cards are
+similar removable storage devices while eMMC devices are electrically similar
+storage devices designed to be embedded into other systems. All three form
+share a common protocol for communication with their host system and high-level
+support looks the same for them all. As such in MicroPython they are implemented
+in a single class called :class:`machine.SDCard` .
+
+Both SD and MMC interfaces support being accessed with a variety of bus widths.
+When being accessed with a 1-bit wide interface they can be accessed using the
+SPI protocol. Different MicroPython hardware platforms support different widths
+and pin configurations but for most platforms there is a standard configuration
+for any given hardware. In general constructing an ``SDCard`` object with without
+passing any parameters will initialise the interface to the default card slot
+for the current hardware. The arguments listed below represent the common
+arguments that might need to be set in order to use either a non-standard slot
+or a non-standard pin assignment. The exact subset of arguments supported will
+vary from platform to platform.
+
+.. class:: SDCard(slot=1, width=1, cd=None, wp=None, sck=None, miso=None, mosi=None, cs=None, freq=20000000)
+
+ This class provides access to SD or MMC storage cards using either
+ a dedicated SD/MMC interface hardware or through an SPI channel.
+ The class implements the block protocol defined by :class:`os.AbstractBlockDev`.
+ This allows the mounting of an SD card to be as simple as::
+
+ os.mount(machine.SDCard(), "/sd")
+
+ The constructor takes the following parameters:
+
+ - *slot* selects which of the available interfaces to use. Leaving this
+ unset will select the default interface.
+
+ - *width* selects the bus width for the SD/MMC interface.
+
+ - *cd* can be used to specify a card-detect pin.
+
+ - *wp* can be used to specify a write-protect pin.
+
+ - *sck* can be used to specify an SPI clock pin.
+
+ - *miso* can be used to specify an SPI miso pin.
+
+ - *mosi* can be used to specify an SPI mosi pin.
+
+ - *cs* can be used to specify an SPI chip select pin.
+
+ - *freq* selects the SD/MMC interface frequency in Hz (only supported on the ESP32).
+
+Implementation-specific details
+-------------------------------
+
+Different implementations of the ``SDCard`` class on different hardware support
+varying subsets of the options above.
+
+PyBoard
+```````
+
+The standard PyBoard has just one slot. No arguments are necessary or supported.
+
+ESP32
+`````
+
+The ESP32 provides two channels of SD/MMC hardware and also supports
+access to SD Cards through either of the two SPI ports that are
+generally available to the user. As a result the *slot* argument can
+take a value between 0 and 3, inclusive. Slots 0 and 1 use the
+built-in SD/MMC hardware while slots 2 and 3 use the SPI ports. Slot 0
+supports 1, 4 or 8-bit wide access while slot 1 supports 1 or 4-bit
+access; the SPI slots only support 1-bit access.
+
+ .. note:: Slot 0 is used to communicate with on-board flash memory
+ on most ESP32 modules and so will be unavailable to the
+ user.
+
+ .. note:: Most ESP32 modules that provide an SD card slot using the
+ dedicated hardware only wire up 1 data pin, so the default
+ value for *width* is 1.
+
+The pins used by the dedicated SD/MMC hardware are fixed. The pins
+used by the SPI hardware can be reassigned.
+
+ .. note:: If any of the SPI signals are remapped then all of the SPI
+ signals will pass through a GPIO multiplexer unit which
+ can limit the performance of high frequency signals. Since
+ the normal operating speed for SD cards is 40MHz this can
+ cause problems on some cards.
+
+The default (and preferred) pin assignment are as follows:
+
+ ====== ====== ====== ====== ======
+ Slot 0 1 2 3
+ ------ ------ ------ ------ ------
+ Signal Pin Pin Pin Pin
+ ====== ====== ====== ====== ======
+ sck 6 14 18 14
+ cmd 11 15
+ cs 5 15
+ miso 19 12
+ mosi 23 13
+ D0 7 2
+ D1 8 4
+ D2 9 12
+ D3 10 13
+ D4 16
+ D5 17
+ D6 5
+ D7 18
+ ====== ====== ====== ====== ======
+
+cc3200
+``````
+
+You can set the pins used for SPI access by passing a tuple as the
+*pins* argument.
+
+*Note:* The current cc3200 SD card implementation names the this class
+:class:`machine.SD` rather than :class:`machine.SDCard` .
+
+mimxrt
+``````
+
+The SDCard module for the mimxrt port only supports access via dedicated SD/MMC
+peripheral (USDHC) in 4-bit mode with 50MHz clock frequency exclusively.
+Unfortunately the MIMXRT1011 controller does not support the USDHC peripheral.
+Hence this controller does not feature the ``machine.SDCard`` module.
+
+Due to the decision to only support 4-bit mode with 50MHz clock frequency the
+interface has been simplified, and the constructor signature is:
+
+.. class:: SDCard(slot=1)
+ :noindex:
+
+The pins used for the USDHC peripheral have to be configured in ``mpconfigboard.h``.
+Most of the controllers supported by the mimxrt port provide up to two USDHC
+peripherals. Therefore the pin configuration is performed using the macro
+``MICROPY_USDHCx`` with x being 1 or 2 respectively.
+
+The following shows an example configuration for USDHC1::
+
+ #define MICROPY_USDHC1 \
+ { \
+ .cmd = { GPIO_SD_B0_02_USDHC1_CMD}, \
+ .clk = { GPIO_SD_B0_03_USDHC1_CLK }, \
+ .cd_b = { GPIO_SD_B0_06_USDHC1_CD_B },\
+ .data0 = { GPIO_SD_B0_04_USDHC1_DATA0 },\
+ .data1 = { GPIO_SD_B0_05_USDHC1_DATA1 },\
+ .data2 = { GPIO_SD_B0_00_USDHC1_DATA2 },\
+ .data3 = { GPIO_SD_B0_01_USDHC1_DATA3 },\
+ }
+
+If the card detect pin is not used (cb_b pin) then the respective entry has to be
+filled with the following dummy value::
+
+ #define USDHC_DUMMY_PIN NULL , 0
+
+Based on the definition of macro ``MICROPY_USDHC1`` and/or ``MICROPY_USDHC2``
+the ``machine.SDCard`` module either supports one or two slots. If only one of
+the defines is provided, calling ``machine.SDCard()`` or ``machine.SDCard(1)``
+will return an instance using the respective USDHC peripheral. When both macros
+are defined, calling ``machine.SDCard(2)`` returns an instance using USDHC2.
diff --git a/components/language/micropython/docs/library/machine.SPI.rst b/components/language/micropython/docs/library/machine.SPI.rst
new file mode 100644
index 00000000..7b0e8cf4
--- /dev/null
+++ b/components/language/micropython/docs/library/machine.SPI.rst
@@ -0,0 +1,153 @@
+.. currentmodule:: machine
+.. _machine.SPI:
+
+class SPI -- a Serial Peripheral Interface bus protocol (controller side)
+=========================================================================
+
+SPI is a synchronous serial protocol that is driven by a controller. At the
+physical level, a bus consists of 3 lines: SCK, MOSI, MISO. Multiple devices
+can share the same bus. Each device should have a separate, 4th signal,
+CS (Chip Select), to select a particular device on a bus with which
+communication takes place. Management of a CS signal should happen in
+user code (via machine.Pin class).
+
+Both hardware and software SPI implementations exist via the
+:ref:`machine.SPI ` and `machine.SoftSPI` classes. Hardware SPI uses underlying
+hardware support of the system to perform the reads/writes and is usually
+efficient and fast but may have restrictions on which pins can be used.
+Software SPI is implemented by bit-banging and can be used on any pin but
+is not as efficient. These classes have the same methods available and
+differ primarily in the way they are constructed.
+
+Example usage::
+
+ from machine import SPI, Pin
+
+ spi = SPI(0, baudrate=400000) # Create SPI peripheral 0 at frequency of 400kHz.
+ # Depending on the use case, extra parameters may be required
+ # to select the bus characteristics and/or pins to use.
+ cs = Pin(4, mode=Pin.OUT, value=1) # Create chip-select on pin 4.
+
+ try:
+ cs(0) # Select peripheral.
+ spi.write(b"12345678") # Write 8 bytes, and don't care about received data.
+ finally:
+ cs(1) # Deselect peripheral.
+
+ try:
+ cs(0) # Select peripheral.
+ rxdata = spi.read(8, 0x42) # Read 8 bytes while writing 0x42 for each byte.
+ finally:
+ cs(1) # Deselect peripheral.
+
+ rxdata = bytearray(8)
+ try:
+ cs(0) # Select peripheral.
+ spi.readinto(rxdata, 0x42) # Read 8 bytes inplace while writing 0x42 for each byte.
+ finally:
+ cs(1) # Deselect peripheral.
+
+ txdata = b"12345678"
+ rxdata = bytearray(len(txdata))
+ try:
+ cs(0) # Select peripheral.
+ spi.write_readinto(txdata, rxdata) # Simultaneously write and read bytes.
+ finally:
+ cs(1) # Deselect peripheral.
+
+Constructors
+------------
+
+.. class:: SPI(id, ...)
+
+ Construct an SPI object on the given bus, *id*. Values of *id* depend
+ on a particular port and its hardware. Values 0, 1, etc. are commonly used
+ to select hardware SPI block #0, #1, etc.
+
+ With no additional parameters, the SPI object is created but not
+ initialised (it has the settings from the last initialisation of
+ the bus, if any). If extra arguments are given, the bus is initialised.
+ See ``init`` for parameters of initialisation.
+
+.. _machine.SoftSPI:
+.. class:: SoftSPI(baudrate=500000, *, polarity=0, phase=0, bits=8, firstbit=MSB, sck=None, mosi=None, miso=None)
+
+ Construct a new software SPI object. Additional parameters must be
+ given, usually at least *sck*, *mosi* and *miso*, and these are used
+ to initialise the bus. See `SPI.init` for a description of the parameters.
+
+Methods
+-------
+
+.. method:: SPI.init(baudrate=1000000, *, polarity=0, phase=0, bits=8, firstbit=SPI.MSB, sck=None, mosi=None, miso=None, pins=(SCK, MOSI, MISO))
+
+ Initialise the SPI bus with the given parameters:
+
+ - ``baudrate`` is the SCK clock rate.
+ - ``polarity`` can be 0 or 1, and is the level the idle clock line sits at.
+ - ``phase`` can be 0 or 1 to sample data on the first or second clock edge
+ respectively.
+ - ``bits`` is the width in bits of each transfer. Only 8 is guaranteed to be supported by all hardware.
+ - ``firstbit`` can be ``SPI.MSB`` or ``SPI.LSB``.
+ - ``sck``, ``mosi``, ``miso`` are pins (machine.Pin) objects to use for bus signals. For most
+ hardware SPI blocks (as selected by ``id`` parameter to the constructor), pins are fixed
+ and cannot be changed. In some cases, hardware blocks allow 2-3 alternative pin sets for
+ a hardware SPI block. Arbitrary pin assignments are possible only for a bitbanging SPI driver
+ (``id`` = -1).
+ - ``pins`` - WiPy port doesn't ``sck``, ``mosi``, ``miso`` arguments, and instead allows to
+ specify them as a tuple of ``pins`` parameter.
+
+ In the case of hardware SPI the actual clock frequency may be lower than the
+ requested baudrate. This is dependant on the platform hardware. The actual
+ rate may be determined by printing the SPI object.
+
+.. method:: SPI.deinit()
+
+ Turn off the SPI bus.
+
+.. method:: SPI.read(nbytes, write=0x00)
+
+ Read a number of bytes specified by ``nbytes`` while continuously writing
+ the single byte given by ``write``.
+ Returns a ``bytes`` object with the data that was read.
+
+.. method:: SPI.readinto(buf, write=0x00)
+
+ Read into the buffer specified by ``buf`` while continuously writing the
+ single byte given by ``write``.
+ Returns ``None``.
+
+ Note: on WiPy this function returns the number of bytes read.
+
+.. method:: SPI.write(buf)
+
+ Write the bytes contained in ``buf``.
+ Returns ``None``.
+
+ Note: on WiPy this function returns the number of bytes written.
+
+.. method:: SPI.write_readinto(write_buf, read_buf)
+
+ Write the bytes from ``write_buf`` while reading into ``read_buf``. The
+ buffers can be the same or different, but both buffers must have the
+ same length.
+ Returns ``None``.
+
+ Note: on WiPy this function returns the number of bytes written.
+
+Constants
+---------
+
+.. data:: SPI.CONTROLLER
+
+ for initialising the SPI bus to controller; this is only used for the WiPy
+
+.. data:: SPI.MSB
+ SoftSPI.MSB
+
+ set the first bit to be the most significant bit
+
+.. data:: SPI.LSB
+ SoftSPI.LSB
+
+ set the first bit to be the least significant bit
diff --git a/components/language/micropython/docs/library/machine.Signal.rst b/components/language/micropython/docs/library/machine.Signal.rst
new file mode 100644
index 00000000..1e1fcb54
--- /dev/null
+++ b/components/language/micropython/docs/library/machine.Signal.rst
@@ -0,0 +1,123 @@
+.. currentmodule:: machine
+.. _machine.Signal:
+
+class Signal -- control and sense external I/O devices
+======================================================
+
+The Signal class is a simple extension of the `Pin` class. Unlike Pin, which
+can be only in "absolute" 0 and 1 states, a Signal can be in "asserted"
+(on) or "deasserted" (off) states, while being inverted (active-low) or
+not. In other words, it adds logical inversion support to Pin functionality.
+While this may seem a simple addition, it is exactly what is needed to
+support wide array of simple digital devices in a way portable across
+different boards, which is one of the major MicroPython goals. Regardless
+of whether different users have an active-high or active-low LED, a normally
+open or normally closed relay - you can develop a single, nicely looking
+application which works with each of them, and capture hardware
+configuration differences in few lines in the config file of your app.
+
+Example::
+
+ from machine import Pin, Signal
+
+ # Suppose you have an active-high LED on pin 0
+ led1_pin = Pin(0, Pin.OUT)
+ # ... and active-low LED on pin 1
+ led2_pin = Pin(1, Pin.OUT)
+
+ # Now to light up both of them using Pin class, you'll need to set
+ # them to different values
+ led1_pin.value(1)
+ led2_pin.value(0)
+
+ # Signal class allows to abstract away active-high/active-low
+ # difference
+ led1 = Signal(led1_pin, invert=False)
+ led2 = Signal(led2_pin, invert=True)
+
+ # Now lighting up them looks the same
+ led1.value(1)
+ led2.value(1)
+
+ # Even better:
+ led1.on()
+ led2.on()
+
+Following is the guide when Signal vs Pin should be used:
+
+* Use Signal: If you want to control a simple on/off (including software
+ PWM!) devices like LEDs, multi-segment indicators, relays, buzzers, or
+ read simple binary sensors, like normally open or normally closed buttons,
+ pulled high or low, Reed switches, moisture/flame detectors, etc. etc.
+ Summing up, if you have a real physical device/sensor requiring GPIO
+ access, you likely should use a Signal.
+
+* Use Pin: If you implement a higher-level protocol or bus to communicate
+ with more complex devices.
+
+The split between Pin and Signal come from the use cases above and the
+architecture of MicroPython: Pin offers the lowest overhead, which may
+be important when bit-banging protocols. But Signal adds additional
+flexibility on top of Pin, at the cost of minor overhead (much smaller
+than if you implemented active-high vs active-low device differences in
+Python manually!). Also, Pin is a low-level object which needs to be
+implemented for each support board, while Signal is a high-level object
+which comes for free once Pin is implemented.
+
+If in doubt, give the Signal a try! Once again, it is offered to save
+developers from the need to handle unexciting differences like active-low
+vs active-high signals, and allow other users to share and enjoy your
+application, instead of being frustrated by the fact that it doesn't
+work for them simply because their LEDs or relays are wired in a slightly
+different way.
+
+Constructors
+------------
+
+.. class:: Signal(pin_obj, invert=False)
+ Signal(pin_arguments..., *, invert=False)
+
+ Create a Signal object. There're two ways to create it:
+
+ * By wrapping existing Pin object - universal method which works for
+ any board.
+ * By passing required Pin parameters directly to Signal constructor,
+ skipping the need to create intermediate Pin object. Available on
+ many, but not all boards.
+
+ The arguments are:
+
+ - ``pin_obj`` is existing Pin object.
+
+ - ``pin_arguments`` are the same arguments as can be passed to Pin constructor.
+
+ - ``invert`` - if True, the signal will be inverted (active low).
+
+Methods
+-------
+
+.. method:: Signal.value([x])
+
+ This method allows to set and get the value of the signal, depending on whether
+ the argument ``x`` is supplied or not.
+
+ If the argument is omitted then this method gets the signal level, 1 meaning
+ signal is asserted (active) and 0 - signal inactive.
+
+ If the argument is supplied then this method sets the signal level. The
+ argument ``x`` can be anything that converts to a boolean. If it converts
+ to ``True``, the signal is active, otherwise it is inactive.
+
+ Correspondence between signal being active and actual logic level on the
+ underlying pin depends on whether signal is inverted (active-low) or not.
+ For non-inverted signal, active status corresponds to logical 1, inactive -
+ to logical 0. For inverted/active-low signal, active status corresponds
+ to logical 0, while inactive - to logical 1.
+
+.. method:: Signal.on()
+
+ Activate signal.
+
+.. method:: Signal.off()
+
+ Deactivate signal.
diff --git a/components/language/micropython/docs/library/machine.Timer.rst b/components/language/micropython/docs/library/machine.Timer.rst
new file mode 100644
index 00000000..424a49bc
--- /dev/null
+++ b/components/language/micropython/docs/library/machine.Timer.rst
@@ -0,0 +1,81 @@
+.. currentmodule:: machine
+.. _machine.Timer:
+
+class Timer -- control hardware timers
+======================================
+
+Hardware timers deal with timing of periods and events. Timers are perhaps
+the most flexible and heterogeneous kind of hardware in MCUs and SoCs,
+differently greatly from a model to a model. MicroPython's Timer class
+defines a baseline operation of executing a callback with a given period
+(or once after some delay), and allow specific boards to define more
+non-standard behaviour (which thus won't be portable to other boards).
+
+See discussion of :ref:`important constraints ` on
+Timer callbacks.
+
+.. note::
+
+ Memory can't be allocated inside irq handlers (an interrupt) and so
+ exceptions raised within a handler don't give much information. See
+ :func:`micropython.alloc_emergency_exception_buf` for how to get around this
+ limitation.
+
+If you are using a WiPy board please refer to :ref:`machine.TimerWiPy `
+instead of this class.
+
+Constructors
+------------
+
+.. class:: Timer(id, /, ...)
+
+ Construct a new timer object of the given ``id``. ``id`` of -1 constructs a
+ virtual timer (if supported by a board).
+ ``id`` shall not be passed as a keyword argument.
+
+ See ``init`` for parameters of initialisation.
+
+Methods
+-------
+
+.. method:: Timer.init(*, mode=Timer.PERIODIC, period=-1, callback=None)
+
+ Initialise the timer. Example::
+
+ def mycallback(t):
+ pass
+
+ # periodic with 100ms period
+ tim.init(period=100, callback=mycallback)
+
+ # one shot firing after 1000ms
+ tim.init(mode=Timer.ONE_SHOT, period=1000, callback=mycallback)
+
+ Keyword arguments:
+
+ - ``mode`` can be one of:
+
+ - ``Timer.ONE_SHOT`` - The timer runs once until the configured
+ period of the channel expires.
+ - ``Timer.PERIODIC`` - The timer runs periodically at the configured
+ frequency of the channel.
+
+ - ``period`` - The timer period, in milliseconds.
+
+ - ``callback`` - The callable to call upon expiration of the timer period.
+ The callback must take one argument, which is passed the Timer object.
+ The ``callback`` argument shall be specified. Otherwise an exception
+ will occurr upon timer expiration:
+ ``TypeError: 'NoneType' object isn't callable``
+
+.. method:: Timer.deinit()
+
+ Deinitialises the timer. Stops the timer, and disables the timer peripheral.
+
+Constants
+---------
+
+.. data:: Timer.ONE_SHOT
+ Timer.PERIODIC
+
+ Timer operating mode.
diff --git a/components/language/micropython/docs/library/machine.TimerWiPy.rst b/components/language/micropython/docs/library/machine.TimerWiPy.rst
new file mode 100644
index 00000000..f8c8bb29
--- /dev/null
+++ b/components/language/micropython/docs/library/machine.TimerWiPy.rst
@@ -0,0 +1,159 @@
+.. currentmodule:: machine
+.. _machine.TimerWiPy:
+
+class TimerWiPy -- control hardware timers
+==========================================
+
+.. note::
+
+ This class is a non-standard Timer implementation for the WiPy.
+ It is available simply as ``machine.Timer`` on the WiPy but is named in the
+ documentation below as ``machine.TimerWiPy`` to distinguish it from the
+ more general :ref:`machine.Timer ` class.
+
+Hardware timers deal with timing of periods and events. Timers are perhaps
+the most flexible and heterogeneous kind of hardware in MCUs and SoCs,
+differently greatly from a model to a model. MicroPython's Timer class
+defines a baseline operation of executing a callback with a given period
+(or once after some delay), and allow specific boards to define more
+non-standard behaviour (which thus won't be portable to other boards).
+
+See discussion of :ref:`important constraints ` on
+Timer callbacks.
+
+.. note::
+
+ Memory can't be allocated inside irq handlers (an interrupt) and so
+ exceptions raised within a handler don't give much information. See
+ :func:`micropython.alloc_emergency_exception_buf` for how to get around this
+ limitation.
+
+Constructors
+------------
+
+.. class:: TimerWiPy(id, ...)
+
+ Construct a new timer object of the given id. Id of -1 constructs a
+ virtual timer (if supported by a board).
+
+Methods
+-------
+
+.. method:: TimerWiPy.init(mode, *, width=16)
+
+ Initialise the timer. Example::
+
+ tim.init(Timer.PERIODIC) # periodic 16-bit timer
+ tim.init(Timer.ONE_SHOT, width=32) # one shot 32-bit timer
+
+ Keyword arguments:
+
+ - ``mode`` can be one of:
+
+ - ``TimerWiPy.ONE_SHOT`` - The timer runs once until the configured
+ period of the channel expires.
+ - ``TimerWiPy.PERIODIC`` - The timer runs periodically at the configured
+ frequency of the channel.
+ - ``TimerWiPy.PWM`` - Output a PWM signal on a pin.
+
+ - ``width`` must be either 16 or 32 (bits). For really low frequencies < 5Hz
+ (or large periods), 32-bit timers should be used. 32-bit mode is only available
+ for ``ONE_SHOT`` AND ``PERIODIC`` modes.
+
+.. method:: TimerWiPy.deinit()
+
+ Deinitialises the timer. Stops the timer, and disables the timer peripheral.
+
+.. method:: TimerWiPy.channel(channel, **, freq, period, polarity=TimerWiPy.POSITIVE, duty_cycle=0)
+
+ If only a channel identifier passed, then a previously initialized channel
+ object is returned (or ``None`` if there is no previous channel).
+
+ Otherwise, a TimerChannel object is initialized and returned.
+
+ The operating mode is is the one configured to the Timer object that was used to
+ create the channel.
+
+ - ``channel`` if the width of the timer is 16-bit, then must be either ``TIMER.A``, ``TIMER.B``.
+ If the width is 32-bit then it **must be** ``TIMER.A | TIMER.B``.
+
+ Keyword only arguments:
+
+ - ``freq`` sets the frequency in Hz.
+ - ``period`` sets the period in microseconds.
+
+ .. note::
+
+ Either ``freq`` or ``period`` must be given, never both.
+
+ - ``polarity`` this is applicable for ``PWM``, and defines the polarity of the duty cycle
+ - ``duty_cycle`` only applicable to ``PWM``. It's a percentage (0.00-100.00). Since the WiPy
+ doesn't support floating point numbers the duty cycle must be specified in the range 0-10000,
+ where 10000 would represent 100.00, 5050 represents 50.50, and so on.
+
+ .. note::
+
+ When the channel is in PWM mode, the corresponding pin is assigned automatically, therefore
+ there's no need to assign the alternate function of the pin via the ``Pin`` class. The pins which
+ support PWM functionality are the following:
+
+ - ``GP24`` on Timer 0 channel A.
+ - ``GP25`` on Timer 1 channel A.
+ - ``GP9`` on Timer 2 channel B.
+ - ``GP10`` on Timer 3 channel A.
+ - ``GP11`` on Timer 3 channel B.
+
+class TimerChannel --- setup a channel for a timer
+==================================================
+
+Timer channels are used to generate/capture a signal using a timer.
+
+TimerChannel objects are created using the Timer.channel() method.
+
+Methods
+-------
+
+.. method:: timerchannel.irq(*, trigger, priority=1, handler=None)
+
+ The behaviour of this callback is heavily dependent on the operating
+ mode of the timer channel:
+
+ - If mode is ``TimerWiPy.PERIODIC`` the callback is executed periodically
+ with the configured frequency or period.
+ - If mode is ``TimerWiPy.ONE_SHOT`` the callback is executed once when
+ the configured timer expires.
+ - If mode is ``TimerWiPy.PWM`` the callback is executed when reaching the duty
+ cycle value.
+
+ The accepted params are:
+
+ - ``priority`` level of the interrupt. Can take values in the range 1-7.
+ Higher values represent higher priorities.
+ - ``handler`` is an optional function to be called when the interrupt is triggered.
+ - ``trigger`` must be ``TimerWiPy.TIMEOUT`` when the operating mode is either ``TimerWiPy.PERIODIC`` or
+ ``TimerWiPy.ONE_SHOT``. In the case that mode is ``TimerWiPy.PWM`` then trigger must be equal to
+ ``TimerWiPy.MATCH``.
+
+ Returns a callback object.
+
+.. method:: timerchannel.freq([value])
+
+ Get or set the timer channel frequency (in Hz).
+
+.. method:: timerchannel.period([value])
+
+ Get or set the timer channel period (in microseconds).
+
+.. method:: timerchannel.duty_cycle([value])
+
+ Get or set the duty cycle of the PWM signal. It's a percentage (0.00-100.00). Since the WiPy
+ doesn't support floating point numbers the duty cycle must be specified in the range 0-10000,
+ where 10000 would represent 100.00, 5050 represents 50.50, and so on.
+
+Constants
+---------
+
+.. data:: TimerWiPy.ONE_SHOT
+.. data:: TimerWiPy.PERIODIC
+
+ Timer operating mode.
diff --git a/components/language/micropython/docs/library/machine.UART.rst b/components/language/micropython/docs/library/machine.UART.rst
new file mode 100644
index 00000000..e2395257
--- /dev/null
+++ b/components/language/micropython/docs/library/machine.UART.rst
@@ -0,0 +1,175 @@
+.. currentmodule:: machine
+.. _machine.UART:
+
+class UART -- duplex serial communication bus
+=============================================
+
+UART implements the standard UART/USART duplex serial communications protocol. At
+the physical level it consists of 2 lines: RX and TX. The unit of communication
+is a character (not to be confused with a string character) which can be 8 or 9
+bits wide.
+
+UART objects can be created and initialised using::
+
+ from machine import UART
+
+ uart = UART(1, 9600) # init with given baudrate
+ uart.init(9600, bits=8, parity=None, stop=1) # init with given parameters
+
+Supported parameters differ on a board:
+
+Pyboard: Bits can be 7, 8 or 9. Stop can be 1 or 2. With *parity=None*,
+only 8 and 9 bits are supported. With parity enabled, only 7 and 8 bits
+are supported.
+
+WiPy/CC3200: Bits can be 5, 6, 7, 8. Stop can be 1 or 2.
+
+A UART object acts like a `stream` object and reading and writing is done
+using the standard stream methods::
+
+ uart.read(10) # read 10 characters, returns a bytes object
+ uart.read() # read all available characters
+ uart.readline() # read a line
+ uart.readinto(buf) # read and store into the given buffer
+ uart.write('abc') # write the 3 characters
+
+Constructors
+------------
+
+.. class:: UART(id, ...)
+
+ Construct a UART object of the given id.
+
+Methods
+-------
+
+.. method:: UART.init(baudrate=9600, bits=8, parity=None, stop=1, *, ...)
+
+ Initialise the UART bus with the given parameters:
+
+ - *baudrate* is the clock rate.
+ - *bits* is the number of bits per character, 7, 8 or 9.
+ - *parity* is the parity, ``None``, 0 (even) or 1 (odd).
+ - *stop* is the number of stop bits, 1 or 2.
+
+ Additional keyword-only parameters that may be supported by a port are:
+
+ - *tx* specifies the TX pin to use.
+ - *rx* specifies the RX pin to use.
+ - *rts* specifies the RTS (output) pin to use for hardware receive flow control.
+ - *cts* specifies the CTS (input) pin to use for hardware transmit flow control.
+ - *txbuf* specifies the length in characters of the TX buffer.
+ - *rxbuf* specifies the length in characters of the RX buffer.
+ - *timeout* specifies the time to wait for the first character (in ms).
+ - *timeout_char* specifies the time to wait between characters (in ms).
+ - *invert* specifies which lines to invert.
+
+ - ``0`` will not invert lines (idle state of both lines is logic high).
+ - ``UART.INV_TX`` will invert TX line (idle state of TX line now logic low).
+ - ``UART.INV_RX`` will invert RX line (idle state of RX line now logic low).
+ - ``UART.INV_TX | UART.INV_RX`` will invert both lines (idle state at logic low).
+
+ - *flow* specifies which hardware flow control signals to use. The value
+ is a bitmask.
+
+ - ``0`` will ignore hardware flow control signals.
+ - ``UART.RTS`` will enable receive flow control by using the RTS output pin to
+ signal if the receive FIFO has sufficient space to accept more data.
+ - ``UART.CTS`` will enable transmit flow control by pausing transmission when the
+ CTS input pin signals that the receiver is running low on buffer space.
+ - ``UART.RTS | UART.CTS`` will enable both, for full hardware flow control.
+
+ On the WiPy only the following keyword-only parameter is supported:
+
+ - *pins* is a 4 or 2 item list indicating the TX, RX, RTS and CTS pins (in that order).
+ Any of the pins can be None if one wants the UART to operate with limited functionality.
+ If the RTS pin is given the the RX pin must be given as well. The same applies to CTS.
+ When no pins are given, then the default set of TX and RX pins is taken, and hardware
+ flow control will be disabled. If *pins* is ``None``, no pin assignment will be made.
+
+.. method:: UART.deinit()
+
+ Turn off the UART bus.
+
+.. method:: UART.any()
+
+ Returns an integer counting the number of characters that can be read without
+ blocking. It will return 0 if there are no characters available and a positive
+ number if there are characters. The method may return 1 even if there is more
+ than one character available for reading.
+
+ For more sophisticated querying of available characters use select.poll::
+
+ poll = select.poll()
+ poll.register(uart, select.POLLIN)
+ poll.poll(timeout)
+
+.. method:: UART.read([nbytes])
+
+ Read characters. If ``nbytes`` is specified then read at most that many bytes,
+ otherwise read as much data as possible. It may return sooner if a timeout
+ is reached. The timeout is configurable in the constructor.
+
+ Return value: a bytes object containing the bytes read in. Returns ``None``
+ on timeout.
+
+.. method:: UART.readinto(buf[, nbytes])
+
+ Read bytes into the ``buf``. If ``nbytes`` is specified then read at most
+ that many bytes. Otherwise, read at most ``len(buf)`` bytes. It may return sooner if a timeout
+ is reached. The timeout is configurable in the constructor.
+
+ Return value: number of bytes read and stored into ``buf`` or ``None`` on
+ timeout.
+
+.. method:: UART.readline()
+
+ Read a line, ending in a newline character. It may return sooner if a timeout
+ is reached. The timeout is configurable in the constructor.
+
+ Return value: the line read or ``None`` on timeout.
+
+.. method:: UART.write(buf)
+
+ Write the buffer of bytes to the bus.
+
+ Return value: number of bytes written or ``None`` on timeout.
+
+.. method:: UART.sendbreak()
+
+ Send a break condition on the bus. This drives the bus low for a duration
+ longer than required for a normal transmission of a character.
+
+.. method:: UART.irq(trigger, priority=1, handler=None, wake=machine.IDLE)
+
+ Create a callback to be triggered when data is received on the UART.
+
+ - *trigger* can only be ``UART.RX_ANY``
+ - *priority* level of the interrupt. Can take values in the range 1-7.
+ Higher values represent higher priorities.
+ - *handler* an optional function to be called when new characters arrive.
+ - *wake* can only be ``machine.IDLE``.
+
+ .. note::
+
+ The handler will be called whenever any of the following two conditions are met:
+
+ - 8 new characters have been received.
+ - At least 1 new character is waiting in the Rx buffer and the Rx line has been
+ silent for the duration of 1 complete frame.
+
+ This means that when the handler function is called there will be between 1 to 8
+ characters waiting.
+
+ Returns an irq object.
+
+ Availability: WiPy.
+
+Constants
+---------
+
+.. data:: UART.RX_ANY
+
+ IRQ trigger sources
+
+ Availability: WiPy.
diff --git a/components/language/micropython/docs/library/machine.WDT.rst b/components/language/micropython/docs/library/machine.WDT.rst
new file mode 100644
index 00000000..8c81e10e
--- /dev/null
+++ b/components/language/micropython/docs/library/machine.WDT.rst
@@ -0,0 +1,38 @@
+.. currentmodule:: machine
+.. _machine.WDT:
+
+class WDT -- watchdog timer
+===========================
+
+The WDT is used to restart the system when the application crashes and ends
+up into a non recoverable state. Once started it cannot be stopped or
+reconfigured in any way. After enabling, the application must "feed" the
+watchdog periodically to prevent it from expiring and resetting the system.
+
+Example usage::
+
+ from machine import WDT
+ wdt = WDT(timeout=2000) # enable it with a timeout of 2s
+ wdt.feed()
+
+Availability of this class: pyboard, WiPy, esp8266, esp32.
+
+Constructors
+------------
+
+.. class:: WDT(id=0, timeout=5000)
+
+ Create a WDT object and start it. The timeout must be given in milliseconds.
+ Once it is running the timeout cannot be changed and the WDT cannot be stopped either.
+
+ Notes: On the esp32 the minimum timeout is 1 second. On the esp8266 a timeout
+ cannot be specified, it is determined by the underlying system.
+
+Methods
+-------
+
+.. method:: WDT.feed()
+
+ Feed the WDT to prevent it from resetting the system. The application
+ should place this call in a sensible place ensuring that the WDT is
+ only fed after verifying that everything is functioning correctly.
diff --git a/components/language/micropython/docs/library/machine.rst b/components/language/micropython/docs/library/machine.rst
new file mode 100644
index 00000000..d66423d0
--- /dev/null
+++ b/components/language/micropython/docs/library/machine.rst
@@ -0,0 +1,212 @@
+:mod:`machine` --- functions related to the hardware
+====================================================
+
+.. module:: machine
+ :synopsis: functions related to the hardware
+
+The ``machine`` module contains specific functions related to the hardware
+on a particular board. Most functions in this module allow to achieve direct
+and unrestricted access to and control of hardware blocks on a system
+(like CPU, timers, buses, etc.). Used incorrectly, this can lead to
+malfunction, lockups, crashes of your board, and in extreme cases, hardware
+damage.
+
+.. _machine_callbacks:
+
+A note of callbacks used by functions and class methods of :mod:`machine` module:
+all these callbacks should be considered as executing in an interrupt context.
+This is true for both physical devices with IDs >= 0 and "virtual" devices
+with negative IDs like -1 (these "virtual" devices are still thin shims on
+top of real hardware and real hardware interrupts). See :ref:`isr_rules`.
+
+Reset related functions
+-----------------------
+
+.. function:: reset()
+
+ Resets the device in a manner similar to pushing the external RESET
+ button.
+
+.. function:: soft_reset()
+
+ Performs a soft reset of the interpreter, deleting all Python objects and
+ resetting the Python heap. It tries to retain the method by which the user
+ is connected to the MicroPython REPL (eg serial, USB, Wifi).
+
+.. function:: reset_cause()
+
+ Get the reset cause. See :ref:`constants ` for the possible return values.
+
+.. function:: bootloader([value])
+
+ Reset the device and enter its bootloader. This is typically used to put the
+ device into a state where it can be programmed with new firmware.
+
+ Some ports support passing in an optional *value* argument which can control
+ which bootloader to enter, what to pass to it, or other things.
+
+Interrupt related functions
+---------------------------
+
+.. function:: disable_irq()
+
+ Disable interrupt requests.
+ Returns the previous IRQ state which should be considered an opaque value.
+ This return value should be passed to the `enable_irq()` function to restore
+ interrupts to their original state, before `disable_irq()` was called.
+
+.. function:: enable_irq(state)
+
+ Re-enable interrupt requests.
+ The *state* parameter should be the value that was returned from the most
+ recent call to the `disable_irq()` function.
+
+Power related functions
+-----------------------
+
+.. function:: freq([hz])
+
+ Returns the CPU frequency in hertz.
+
+ On some ports this can also be used to set the CPU frequency by passing in *hz*.
+
+.. function:: idle()
+
+ Gates the clock to the CPU, useful to reduce power consumption at any time during
+ short or long periods. Peripherals continue working and execution resumes as soon
+ as any interrupt is triggered (on many ports this includes system timer
+ interrupt occurring at regular intervals on the order of millisecond).
+
+.. function:: sleep()
+
+ .. note:: This function is deprecated, use `lightsleep()` instead with no arguments.
+
+.. function:: lightsleep([time_ms])
+ deepsleep([time_ms])
+
+ Stops execution in an attempt to enter a low power state.
+
+ If *time_ms* is specified then this will be the maximum time in milliseconds that
+ the sleep will last for. Otherwise the sleep can last indefinitely.
+
+ With or without a timeout, execution may resume at any time if there are events
+ that require processing. Such events, or wake sources, should be configured before
+ sleeping, like `Pin` change or `RTC` timeout.
+
+ The precise behaviour and power-saving capabilities of lightsleep and deepsleep is
+ highly dependent on the underlying hardware, but the general properties are:
+
+ * A lightsleep has full RAM and state retention. Upon wake execution is resumed
+ from the point where the sleep was requested, with all subsystems operational.
+
+ * A deepsleep may not retain RAM or any other state of the system (for example
+ peripherals or network interfaces). Upon wake execution is resumed from the main
+ script, similar to a hard or power-on reset. The `reset_cause()` function will
+ return `machine.DEEPSLEEP` and this can be used to distinguish a deepsleep wake
+ from other resets.
+
+.. function:: wake_reason()
+
+ Get the wake reason. See :ref:`constants ` for the possible return values.
+
+ Availability: ESP32, WiPy.
+
+Miscellaneous functions
+-----------------------
+
+.. function:: unique_id()
+
+ Returns a byte string with a unique identifier of a board/SoC. It will vary
+ from a board/SoC instance to another, if underlying hardware allows. Length
+ varies by hardware (so use substring of a full value if you expect a short
+ ID). In some MicroPython ports, ID corresponds to the network MAC address.
+
+.. function:: time_pulse_us(pin, pulse_level, timeout_us=1000000, /)
+
+ Time a pulse on the given *pin*, and return the duration of the pulse in
+ microseconds. The *pulse_level* argument should be 0 to time a low pulse
+ or 1 to time a high pulse.
+
+ If the current input value of the pin is different to *pulse_level*,
+ the function first (*) waits until the pin input becomes equal to *pulse_level*,
+ then (**) times the duration that the pin is equal to *pulse_level*.
+ If the pin is already equal to *pulse_level* then timing starts straight away.
+
+ The function will return -2 if there was timeout waiting for condition marked
+ (*) above, and -1 if there was timeout during the main measurement, marked (**)
+ above. The timeout is the same for both cases and given by *timeout_us* (which
+ is in microseconds).
+
+.. function:: bitstream(pin, encoding, timing, data, /)
+
+ Transmits *data* by bit-banging the specified *pin*. The *encoding* argument
+ specifies how the bits are encoded, and *timing* is an encoding-specific timing
+ specification.
+
+ The supported encodings are:
+
+ - ``0`` for "high low" pulse duration modulation. This will transmit 0 and
+ 1 bits as timed pulses, starting with the most significant bit.
+ The *timing* must be a four-tuple of nanoseconds in the format
+ ``(high_time_0, low_time_0, high_time_1, low_time_1)``. For example,
+ ``(400, 850, 800, 450)`` is the timing specification for WS2812 RGB LEDs
+ at 800kHz.
+
+ The accuracy of the timing varies between ports. On Cortex M0 at 48MHz, it is
+ at best +/- 120ns, however on faster MCUs (ESP8266, ESP32, STM32, Pyboard), it
+ will be closer to +/-30ns.
+
+ .. note:: For controlling WS2812 / NeoPixel strips, see the :mod:`neopixel`
+ module for a higher-level API.
+
+.. function:: rng()
+
+ Return a 24-bit software generated random number.
+
+ Availability: WiPy.
+
+.. _machine_constants:
+
+Constants
+---------
+
+.. data:: machine.IDLE
+ machine.SLEEP
+ machine.DEEPSLEEP
+
+ IRQ wake values.
+
+.. data:: machine.PWRON_RESET
+ machine.HARD_RESET
+ machine.WDT_RESET
+ machine.DEEPSLEEP_RESET
+ machine.SOFT_RESET
+
+ Reset causes.
+
+.. data:: machine.WLAN_WAKE
+ machine.PIN_WAKE
+ machine.RTC_WAKE
+
+ Wake-up reasons.
+
+Classes
+-------
+
+.. toctree::
+ :maxdepth: 1
+
+ machine.Pin.rst
+ machine.Signal.rst
+ machine.ADC.rst
+ machine.ADCBlock.rst
+ machine.PWM.rst
+ machine.UART.rst
+ machine.SPI.rst
+ machine.I2C.rst
+ machine.I2S.rst
+ machine.RTC.rst
+ machine.Timer.rst
+ machine.WDT.rst
+ machine.SD.rst
+ machine.SDCard.rst
diff --git a/components/language/micropython/docs/library/math.rst b/components/language/micropython/docs/library/math.rst
new file mode 100644
index 00000000..a6f13d48
--- /dev/null
+++ b/components/language/micropython/docs/library/math.rst
@@ -0,0 +1,185 @@
+:mod:`math` -- mathematical functions
+=====================================
+
+.. module:: math
+ :synopsis: mathematical functions
+
+|see_cpython_module| :mod:`python:math`.
+
+The ``math`` module provides some basic mathematical functions for
+working with floating-point numbers.
+
+*Note:* On the pyboard, floating-point numbers have 32-bit precision.
+
+Availability: not available on WiPy. Floating point support required
+for this module.
+
+Functions
+---------
+
+.. function:: acos(x)
+
+ Return the inverse cosine of ``x``.
+
+.. function:: acosh(x)
+
+ Return the inverse hyperbolic cosine of ``x``.
+
+.. function:: asin(x)
+
+ Return the inverse sine of ``x``.
+
+.. function:: asinh(x)
+
+ Return the inverse hyperbolic sine of ``x``.
+
+.. function:: atan(x)
+
+ Return the inverse tangent of ``x``.
+
+.. function:: atan2(y, x)
+
+ Return the principal value of the inverse tangent of ``y/x``.
+
+.. function:: atanh(x)
+
+ Return the inverse hyperbolic tangent of ``x``.
+
+.. function:: ceil(x)
+
+ Return an integer, being ``x`` rounded towards positive infinity.
+
+.. function:: copysign(x, y)
+
+ Return ``x`` with the sign of ``y``.
+
+.. function:: cos(x)
+
+ Return the cosine of ``x``.
+
+.. function:: cosh(x)
+
+ Return the hyperbolic cosine of ``x``.
+
+.. function:: degrees(x)
+
+ Return radians ``x`` converted to degrees.
+
+.. function:: erf(x)
+
+ Return the error function of ``x``.
+
+.. function:: erfc(x)
+
+ Return the complementary error function of ``x``.
+
+.. function:: exp(x)
+
+ Return the exponential of ``x``.
+
+.. function:: expm1(x)
+
+ Return ``exp(x) - 1``.
+
+.. function:: fabs(x)
+
+ Return the absolute value of ``x``.
+
+.. function:: floor(x)
+
+ Return an integer, being ``x`` rounded towards negative infinity.
+
+.. function:: fmod(x, y)
+
+ Return the remainder of ``x/y``.
+
+.. function:: frexp(x)
+
+ Decomposes a floating-point number into its mantissa and exponent.
+ The returned value is the tuple ``(m, e)`` such that ``x == m * 2**e``
+ exactly. If ``x == 0`` then the function returns ``(0.0, 0)``, otherwise
+ the relation ``0.5 <= abs(m) < 1`` holds.
+
+.. function:: gamma(x)
+
+ Return the gamma function of ``x``.
+
+.. function:: isfinite(x)
+
+ Return ``True`` if ``x`` is finite.
+
+.. function:: isinf(x)
+
+ Return ``True`` if ``x`` is infinite.
+
+.. function:: isnan(x)
+
+ Return ``True`` if ``x`` is not-a-number
+
+.. function:: ldexp(x, exp)
+
+ Return ``x * (2**exp)``.
+
+.. function:: lgamma(x)
+
+ Return the natural logarithm of the gamma function of ``x``.
+
+.. function:: log(x)
+
+ Return the natural logarithm of ``x``.
+
+.. function:: log10(x)
+
+ Return the base-10 logarithm of ``x``.
+
+.. function:: log2(x)
+
+ Return the base-2 logarithm of ``x``.
+
+.. function:: modf(x)
+
+ Return a tuple of two floats, being the fractional and integral parts of
+ ``x``. Both return values have the same sign as ``x``.
+
+.. function:: pow(x, y)
+
+ Returns ``x`` to the power of ``y``.
+
+.. function:: radians(x)
+
+ Return degrees ``x`` converted to radians.
+
+.. function:: sin(x)
+
+ Return the sine of ``x``.
+
+.. function:: sinh(x)
+
+ Return the hyperbolic sine of ``x``.
+
+.. function:: sqrt(x)
+
+ Return the square root of ``x``.
+
+.. function:: tan(x)
+
+ Return the tangent of ``x``.
+
+.. function:: tanh(x)
+
+ Return the hyperbolic tangent of ``x``.
+
+.. function:: trunc(x)
+
+ Return an integer, being ``x`` rounded towards 0.
+
+Constants
+---------
+
+.. data:: e
+
+ base of the natural logarithm
+
+.. data:: pi
+
+ the ratio of a circle's circumference to its diameter
diff --git a/components/language/micropython/docs/library/micropython.rst b/components/language/micropython/docs/library/micropython.rst
new file mode 100644
index 00000000..7106a1a2
--- /dev/null
+++ b/components/language/micropython/docs/library/micropython.rst
@@ -0,0 +1,149 @@
+:mod:`micropython` -- access and control MicroPython internals
+==============================================================
+
+.. module:: micropython
+ :synopsis: access and control MicroPython internals
+
+Functions
+---------
+
+.. function:: const(expr)
+
+ Used to declare that the expression is a constant so that the compile can
+ optimise it. The use of this function should be as follows::
+
+ from micropython import const
+
+ CONST_X = const(123)
+ CONST_Y = const(2 * CONST_X + 1)
+
+ Constants declared this way are still accessible as global variables from
+ outside the module they are declared in. On the other hand, if a constant
+ begins with an underscore then it is hidden, it is not available as a global
+ variable, and does not take up any memory during execution.
+
+ This `const` function is recognised directly by the MicroPython parser and is
+ provided as part of the :mod:`micropython` module mainly so that scripts can be
+ written which run under both CPython and MicroPython, by following the above
+ pattern.
+
+.. function:: opt_level([level])
+
+ If *level* is given then this function sets the optimisation level for subsequent
+ compilation of scripts, and returns ``None``. Otherwise it returns the current
+ optimisation level.
+
+ The optimisation level controls the following compilation features:
+
+ - Assertions: at level 0 assertion statements are enabled and compiled into the
+ bytecode; at levels 1 and higher assertions are not compiled.
+ - Built-in ``__debug__`` variable: at level 0 this variable expands to ``True``;
+ at levels 1 and higher it expands to ``False``.
+ - Source-code line numbers: at levels 0, 1 and 2 source-code line number are
+ stored along with the bytecode so that exceptions can report the line number
+ they occurred at; at levels 3 and higher line numbers are not stored.
+
+ The default optimisation level is usually level 0.
+
+.. function:: alloc_emergency_exception_buf(size)
+
+ Allocate *size* bytes of RAM for the emergency exception buffer (a good
+ size is around 100 bytes). The buffer is used to create exceptions in cases
+ when normal RAM allocation would fail (eg within an interrupt handler) and
+ therefore give useful traceback information in these situations.
+
+ A good way to use this function is to put it at the start of your main script
+ (eg ``boot.py`` or ``main.py``) and then the emergency exception buffer will be active
+ for all the code following it.
+
+.. function:: mem_info([verbose])
+
+ Print information about currently used memory. If the *verbose* argument
+ is given then extra information is printed.
+
+ The information that is printed is implementation dependent, but currently
+ includes the amount of stack and heap used. In verbose mode it prints out
+ the entire heap indicating which blocks are used and which are free.
+
+.. function:: qstr_info([verbose])
+
+ Print information about currently interned strings. If the *verbose*
+ argument is given then extra information is printed.
+
+ The information that is printed is implementation dependent, but currently
+ includes the number of interned strings and the amount of RAM they use. In
+ verbose mode it prints out the names of all RAM-interned strings.
+
+.. function:: stack_use()
+
+ Return an integer representing the current amount of stack that is being
+ used. The absolute value of this is not particularly useful, rather it
+ should be used to compute differences in stack usage at different points.
+
+.. function:: heap_lock()
+.. function:: heap_unlock()
+.. function:: heap_locked()
+
+ Lock or unlock the heap. When locked no memory allocation can occur and a
+ `MemoryError` will be raised if any heap allocation is attempted.
+ `heap_locked()` returns a true value if the heap is currently locked.
+
+ These functions can be nested, ie `heap_lock()` can be called multiple times
+ in a row and the lock-depth will increase, and then `heap_unlock()` must be
+ called the same number of times to make the heap available again.
+
+ Both `heap_unlock()` and `heap_locked()` return the current lock depth
+ (after unlocking for the former) as a non-negative integer, with 0 meaning
+ the heap is not locked.
+
+ If the REPL becomes active with the heap locked then it will be forcefully
+ unlocked.
+
+ Note: `heap_locked()` is not enabled on most ports by default,
+ requires ``MICROPY_PY_MICROPYTHON_HEAP_LOCKED``.
+
+.. function:: kbd_intr(chr)
+
+ Set the character that will raise a `KeyboardInterrupt` exception. By
+ default this is set to 3 during script execution, corresponding to Ctrl-C.
+ Passing -1 to this function will disable capture of Ctrl-C, and passing 3
+ will restore it.
+
+ This function can be used to prevent the capturing of Ctrl-C on the
+ incoming stream of characters that is usually used for the REPL, in case
+ that stream is used for other purposes.
+
+.. function:: schedule(func, arg)
+
+ Schedule the function *func* to be executed "very soon". The function
+ is passed the value *arg* as its single argument. "Very soon" means that
+ the MicroPython runtime will do its best to execute the function at the
+ earliest possible time, given that it is also trying to be efficient, and
+ that the following conditions hold:
+
+ - A scheduled function will never preempt another scheduled function.
+ - Scheduled functions are always executed "between opcodes" which means
+ that all fundamental Python operations (such as appending to a list)
+ are guaranteed to be atomic.
+ - A given port may define "critical regions" within which scheduled
+ functions will never be executed. Functions may be scheduled within
+ a critical region but they will not be executed until that region
+ is exited. An example of a critical region is a preempting interrupt
+ handler (an IRQ).
+
+ A use for this function is to schedule a callback from a preempting IRQ.
+ Such an IRQ puts restrictions on the code that runs in the IRQ (for example
+ the heap may be locked) and scheduling a function to call later will lift
+ those restrictions.
+
+ Note: If `schedule()` is called from a preempting IRQ, when memory
+ allocation is not allowed and the callback to be passed to `schedule()` is
+ a bound method, passing this directly will fail. This is because creating a
+ reference to a bound method causes memory allocation. A solution is to
+ create a reference to the method in the class constructor and to pass that
+ reference to `schedule()`. This is discussed in detail here
+ :ref:`reference documentation ` under "Creation of Python
+ objects".
+
+ There is a finite queue to hold the scheduled functions and `schedule()`
+ will raise a `RuntimeError` if the queue is full.
diff --git a/components/language/micropython/docs/library/neopixel.rst b/components/language/micropython/docs/library/neopixel.rst
new file mode 100644
index 00000000..1b37f088
--- /dev/null
+++ b/components/language/micropython/docs/library/neopixel.rst
@@ -0,0 +1,73 @@
+:mod:`neopixel` --- control of WS2812 / NeoPixel LEDs
+=====================================================
+
+.. module:: neopixel
+ :synopsis: control of WS2812 / NeoPixel LEDs
+
+This module provides a driver for WS2818 / NeoPixel LEDs.
+
+.. note:: This module is only included by default on the ESP8266 and ESP32
+ ports. On STM32 / Pyboard, you can `download the module
+ `_
+ and copy it to the filesystem.
+
+class NeoPixel
+--------------
+
+This class stores pixel data for a WS2812 LED strip connected to a pin. The
+application should set pixel data and then call :meth:`NeoPixel.write`
+when it is ready to update the strip.
+
+For example::
+
+ import neopixel
+
+ # 32 LED strip connected to X8.
+ p = machine.Pin.board.X8
+ n = neopixel.NeoPixel(p, 32)
+
+ # Draw a red gradient.
+ for i in range(32):
+ n[i] = (i * 8, 0, 0)
+
+ # Update the strip.
+ n.write()
+
+Constructors
+------------
+
+.. class:: NeoPixel(pin, n, *, bpp=3, timing=1)
+
+ Construct an NeoPixel object. The parameters are:
+
+ - *pin* is a machine.Pin instance.
+ - *n* is the number of LEDs in the strip.
+ - *bpp* is 3 for RGB LEDs, and 4 for RGBW LEDs.
+ - *timing* is 0 for 400KHz, and 1 for 800kHz LEDs (most are 800kHz).
+
+Pixel access methods
+--------------------
+
+.. method:: NeoPixel.fill(pixel)
+
+ Sets the value of all pixels to the specified *pixel* value (i.e. an
+ RGB/RGBW tuple).
+
+.. method:: NeoPixel.__len__()
+
+ Returns the number of LEDs in the strip.
+
+.. method:: NeoPixel.__setitem__(index, val)
+
+ Set the pixel at *index* to the value, which is an RGB/RGBW tuple.
+
+.. method:: NeoPixel.__getitem__(index)
+
+ Returns the pixel at *index* as an RGB/RGBW tuple.
+
+Output methods
+--------------
+
+.. method:: NeoPixel.write()
+
+ Writes the current pixel data to the strip.
diff --git a/components/language/micropython/docs/library/network.CC3K.rst b/components/language/micropython/docs/library/network.CC3K.rst
new file mode 100644
index 00000000..41d3fb43
--- /dev/null
+++ b/components/language/micropython/docs/library/network.CC3K.rst
@@ -0,0 +1,89 @@
+.. currentmodule:: network
+.. _network.CC3K:
+
+class CC3K -- control CC3000 WiFi modules
+=========================================
+
+This class provides a driver for CC3000 WiFi modules. Example usage::
+
+ import network
+ nic = network.CC3K(pyb.SPI(2), pyb.Pin.board.Y5, pyb.Pin.board.Y4, pyb.Pin.board.Y3)
+ nic.connect('your-ssid', 'your-password')
+ while not nic.isconnected():
+ pyb.delay(50)
+ print(nic.ifconfig())
+
+ # now use socket as usual
+ ...
+
+For this example to work the CC3000 module must have the following connections:
+
+ - MOSI connected to Y8
+ - MISO connected to Y7
+ - CLK connected to Y6
+ - CS connected to Y5
+ - VBEN connected to Y4
+ - IRQ connected to Y3
+
+It is possible to use other SPI buses and other pins for CS, VBEN and IRQ.
+
+Constructors
+------------
+
+.. class:: CC3K(spi, pin_cs, pin_en, pin_irq)
+
+ Create a CC3K driver object, initialise the CC3000 module using the given SPI bus
+ and pins, and return the CC3K object.
+
+ Arguments are:
+
+ - *spi* is an :ref:`SPI object ` which is the SPI bus that the CC3000 is
+ connected to (the MOSI, MISO and CLK pins).
+ - *pin_cs* is a :ref:`Pin object ` which is connected to the CC3000 CS pin.
+ - *pin_en* is a :ref:`Pin object ` which is connected to the CC3000 VBEN pin.
+ - *pin_irq* is a :ref:`Pin object ` which is connected to the CC3000 IRQ pin.
+
+ All of these objects will be initialised by the driver, so there is no need to
+ initialise them yourself. For example, you can use::
+
+ nic = network.CC3K(pyb.SPI(2), pyb.Pin.board.Y5, pyb.Pin.board.Y4, pyb.Pin.board.Y3)
+
+Methods
+-------
+
+.. method:: CC3K.connect(ssid, key=None, *, security=WPA2, bssid=None)
+
+ Connect to a WiFi access point using the given SSID, and other security
+ parameters.
+
+.. method:: CC3K.disconnect()
+
+ Disconnect from the WiFi access point.
+
+.. method:: CC3K.isconnected()
+
+ Returns True if connected to a WiFi access point and has a valid IP address,
+ False otherwise.
+
+.. method:: CC3K.ifconfig()
+
+ Returns a 7-tuple with (ip, subnet mask, gateway, DNS server, DHCP server,
+ MAC address, SSID).
+
+.. method:: CC3K.patch_version()
+
+ Return the version of the patch program (firmware) on the CC3000.
+
+.. method:: CC3K.patch_program('pgm')
+
+ Upload the current firmware to the CC3000. You must pass 'pgm' as the first
+ argument in order for the upload to proceed.
+
+Constants
+---------
+
+.. data:: CC3K.WEP
+.. data:: CC3K.WPA
+.. data:: CC3K.WPA2
+
+ security type to use
diff --git a/components/language/micropython/docs/library/network.LAN.rst b/components/language/micropython/docs/library/network.LAN.rst
new file mode 100644
index 00000000..58bd61eb
--- /dev/null
+++ b/components/language/micropython/docs/library/network.LAN.rst
@@ -0,0 +1,93 @@
+.. currentmodule:: network
+.. _network.LAN:
+
+class LAN -- control an Ethernet module
+=======================================
+
+This class allows you to control the Ethernet interface. The PHY hardware type is board-specific.
+
+Example usage::
+
+ import network
+ nic = network.LAN(0)
+ print(nic.ifconfig())
+
+ # now use socket as usual
+ ...
+
+
+Constructors
+------------
+
+.. class:: LAN(id, *, phy_type=, phy_addr=, phy_clock=)
+
+ Create a LAN driver object, initialise the LAN module using the given
+ PHY driver name, and return the LAN object.
+
+ Arguments are:
+
+ - *id* is the number of the Ethernet port, either 0 or 1.
+ - *phy_type* is the name of the PHY driver. For most board the on-board PHY has to be used and
+ is the default. Suitable values are port specific.
+ - *phy_addr* specifies the address of the PHY interface. As with *phy_type*, the hardwired value has
+ to be used for most boards and that value is the default.
+ - *phy_clock* specifies, whether the data clock is provided by the Ethernet controller or the PYH interface.
+ The default value is the one that matches the board. If set to ``True``, the clock is driven by the
+ Ethernet controller, otherwise by the PHY interface.
+
+ For example, with the Seeed Arch Mix board you can use::
+
+ nic = LAN(0, phy_type=LAN.PHY_LAN8720, phy_addr=2, phy_clock=False)
+
+Methods
+-------
+
+.. method:: LAN.active([state])
+
+ With a parameter, it sets the interface active if *state* is true, otherwise it
+ sets it inactive.
+ Without a parameter, it returns the state.
+
+.. method:: LAN.isconnected()
+
+ Returns ``True`` if the physical Ethernet link is connected and up.
+ Returns ``False`` otherwise.
+
+.. method:: LAN.status()
+
+ Returns the LAN status.
+
+.. method:: LAN.ifconfig([(ip, subnet, gateway, dns)])
+
+ Get/set IP address, subnet mask, gateway and DNS.
+
+ When called with no arguments, this method returns a 4-tuple with the above information.
+
+ To set the above values, pass a 4-tuple with the required information. For example::
+
+ nic.ifconfig(('192.168.0.4', '255.255.255.0', '192.168.0.1', '8.8.8.8'))
+
+.. method:: LAN.config(config_parameters)
+
+ Sets or gets parameters of the LAN interface. The only parameter that can be
+ retrieved is the MAC address, using::
+
+ mac = LAN.config("mac")
+
+ The parameters that can be set are:
+
+ - ``trace=n`` sets trace levels; suitable values are:
+
+ - 2: trace TX
+ - 4: trace RX
+ - 8: full trace
+
+ - ``low_power=bool`` sets or clears low power mode, valid values being ``False``
+ or ``True``.
+
+
+Specific LAN class implementations
+----------------------------------
+
+On the mimxrt port, suitable values for the *phy_type* constructor argument are:
+``PHY_KSZ8081``, ``PHY_DP83825``, ``PHY_DP83848``, ``PHY_LAN8720``, ``PHY_RTL8211F``.
diff --git a/components/language/micropython/docs/library/network.WIZNET5K.rst b/components/language/micropython/docs/library/network.WIZNET5K.rst
new file mode 100644
index 00000000..c13d43a3
--- /dev/null
+++ b/components/language/micropython/docs/library/network.WIZNET5K.rst
@@ -0,0 +1,71 @@
+.. currentmodule:: network
+.. _network.WIZNET5K:
+
+class WIZNET5K -- control WIZnet5x00 Ethernet modules
+=====================================================
+
+This class allows you to control WIZnet5x00 Ethernet adaptors based on
+the W5200 and W5500 chipsets. The particular chipset that is supported
+by the firmware is selected at compile-time via the MICROPY_PY_NETWORK_WIZNET5K
+option.
+
+Example usage::
+
+ import network
+ nic = network.WIZNET5K(pyb.SPI(1), pyb.Pin.board.X5, pyb.Pin.board.X4)
+ print(nic.ifconfig())
+
+ # now use socket as usual
+ ...
+
+For this example to work the WIZnet5x00 module must have the following connections:
+
+ - MOSI connected to X8
+ - MISO connected to X7
+ - SCLK connected to X6
+ - nSS connected to X5
+ - nRESET connected to X4
+
+It is possible to use other SPI buses and other pins for nSS and nRESET.
+
+Constructors
+------------
+
+.. class:: WIZNET5K(spi, pin_cs, pin_rst)
+
+ Create a WIZNET5K driver object, initialise the WIZnet5x00 module using the given
+ SPI bus and pins, and return the WIZNET5K object.
+
+ Arguments are:
+
+ - *spi* is an :ref:`SPI object ` which is the SPI bus that the WIZnet5x00 is
+ connected to (the MOSI, MISO and SCLK pins).
+ - *pin_cs* is a :ref:`Pin object ` which is connected to the WIZnet5x00 nSS pin.
+ - *pin_rst* is a :ref:`Pin object ` which is connected to the WIZnet5x00 nRESET pin.
+
+ All of these objects will be initialised by the driver, so there is no need to
+ initialise them yourself. For example, you can use::
+
+ nic = network.WIZNET5K(pyb.SPI(1), pyb.Pin.board.X5, pyb.Pin.board.X4)
+
+Methods
+-------
+
+.. method:: WIZNET5K.isconnected()
+
+ Returns ``True`` if the physical Ethernet link is connected and up.
+ Returns ``False`` otherwise.
+
+.. method:: WIZNET5K.ifconfig([(ip, subnet, gateway, dns)])
+
+ Get/set IP address, subnet mask, gateway and DNS.
+
+ When called with no arguments, this method returns a 4-tuple with the above information.
+
+ To set the above values, pass a 4-tuple with the required information. For example::
+
+ nic.ifconfig(('192.168.0.4', '255.255.255.0', '192.168.0.1', '8.8.8.8'))
+
+.. method:: WIZNET5K.regs()
+
+ Dump the WIZnet5x00 registers. Useful for debugging.
diff --git a/components/language/micropython/docs/library/network.WLAN.rst b/components/language/micropython/docs/library/network.WLAN.rst
new file mode 100644
index 00000000..274681f1
--- /dev/null
+++ b/components/language/micropython/docs/library/network.WLAN.rst
@@ -0,0 +1,136 @@
+.. currentmodule:: network
+.. _network.WLAN:
+
+class WLAN -- control built-in WiFi interfaces
+==============================================
+
+This class provides a driver for WiFi network processors. Example usage::
+
+ import network
+ # enable station interface and connect to WiFi access point
+ nic = network.WLAN(network.STA_IF)
+ nic.active(True)
+ nic.connect('your-ssid', 'your-password')
+ # now use sockets as usual
+
+Constructors
+------------
+.. class:: WLAN(interface_id)
+
+Create a WLAN network interface object. Supported interfaces are
+``network.STA_IF`` (station aka client, connects to upstream WiFi access
+points) and ``network.AP_IF`` (access point, allows other WiFi clients to
+connect). Availability of the methods below depends on interface type.
+For example, only STA interface may `WLAN.connect()` to an access point.
+
+Methods
+-------
+
+.. method:: WLAN.active([is_active])
+
+ Activate ("up") or deactivate ("down") network interface, if boolean
+ argument is passed. Otherwise, query current state if no argument is
+ provided. Most other methods require active interface.
+
+.. method:: WLAN.connect(ssid=None, password=None, *, bssid=None)
+
+ Connect to the specified wireless network, using the specified password.
+ If *bssid* is given then the connection will be restricted to the
+ access-point with that MAC address (the *ssid* must also be specified
+ in this case).
+
+.. method:: WLAN.disconnect()
+
+ Disconnect from the currently connected wireless network.
+
+.. method:: WLAN.scan()
+
+ Scan for the available wireless networks.
+ Hidden networks -- where the SSID is not broadcast -- will also be scanned
+ if the WLAN interface allows it.
+
+ Scanning is only possible on STA interface. Returns list of tuples with
+ the information about WiFi access points:
+
+ (ssid, bssid, channel, RSSI, authmode, hidden)
+
+ *bssid* is hardware address of an access point, in binary form, returned as
+ bytes object. You can use `binascii.hexlify()` to convert it to ASCII form.
+
+ There are five values for authmode:
+
+ * 0 -- open
+ * 1 -- WEP
+ * 2 -- WPA-PSK
+ * 3 -- WPA2-PSK
+ * 4 -- WPA/WPA2-PSK
+
+ and two for hidden:
+
+ * 0 -- visible
+ * 1 -- hidden
+
+.. method:: WLAN.status([param])
+
+ Return the current status of the wireless connection.
+
+ When called with no argument the return value describes the network link status.
+ The possible statuses are defined as constants:
+
+ * ``STAT_IDLE`` -- no connection and no activity,
+ * ``STAT_CONNECTING`` -- connecting in progress,
+ * ``STAT_WRONG_PASSWORD`` -- failed due to incorrect password,
+ * ``STAT_NO_AP_FOUND`` -- failed because no access point replied,
+ * ``STAT_CONNECT_FAIL`` -- failed due to other problems,
+ * ``STAT_GOT_IP`` -- connection successful.
+
+ When called with one argument *param* should be a string naming the status
+ parameter to retrieve. Supported parameters in WiFI STA mode are: ``'rssi'``.
+
+.. method:: WLAN.isconnected()
+
+ In case of STA mode, returns ``True`` if connected to a WiFi access
+ point and has a valid IP address. In AP mode returns ``True`` when a
+ station is connected. Returns ``False`` otherwise.
+
+.. method:: WLAN.ifconfig([(ip, subnet, gateway, dns)])
+
+ Get/set IP-level network interface parameters: IP address, subnet mask,
+ gateway and DNS server. When called with no arguments, this method returns
+ a 4-tuple with the above information. To set the above values, pass a
+ 4-tuple with the required information. For example::
+
+ nic.ifconfig(('192.168.0.4', '255.255.255.0', '192.168.0.1', '8.8.8.8'))
+
+.. method:: WLAN.config('param')
+ WLAN.config(param=value, ...)
+
+ Get or set general network interface parameters. These methods allow to work
+ with additional parameters beyond standard IP configuration (as dealt with by
+ `WLAN.ifconfig()`). These include network-specific and hardware-specific
+ parameters. For setting parameters, keyword argument syntax should be used,
+ multiple parameters can be set at once. For querying, parameters name should
+ be quoted as a string, and only one parameter can be queries at time::
+
+ # Set WiFi access point name (formally known as ESSID) and WiFi channel
+ ap.config(essid='My AP', channel=11)
+ # Query params one by one
+ print(ap.config('essid'))
+ print(ap.config('channel'))
+
+ Following are commonly supported parameters (availability of a specific parameter
+ depends on network technology type, driver, and :term:`MicroPython port`).
+
+ ============= ===========
+ Parameter Description
+ ============= ===========
+ mac MAC address (bytes)
+ essid WiFi access point name (string)
+ channel WiFi channel (integer)
+ hidden Whether ESSID is hidden (boolean)
+ authmode Authentication mode supported (enumeration, see module constants)
+ password Access password (string)
+ dhcp_hostname The DHCP hostname to use
+ reconnects Number of reconnect attempts to make (integer, 0=none, -1=unlimited)
+ txpower Maximum transmit power in dBm (integer or float)
+ ============= ===========
diff --git a/components/language/micropython/docs/library/network.WLANWiPy.rst b/components/language/micropython/docs/library/network.WLANWiPy.rst
new file mode 100644
index 00000000..2a5ba118
--- /dev/null
+++ b/components/language/micropython/docs/library/network.WLANWiPy.rst
@@ -0,0 +1,161 @@
+.. currentmodule:: network
+.. _network.WLANWiPy:
+
+class WLANWiPy -- WiPy specific WiFi control
+============================================
+
+.. note::
+
+ This class is a non-standard WLAN implementation for the WiPy.
+ It is available simply as ``network.WLAN`` on the WiPy but is named in the
+ documentation below as ``network.WLANWiPy`` to distinguish it from the
+ more general :ref:`network.WLAN ` class.
+
+This class provides a driver for the WiFi network processor in the WiPy. Example usage::
+
+ import network
+ import time
+ # setup as a station
+ wlan = network.WLAN(mode=WLAN.STA)
+ wlan.connect('your-ssid', auth=(WLAN.WPA2, 'your-key'))
+ while not wlan.isconnected():
+ time.sleep_ms(50)
+ print(wlan.ifconfig())
+
+ # now use socket as usual
+ ...
+
+Constructors
+------------
+
+.. class:: WLANWiPy(id=0, ...)
+
+ Create a WLAN object, and optionally configure it. See `init()` for params of configuration.
+
+.. note::
+
+ The ``WLAN`` constructor is special in the sense that if no arguments besides the id are given,
+ it will return the already existing ``WLAN`` instance without re-configuring it. This is
+ because ``WLAN`` is a system feature of the WiPy. If the already existing instance is not
+ initialized it will do the same as the other constructors an will initialize it with default
+ values.
+
+Methods
+-------
+
+.. method:: WLANWiPy.init(mode, *, ssid, auth, channel, antenna)
+
+ Set or get the WiFi network processor configuration.
+
+ Arguments are:
+
+ - *mode* can be either ``WLAN.STA`` or ``WLAN.AP``.
+ - *ssid* is a string with the ssid name. Only needed when mode is ``WLAN.AP``.
+ - *auth* is a tuple with (sec, key). Security can be ``None``, ``WLAN.WEP``,
+ ``WLAN.WPA`` or ``WLAN.WPA2``. The key is a string with the network password.
+ If ``sec`` is ``WLAN.WEP`` the key must be a string representing hexadecimal
+ values (e.g. 'ABC1DE45BF'). Only needed when mode is ``WLAN.AP``.
+ - *channel* a number in the range 1-11. Only needed when mode is ``WLAN.AP``.
+ - *antenna* selects between the internal and the external antenna. Can be either
+ ``WLAN.INT_ANT`` or ``WLAN.EXT_ANT``.
+
+ For example, you can do::
+
+ # create and configure as an access point
+ wlan.init(mode=WLAN.AP, ssid='wipy-wlan', auth=(WLAN.WPA2,'www.wipy.io'), channel=7, antenna=WLAN.INT_ANT)
+
+ or::
+
+ # configure as an station
+ wlan.init(mode=WLAN.STA)
+
+.. method:: WLANWiPy.connect(ssid, *, auth=None, bssid=None, timeout=None)
+
+ Connect to a WiFi access point using the given SSID, and other security
+ parameters.
+
+ - *auth* is a tuple with (sec, key). Security can be ``None``, ``WLAN.WEP``,
+ ``WLAN.WPA`` or ``WLAN.WPA2``. The key is a string with the network password.
+ If ``sec`` is ``WLAN.WEP`` the key must be a string representing hexadecimal
+ values (e.g. 'ABC1DE45BF').
+ - *bssid* is the MAC address of the AP to connect to. Useful when there are several
+ APs with the same ssid.
+ - *timeout* is the maximum time in milliseconds to wait for the connection to succeed.
+
+.. method:: WLANWiPy.scan()
+
+ Performs a network scan and returns a list of named tuples with (ssid, bssid, sec, channel, rssi).
+ Note that channel is always ``None`` since this info is not provided by the WiPy.
+
+.. method:: WLANWiPy.disconnect()
+
+ Disconnect from the WiFi access point.
+
+.. method:: WLANWiPy.isconnected()
+
+ In case of STA mode, returns ``True`` if connected to a WiFi access point and has a valid IP address.
+ In AP mode returns ``True`` when a station is connected, ``False`` otherwise.
+
+.. method:: WLANWiPy.ifconfig(if_id=0, config=['dhcp' or configtuple])
+
+ With no parameters given returns a 4-tuple of *(ip, subnet_mask, gateway, DNS_server)*.
+
+ if ``'dhcp'`` is passed as a parameter then the DHCP client is enabled and the IP params
+ are negotiated with the AP.
+
+ If the 4-tuple config is given then a static IP is configured. For instance::
+
+ wlan.ifconfig(config=('192.168.0.4', '255.255.255.0', '192.168.0.1', '8.8.8.8'))
+
+.. method:: WLANWiPy.mode([mode])
+
+ Get or set the WLAN mode.
+
+.. method:: WLANWiPy.ssid([ssid])
+
+ Get or set the SSID when in AP mode.
+
+.. method:: WLANWiPy.auth([auth])
+
+ Get or set the authentication type when in AP mode.
+
+.. method:: WLANWiPy.channel([channel])
+
+ Get or set the channel (only applicable in AP mode).
+
+.. method:: WLANWiPy.antenna([antenna])
+
+ Get or set the antenna type (external or internal).
+
+.. method:: WLANWiPy.mac([mac_addr])
+
+ Get or set a 6-byte long bytes object with the MAC address.
+
+.. method:: WLANWiPy.irq(*, handler, wake)
+
+ Create a callback to be triggered when a WLAN event occurs during ``machine.SLEEP``
+ mode. Events are triggered by socket activity or by WLAN connection/disconnection.
+
+ - *handler* is the function that gets called when the IRQ is triggered.
+ - *wake* must be ``machine.SLEEP``.
+
+ Returns an IRQ object.
+
+Constants
+---------
+
+.. data:: WLANWiPy.STA
+.. data:: WLANWiPy.AP
+
+ selects the WLAN mode
+
+.. data:: WLANWiPy.WEP
+.. data:: WLANWiPy.WPA
+.. data:: WLANWiPy.WPA2
+
+ selects the network security
+
+.. data:: WLANWiPy.INT_ANT
+.. data:: WLANWiPy.EXT_ANT
+
+ selects the antenna type
diff --git a/components/language/micropython/docs/library/network.rst b/components/language/micropython/docs/library/network.rst
new file mode 100644
index 00000000..361e664b
--- /dev/null
+++ b/components/language/micropython/docs/library/network.rst
@@ -0,0 +1,174 @@
+****************************************
+:mod:`network` --- network configuration
+****************************************
+
+.. module:: network
+ :synopsis: network configuration
+
+This module provides network drivers and routing configuration. To use this
+module, a MicroPython variant/build with network capabilities must be installed.
+Network drivers for specific hardware are available within this module and are
+used to configure hardware network interface(s). Network services provided
+by configured interfaces are then available for use via the :mod:`socket`
+module.
+
+For example::
+
+ # connect/ show IP config a specific network interface
+ # see below for examples of specific drivers
+ import network
+ import time
+ nic = network.Driver(...)
+ if not nic.isconnected():
+ nic.connect()
+ print("Waiting for connection...")
+ while not nic.isconnected():
+ time.sleep(1)
+ print(nic.ifconfig())
+
+ # now use socket as usual
+ import socket
+ addr = socket.getaddrinfo('micropython.org', 80)[0][-1]
+ s = socket.socket()
+ s.connect(addr)
+ s.send(b'GET / HTTP/1.1\r\nHost: micropython.org\r\n\r\n')
+ data = s.recv(1000)
+ s.close()
+
+Common network adapter interface
+================================
+
+This section describes an (implied) abstract base class for all network
+interface classes implemented by :term:`MicroPython ports `
+for different hardware. This means that MicroPython does not actually
+provide ``AbstractNIC`` class, but any actual NIC class, as described
+in the following sections, implements methods as described here.
+
+.. class:: AbstractNIC(id=None, ...)
+
+Instantiate a network interface object. Parameters are network interface
+dependent. If there are more than one interface of the same type, the first
+parameter should be `id`.
+
+.. method:: AbstractNIC.active([is_active])
+
+ Activate ("up") or deactivate ("down") the network interface, if
+ a boolean argument is passed. Otherwise, query current state if
+ no argument is provided. Most other methods require an active
+ interface (behaviour of calling them on inactive interface is
+ undefined).
+
+.. method:: AbstractNIC.connect([service_id, key=None, *, ...])
+
+ Connect the interface to a network. This method is optional, and
+ available only for interfaces which are not "always connected".
+ If no parameters are given, connect to the default (or the only)
+ service. If a single parameter is given, it is the primary identifier
+ of a service to connect to. It may be accompanied by a key
+ (password) required to access said service. There can be further
+ arbitrary keyword-only parameters, depending on the networking medium
+ type and/or particular device. Parameters can be used to: a)
+ specify alternative service identifier types; b) provide additional
+ connection parameters. For various medium types, there are different
+ sets of predefined/recommended parameters, among them:
+
+ * WiFi: *bssid* keyword to connect to a specific BSSID (MAC address)
+
+.. method:: AbstractNIC.disconnect()
+
+ Disconnect from network.
+
+.. method:: AbstractNIC.isconnected()
+
+ Returns ``True`` if connected to network, otherwise returns ``False``.
+
+.. method:: AbstractNIC.scan(*, ...)
+
+ Scan for the available network services/connections. Returns a
+ list of tuples with discovered service parameters. For various
+ network media, there are different variants of predefined/
+ recommended tuple formats, among them:
+
+ * WiFi: (ssid, bssid, channel, RSSI, authmode, hidden). There
+ may be further fields, specific to a particular device.
+
+ The function may accept additional keyword arguments to filter scan
+ results (e.g. scan for a particular service, on a particular channel,
+ for services of a particular set, etc.), and to affect scan
+ duration and other parameters. Where possible, parameter names
+ should match those in connect().
+
+.. method:: AbstractNIC.status([param])
+
+ Query dynamic status information of the interface. When called with no
+ argument the return value describes the network link status. Otherwise
+ *param* should be a string naming the particular status parameter to
+ retrieve.
+
+ The return types and values are dependent on the network
+ medium/technology. Some of the parameters that may be supported are:
+
+ * WiFi STA: use ``'rssi'`` to retrieve the RSSI of the AP signal
+ * WiFi AP: use ``'stations'`` to retrieve a list of all the STAs
+ connected to the AP. The list contains tuples of the form
+ (MAC, RSSI).
+
+.. method:: AbstractNIC.ifconfig([(ip, subnet, gateway, dns)])
+
+ Get/set IP-level network interface parameters: IP address, subnet mask,
+ gateway and DNS server. When called with no arguments, this method returns
+ a 4-tuple with the above information. To set the above values, pass a
+ 4-tuple with the required information. For example::
+
+ nic.ifconfig(('192.168.0.4', '255.255.255.0', '192.168.0.1', '8.8.8.8'))
+
+.. method:: AbstractNIC.config('param')
+ AbstractNIC.config(param=value, ...)
+
+ Get or set general network interface parameters. These methods allow to work
+ with additional parameters beyond standard IP configuration (as dealt with by
+ `ifconfig()`). These include network-specific and hardware-specific
+ parameters. For setting parameters, the keyword argument
+ syntax should be used, and multiple parameters can be set at once. For
+ querying, a parameter name should be quoted as a string, and only one
+ parameter can be queried at a time::
+
+ # Set WiFi access point name (formally known as ESSID) and WiFi channel
+ ap.config(essid='My AP', channel=11)
+ # Query params one by one
+ print(ap.config('essid'))
+ print(ap.config('channel'))
+
+Specific network class implementations
+======================================
+
+The following concrete classes implement the AbstractNIC interface and
+provide a way to control networking interfaces of various kinds.
+
+.. toctree::
+ :maxdepth: 1
+
+ network.WLAN.rst
+ network.WLANWiPy.rst
+ network.CC3K.rst
+ network.WIZNET5K.rst
+ network.LAN.rst
+
+Network functions
+=================
+
+The following are functions available in the network module.
+
+.. function:: phy_mode([mode])
+
+ Get or set the PHY mode.
+
+ If the *mode* parameter is provided, sets the mode to its value. If
+ the function is called without parameters, returns the current mode.
+
+ The possible modes are defined as constants:
+ * ``MODE_11B`` -- IEEE 802.11b,
+ * ``MODE_11G`` -- IEEE 802.11g,
+ * ``MODE_11N`` -- IEEE 802.11n.
+
+ Availability: ESP8266.
diff --git a/components/language/micropython/docs/library/os.rst b/components/language/micropython/docs/library/os.rst
new file mode 100644
index 00000000..19652ee2
--- /dev/null
+++ b/components/language/micropython/docs/library/os.rst
@@ -0,0 +1,327 @@
+:mod:`os` -- basic "operating system" services
+==============================================
+
+.. module:: os
+ :synopsis: basic "operating system" services
+
+|see_cpython_module| :mod:`python:os`.
+
+The ``os`` module contains functions for filesystem access and mounting,
+terminal redirection and duplication, and the ``uname`` and ``urandom``
+functions.
+
+General functions
+-----------------
+
+.. function:: uname()
+
+ Return a tuple (possibly a named tuple) containing information about the
+ underlying machine and/or its operating system. The tuple has five fields
+ in the following order, each of them being a string:
+
+ * ``sysname`` -- the name of the underlying system
+ * ``nodename`` -- the network name (can be the same as ``sysname``)
+ * ``release`` -- the version of the underlying system
+ * ``version`` -- the MicroPython version and build date
+ * ``machine`` -- an identifier for the underlying hardware (eg board, CPU)
+
+.. function:: urandom(n)
+
+ Return a bytes object with *n* random bytes. Whenever possible, it is
+ generated by the hardware random number generator.
+
+Filesystem access
+-----------------
+
+.. function:: chdir(path)
+
+ Change current directory.
+
+.. function:: getcwd()
+
+ Get the current directory.
+
+.. function:: ilistdir([dir])
+
+ This function returns an iterator which then yields tuples corresponding to
+ the entries in the directory that it is listing. With no argument it lists the
+ current directory, otherwise it lists the directory given by *dir*.
+
+ The tuples have the form *(name, type, inode[, size])*:
+
+ - *name* is a string (or bytes if *dir* is a bytes object) and is the name of
+ the entry;
+ - *type* is an integer that specifies the type of the entry, with 0x4000 for
+ directories and 0x8000 for regular files;
+ - *inode* is an integer corresponding to the inode of the file, and may be 0
+ for filesystems that don't have such a notion.
+ - Some platforms may return a 4-tuple that includes the entry's *size*. For
+ file entries, *size* is an integer representing the size of the file
+ or -1 if unknown. Its meaning is currently undefined for directory
+ entries.
+
+.. function:: listdir([dir])
+
+ With no argument, list the current directory. Otherwise list the given directory.
+
+.. function:: mkdir(path)
+
+ Create a new directory.
+
+.. function:: remove(path)
+
+ Remove a file.
+
+.. function:: rmdir(path)
+
+ Remove a directory.
+
+.. function:: rename(old_path, new_path)
+
+ Rename a file.
+
+.. function:: stat(path)
+
+ Get the status of a file or directory.
+
+.. function:: statvfs(path)
+
+ Get the status of a fileystem.
+
+ Returns a tuple with the filesystem information in the following order:
+
+ * ``f_bsize`` -- file system block size
+ * ``f_frsize`` -- fragment size
+ * ``f_blocks`` -- size of fs in f_frsize units
+ * ``f_bfree`` -- number of free blocks
+ * ``f_bavail`` -- number of free blocks for unprivileged users
+ * ``f_files`` -- number of inodes
+ * ``f_ffree`` -- number of free inodes
+ * ``f_favail`` -- number of free inodes for unprivileged users
+ * ``f_flag`` -- mount flags
+ * ``f_namemax`` -- maximum filename length
+
+ Parameters related to inodes: ``f_files``, ``f_ffree``, ``f_avail``
+ and the ``f_flags`` parameter may return ``0`` as they can be unavailable
+ in a port-specific implementation.
+
+.. function:: sync()
+
+ Sync all filesystems.
+
+Terminal redirection and duplication
+------------------------------------
+
+.. function:: dupterm(stream_object, index=0, /)
+
+ Duplicate or switch the MicroPython terminal (the REPL) on the given `stream`-like
+ object. The *stream_object* argument must be a native stream object, or derive
+ from ``io.IOBase`` and implement the ``readinto()`` and
+ ``write()`` methods. The stream should be in non-blocking mode and
+ ``readinto()`` should return ``None`` if there is no data available for reading.
+
+ After calling this function all terminal output is repeated on this stream,
+ and any input that is available on the stream is passed on to the terminal input.
+
+ The *index* parameter should be a non-negative integer and specifies which
+ duplication slot is set. A given port may implement more than one slot (slot 0
+ will always be available) and in that case terminal input and output is
+ duplicated on all the slots that are set.
+
+ If ``None`` is passed as the *stream_object* then duplication is cancelled on
+ the slot given by *index*.
+
+ The function returns the previous stream-like object in the given slot.
+
+Filesystem mounting
+-------------------
+
+Some ports provide a Virtual Filesystem (VFS) and the ability to mount multiple
+"real" filesystems within this VFS. Filesystem objects can be mounted at either
+the root of the VFS, or at a subdirectory that lives in the root. This allows
+dynamic and flexible configuration of the filesystem that is seen by Python
+programs. Ports that have this functionality provide the :func:`mount` and
+:func:`umount` functions, and possibly various filesystem implementations
+represented by VFS classes.
+
+.. function:: mount(fsobj, mount_point, *, readonly)
+
+ Mount the filesystem object *fsobj* at the location in the VFS given by the
+ *mount_point* string. *fsobj* can be a a VFS object that has a ``mount()``
+ method, or a block device. If it's a block device then the filesystem type
+ is automatically detected (an exception is raised if no filesystem was
+ recognised). *mount_point* may be ``'/'`` to mount *fsobj* at the root,
+ or ``'/'`` to mount it at a subdirectory under the root.
+
+ If *readonly* is ``True`` then the filesystem is mounted read-only.
+
+ During the mount process the method ``mount()`` is called on the filesystem
+ object.
+
+ Will raise ``OSError(EPERM)`` if *mount_point* is already mounted.
+
+.. function:: umount(mount_point)
+
+ Unmount a filesystem. *mount_point* can be a string naming the mount location,
+ or a previously-mounted filesystem object. During the unmount process the
+ method ``umount()`` is called on the filesystem object.
+
+ Will raise ``OSError(EINVAL)`` if *mount_point* is not found.
+
+.. class:: VfsFat(block_dev)
+
+ Create a filesystem object that uses the FAT filesystem format. Storage of
+ the FAT filesystem is provided by *block_dev*.
+ Objects created by this constructor can be mounted using :func:`mount`.
+
+ .. staticmethod:: mkfs(block_dev)
+
+ Build a FAT filesystem on *block_dev*.
+
+.. class:: VfsLfs1(block_dev, readsize=32, progsize=32, lookahead=32)
+
+ Create a filesystem object that uses the `littlefs v1 filesystem format`_.
+ Storage of the littlefs filesystem is provided by *block_dev*, which must
+ support the :ref:`extended interface `.
+ Objects created by this constructor can be mounted using :func:`mount`.
+
+ See :ref:`filesystem` for more information.
+
+ .. staticmethod:: mkfs(block_dev, readsize=32, progsize=32, lookahead=32)
+
+ Build a Lfs1 filesystem on *block_dev*.
+
+ .. note:: There are reports of littlefs v1 failing in certain situations,
+ for details see `littlefs issue 347`_.
+
+.. class:: VfsLfs2(block_dev, readsize=32, progsize=32, lookahead=32, mtime=True)
+
+ Create a filesystem object that uses the `littlefs v2 filesystem format`_.
+ Storage of the littlefs filesystem is provided by *block_dev*, which must
+ support the :ref:`extended interface `.
+ Objects created by this constructor can be mounted using :func:`mount`.
+
+ The *mtime* argument enables modification timestamps for files, stored using
+ littlefs attributes. This option can be disabled or enabled differently each
+ mount time and timestamps will only be added or updated if *mtime* is enabled,
+ otherwise the timestamps will remain untouched. Littlefs v2 filesystems without
+ timestamps will work without reformatting and timestamps will be added
+ transparently to existing files once they are opened for writing. When *mtime*
+ is enabled `os.stat` on files without timestamps will return 0 for the timestamp.
+
+ See :ref:`filesystem` for more information.
+
+ .. staticmethod:: mkfs(block_dev, readsize=32, progsize=32, lookahead=32)
+
+ Build a Lfs2 filesystem on *block_dev*.
+
+ .. note:: There are reports of littlefs v2 failing in certain situations,
+ for details see `littlefs issue 295`_.
+
+.. _littlefs v1 filesystem format: https://github.com/ARMmbed/littlefs/tree/v1
+.. _littlefs v2 filesystem format: https://github.com/ARMmbed/littlefs
+.. _littlefs issue 295: https://github.com/ARMmbed/littlefs/issues/295
+.. _littlefs issue 347: https://github.com/ARMmbed/littlefs/issues/347
+
+Block devices
+-------------
+
+A block device is an object which implements the block protocol. This enables a
+device to support MicroPython filesystems. The physical hardware is represented
+by a user defined class. The :class:`AbstractBlockDev` class is a template for
+the design of such a class: MicroPython does not actually provide that class,
+but an actual block device class must implement the methods described below.
+
+A concrete implementation of this class will usually allow access to the
+memory-like functionality of a piece of hardware (like flash memory). A block
+device can be formatted to any supported filesystem and mounted using ``os``
+methods.
+
+See :ref:`filesystem` for example implementations of block devices using the
+two variants of the block protocol described below.
+
+.. _block-device-interface:
+
+Simple and extended interface
+.............................
+
+There are two compatible signatures for the ``readblocks`` and ``writeblocks``
+methods (see below), in order to support a variety of use cases. A given block
+device may implement one form or the other, or both at the same time. The second
+form (with the offset parameter) is referred to as the "extended interface".
+
+Some filesystems (such as littlefs) that require more control over write
+operations, for example writing to sub-block regions without erasing, may require
+that the block device supports the extended interface.
+
+.. class:: AbstractBlockDev(...)
+
+ Construct a block device object. The parameters to the constructor are
+ dependent on the specific block device.
+
+ .. method:: readblocks(block_num, buf)
+ readblocks(block_num, buf, offset)
+
+ The first form reads aligned, multiples of blocks.
+ Starting at the block given by the index *block_num*, read blocks from
+ the device into *buf* (an array of bytes).
+ The number of blocks to read is given by the length of *buf*,
+ which will be a multiple of the block size.
+
+ The second form allows reading at arbitrary locations within a block,
+ and arbitrary lengths.
+ Starting at block index *block_num*, and byte offset within that block
+ of *offset*, read bytes from the device into *buf* (an array of bytes).
+ The number of bytes to read is given by the length of *buf*.
+
+ .. method:: writeblocks(block_num, buf)
+ writeblocks(block_num, buf, offset)
+
+ The first form writes aligned, multiples of blocks, and requires that the
+ blocks that are written to be first erased (if necessary) by this method.
+ Starting at the block given by the index *block_num*, write blocks from
+ *buf* (an array of bytes) to the device.
+ The number of blocks to write is given by the length of *buf*,
+ which will be a multiple of the block size.
+
+ The second form allows writing at arbitrary locations within a block,
+ and arbitrary lengths. Only the bytes being written should be changed,
+ and the caller of this method must ensure that the relevant blocks are
+ erased via a prior ``ioctl`` call.
+ Starting at block index *block_num*, and byte offset within that block
+ of *offset*, write bytes from *buf* (an array of bytes) to the device.
+ The number of bytes to write is given by the length of *buf*.
+
+ Note that implementations must never implicitly erase blocks if the offset
+ argument is specified, even if it is zero.
+
+ .. method:: ioctl(op, arg)
+
+ Control the block device and query its parameters. The operation to
+ perform is given by *op* which is one of the following integers:
+
+ - 1 -- initialise the device (*arg* is unused)
+ - 2 -- shutdown the device (*arg* is unused)
+ - 3 -- sync the device (*arg* is unused)
+ - 4 -- get a count of the number of blocks, should return an integer
+ (*arg* is unused)
+ - 5 -- get the number of bytes in a block, should return an integer,
+ or ``None`` in which case the default value of 512 is used
+ (*arg* is unused)
+ - 6 -- erase a block, *arg* is the block number to erase
+
+ As a minimum ``ioctl(4, ...)`` must be intercepted; for littlefs
+ ``ioctl(6, ...)`` must also be intercepted. The need for others is
+ hardware dependent.
+
+ Prior to any call to ``writeblocks(block, ...)`` littlefs issues
+ ``ioctl(6, block)``. This enables a device driver to erase the block
+ prior to a write if the hardware requires it. Alternatively a driver
+ might intercept ``ioctl(6, block)`` and return 0 (success). In this case
+ the driver assumes responsibility for detecting the need for erasure.
+
+ Unless otherwise stated ``ioctl(op, arg)`` can return ``None``.
+ Consequently an implementation can ignore unused values of ``op``. Where
+ ``op`` is intercepted, the return value for operations 4 and 5 are as
+ detailed above. Other operations should return 0 on success and non-zero
+ for failure, with the value returned being an ``OSError`` errno code.
diff --git a/components/language/micropython/docs/library/pyb.ADC.rst b/components/language/micropython/docs/library/pyb.ADC.rst
new file mode 100644
index 00000000..1b16e0c2
--- /dev/null
+++ b/components/language/micropython/docs/library/pyb.ADC.rst
@@ -0,0 +1,167 @@
+.. currentmodule:: pyb
+.. _pyb.ADC:
+
+class ADC -- analog to digital conversion
+=========================================
+
+Usage::
+
+ import pyb
+
+ adc = pyb.ADC(pin) # create an analog object from a pin
+ val = adc.read() # read an analog value
+
+ adc = pyb.ADCAll(resolution) # create an ADCAll object
+ adc = pyb.ADCAll(resolution, mask) # create an ADCAll object for selected analog channels
+ val = adc.read_channel(channel) # read the given channel
+ val = adc.read_core_temp() # read MCU temperature
+ val = adc.read_core_vbat() # read MCU VBAT
+ val = adc.read_core_vref() # read MCU VREF
+ val = adc.read_vref() # read MCU supply voltage
+
+
+Constructors
+------------
+
+.. class:: pyb.ADC(pin)
+
+ Create an ADC object associated with the given pin.
+ This allows you to then read analog values on that pin.
+
+Methods
+-------
+
+.. method:: ADC.read()
+
+ Read the value on the analog pin and return it. The returned value
+ will be between 0 and 4095.
+
+.. method:: ADC.read_timed(buf, timer)
+
+ Read analog values into ``buf`` at a rate set by the ``timer`` object.
+
+ ``buf`` can be bytearray or array.array for example. The ADC values have
+ 12-bit resolution and are stored directly into ``buf`` if its element size is
+ 16 bits or greater. If ``buf`` has only 8-bit elements (eg a bytearray) then
+ the sample resolution will be reduced to 8 bits.
+
+ ``timer`` should be a Timer object, and a sample is read each time the timer
+ triggers. The timer must already be initialised and running at the desired
+ sampling frequency.
+
+ To support previous behaviour of this function, ``timer`` can also be an
+ integer which specifies the frequency (in Hz) to sample at. In this case
+ Timer(6) will be automatically configured to run at the given frequency.
+
+ Example using a Timer object (preferred way)::
+
+ adc = pyb.ADC(pyb.Pin.board.X19) # create an ADC on pin X19
+ tim = pyb.Timer(6, freq=10) # create a timer running at 10Hz
+ buf = bytearray(100) # creat a buffer to store the samples
+ adc.read_timed(buf, tim) # sample 100 values, taking 10s
+
+ Example using an integer for the frequency::
+
+ adc = pyb.ADC(pyb.Pin.board.X19) # create an ADC on pin X19
+ buf = bytearray(100) # create a buffer of 100 bytes
+ adc.read_timed(buf, 10) # read analog values into buf at 10Hz
+ # this will take 10 seconds to finish
+ for val in buf: # loop over all values
+ print(val) # print the value out
+
+ This function does not allocate any heap memory. It has blocking behaviour:
+ it does not return to the calling program until the buffer is full.
+
+.. method:: ADC.read_timed_multi((adcx, adcy, ...), (bufx, bufy, ...), timer)
+
+ This is a static method. It can be used to extract relative timing or
+ phase data from multiple ADC's.
+
+ It reads analog values from multiple ADC's into buffers at a rate set by
+ the *timer* object. Each time the timer triggers a sample is rapidly
+ read from each ADC in turn.
+
+ ADC and buffer instances are passed in tuples with each ADC having an
+ associated buffer. All buffers must be of the same type and length and
+ the number of buffers must equal the number of ADC's.
+
+ Buffers can be ``bytearray`` or ``array.array`` for example. The ADC values
+ have 12-bit resolution and are stored directly into the buffer if its element
+ size is 16 bits or greater. If buffers have only 8-bit elements (eg a
+ ``bytearray``) then the sample resolution will be reduced to 8 bits.
+
+ *timer* must be a Timer object. The timer must already be initialised
+ and running at the desired sampling frequency.
+
+ Example reading 3 ADC's::
+
+ adc0 = pyb.ADC(pyb.Pin.board.X1) # Create ADC's
+ adc1 = pyb.ADC(pyb.Pin.board.X2)
+ adc2 = pyb.ADC(pyb.Pin.board.X3)
+ tim = pyb.Timer(8, freq=100) # Create timer
+ rx0 = array.array('H', (0 for i in range(100))) # ADC buffers of
+ rx1 = array.array('H', (0 for i in range(100))) # 100 16-bit words
+ rx2 = array.array('H', (0 for i in range(100)))
+ # read analog values into buffers at 100Hz (takes one second)
+ pyb.ADC.read_timed_multi((adc0, adc1, adc2), (rx0, rx1, rx2), tim)
+ for n in range(len(rx0)):
+ print(rx0[n], rx1[n], rx2[n])
+
+ This function does not allocate any heap memory. It has blocking behaviour:
+ it does not return to the calling program until the buffers are full.
+
+ The function returns ``True`` if all samples were acquired with correct
+ timing. At high sample rates the time taken to acquire a set of samples
+ can exceed the timer period. In this case the function returns ``False``,
+ indicating a loss of precision in the sample interval. In extreme cases
+ samples may be missed.
+
+ The maximum rate depends on factors including the data width and the
+ number of ADC's being read. In testing two ADC's were sampled at a timer
+ rate of 210kHz without overrun. Samples were missed at 215kHz. For three
+ ADC's the limit is around 140kHz, and for four it is around 110kHz.
+ At high sample rates disabling interrupts for the duration can reduce the
+ risk of sporadic data loss.
+
+The ADCAll Object
+-----------------
+
+Instantiating this changes all masked ADC pins to analog inputs. The preprocessed MCU temperature,
+VREF and VBAT data can be accessed on ADC channels 16, 17 and 18 respectively.
+Appropriate scaling is handled according to reference voltage used (usually 3.3V).
+The temperature sensor on the chip is factory calibrated and allows to read the die temperature
+to +/- 1 degree centigrade. Although this sounds pretty accurate, don't forget that the MCU's internal
+temperature is measured. Depending on processing loads and I/O subsystems active the die temperature
+may easily be tens of degrees above ambient temperature. On the other hand a pyboard woken up after a
+long standby period will show correct ambient temperature within limits mentioned above.
+
+The ``ADCAll`` ``read_core_vbat()``, ``read_vref()`` and ``read_core_vref()`` methods read
+the backup battery voltage, reference voltage and the (1.21V nominal) reference voltage using the
+actual supply as a reference. All results are floating point numbers giving direct voltage values.
+
+``read_core_vbat()`` returns the voltage of the backup battery. This voltage is also adjusted according
+to the actual supply voltage. To avoid analog input overload the battery voltage is measured
+via a voltage divider and scaled according to the divider value. To prevent excessive loads
+to the backup battery, the voltage divider is only active during ADC conversion.
+
+``read_vref()`` is evaluated by measuring the internal voltage reference and backscale it using
+factory calibration value of the internal voltage reference. In most cases the reading would be close
+to 3.3V. If the pyboard is operated from a battery, the supply voltage may drop to values below 3.3V.
+The pyboard will still operate fine as long as the operating conditions are met. With proper settings
+of MCU clock, flash access speed and programming mode it is possible to run the pyboard down to
+2 V and still get useful ADC conversion.
+
+It is very important to make sure analog input voltages never exceed actual supply voltage.
+
+Other analog input channels (0..15) will return unscaled integer values according to the selected
+precision.
+
+To avoid unwanted activation of analog inputs (channel 0..15) a second parameter can be specified.
+This parameter is a binary pattern where each requested analog input has the corresponding bit set.
+The default value is 0xffffffff which means all analog inputs are active. If just the internal
+channels (16..18) are required, the mask value should be 0x70000.
+
+Example::
+
+ adcall = pyb.ADCAll(12, 0x70000) # 12 bit resolution, internal channels
+ temp = adcall.read_core_temp()
diff --git a/components/language/micropython/docs/library/pyb.Accel.rst b/components/language/micropython/docs/library/pyb.Accel.rst
new file mode 100644
index 00000000..d5c0ca86
--- /dev/null
+++ b/components/language/micropython/docs/library/pyb.Accel.rst
@@ -0,0 +1,57 @@
+.. currentmodule:: pyb
+.. _pyb.Accel:
+
+class Accel -- accelerometer control
+====================================
+
+Accel is an object that controls the accelerometer. Example usage::
+
+ accel = pyb.Accel()
+ for i in range(10):
+ print(accel.x(), accel.y(), accel.z())
+
+Raw values are between -32 and 31.
+
+
+Constructors
+------------
+
+.. class:: pyb.Accel()
+
+ Create and return an accelerometer object.
+
+Methods
+-------
+
+.. method:: Accel.filtered_xyz()
+
+ Get a 3-tuple of filtered x, y and z values.
+
+ Implementation note: this method is currently implemented as taking the
+ sum of 4 samples, sampled from the 3 previous calls to this function along
+ with the sample from the current call. Returned values are therefore 4
+ times the size of what they would be from the raw x(), y() and z() calls.
+
+.. method:: Accel.tilt()
+
+ Get the tilt register.
+
+.. method:: Accel.x()
+
+ Get the x-axis value.
+
+.. method:: Accel.y()
+
+ Get the y-axis value.
+
+.. method:: Accel.z()
+
+ Get the z-axis value.
+
+Hardware Note
+-------------
+
+The accelerometer uses I2C bus 1 to communicate with the processor. Consequently
+when readings are being taken pins X9 and X10 should be unused (other than for
+I2C). Other devices using those pins, and which therefore cannot be used
+concurrently, are UART 1 and Timer 4 channels 1 and 2.
diff --git a/components/language/micropython/docs/library/pyb.CAN.rst b/components/language/micropython/docs/library/pyb.CAN.rst
new file mode 100644
index 00000000..69704d09
--- /dev/null
+++ b/components/language/micropython/docs/library/pyb.CAN.rst
@@ -0,0 +1,349 @@
+.. currentmodule:: pyb
+.. _pyb.CAN:
+
+class CAN -- controller area network communication bus
+======================================================
+
+CAN implements support for classic CAN (available on F4, F7 MCUs) and CAN FD (H7 series) controllers.
+At the physical level CAN bus consists of 2 lines: RX and TX. Note that to connect the pyboard to a
+CAN bus you must use a CAN transceiver to convert the CAN logic signals from the pyboard to the correct
+voltage levels on the bus.
+
+Example usage for classic CAN controller in Loopback (transceiver-less) mode::
+
+ from pyb import CAN
+ can = CAN(1, CAN.LOOPBACK)
+ can.setfilter(0, CAN.LIST16, 0, (123, 124, 125, 126)) # set a filter to receive messages with id=123, 124, 125 and 126
+ can.send('message!', 123) # send a message with id 123
+ can.recv(0) # receive message on FIFO 0
+
+Example usage for CAN FD controller with all of the possible options enabled::
+
+ # FD frame + BRS mode + Extended frame ID. 500 Kbit/s for arbitration phase, 1Mbit/s for data phase.
+ can = CAN(1, CAN.NORMAL, baudrate=500_000, brs_baudrate=1_000_000, sample_point=80)
+ can.setfilter(0, CAN.RANGE, 0, (0xFFF0, 0xFFFF))
+ can.send('a'*64, 0xFFFF, fdf=True, brs=True, extframe=True)
+ can.recv(0)
+
+The following CAN module functions and their arguments are available
+for both classic and FD CAN controllers, unless otherwise stated.
+
+Constructors
+------------
+
+.. class:: pyb.CAN(bus, ...)
+
+ Construct a CAN object on the given bus. *bus* can be 1-2, or ``'YA'`` or ``'YB'``.
+ With no additional parameters, the CAN object is created but not
+ initialised (it has the settings from the last initialisation of
+ the bus, if any). If extra arguments are given, the bus is initialised.
+ See :meth:`CAN.init` for parameters of initialisation.
+
+ The physical pins of the CAN buses are:
+
+ - ``CAN(1)`` is on ``YA``: ``(RX, TX) = (Y3, Y4) = (PB8, PB9)``
+ - ``CAN(2)`` is on ``YB``: ``(RX, TX) = (Y5, Y6) = (PB12, PB13)``
+
+Methods
+-------
+
+.. method:: CAN.init(mode, prescaler=100, *, sjw=1, bs1=6, bs2=8, auto_restart=False, baudrate=0, sample_point=75,
+ num_filter_banks=14, brs_sjw=1, brs_bs1=8, brs_bs2=3, brs_baudrate=0, brs_sample_point=75)
+
+ Initialise the CAN bus with the given parameters:
+
+ - *mode* is one of: NORMAL, LOOPBACK, SILENT, SILENT_LOOPBACK
+ - *prescaler* is the value by which the CAN input clock is divided to generate the
+ nominal bit time quanta. The prescaler can be a value between 1 and 1024 inclusive
+ for classic CAN, and between 1 and 512 inclusive for CAN FD.
+ - *sjw* is the resynchronisation jump width in units of time quanta for nominal bits;
+ it can be a value between 1 and 4 inclusive for classic CAN, and between 1 and 128 inclusive for CAN FD.
+ - *bs1* defines the location of the sample point in units of the time quanta for nominal bits;
+ it can be a value between 1 and 16 inclusive for classic CAN, and between 2 and 256 inclusive for CAN FD.
+ - *bs2* defines the location of the transmit point in units of the time quanta for nominal bits;
+ it can be a value between 1 and 8 inclusive for classic CAN, and between 2 and 128 inclusive for CAN FD.
+ - *auto_restart* sets whether the controller will automatically try and restart
+ communications after entering the bus-off state; if this is disabled then
+ :meth:`~CAN.restart()` can be used to leave the bus-off state
+ - *baudrate* if a baudrate other than 0 is provided, this function will try to automatically
+ calculate the CAN nominal bit time (overriding *prescaler*, *bs1* and *bs2*) that satisfies
+ both the baudrate and the desired *sample_point*.
+ - *sample_point* given in a percentage of the nominal bit time, the *sample_point* specifies the position
+ of the bit sample with respect to the whole nominal bit time. The default *sample_point* is 75%.
+ - *num_filter_banks* for classic CAN, this is the number of banks that will be assigned to CAN(1),
+ the rest of the 28 are assigned to CAN(2).
+ - *brs_prescaler* is the value by which the CAN FD input clock is divided to generate the
+ data bit time quanta. The prescaler can be a value between 1 and 32 inclusive.
+ - *brs_sjw* is the resynchronisation jump width in units of time quanta for data bits;
+ it can be a value between 1 and 16 inclusive
+ - *brs_bs1* defines the location of the sample point in units of the time quanta for data bits;
+ it can be a value between 1 and 32 inclusive
+ - *brs_bs2* defines the location of the transmit point in units of the time quanta for data bits;
+ it can be a value between 1 and 16 inclusive
+ - *brs_baudrate* if a baudrate other than 0 is provided, this function will try to automatically
+ calculate the CAN data bit time (overriding *brs_prescaler*, *brs_bs1* and *brs_bs2*) that satisfies
+ both the baudrate and the desired *brs_sample_point*.
+ - *brs_sample_point* given in a percentage of the data bit time, the *brs_sample_point* specifies the position
+ of the bit sample with respect to the whole data bit time. The default *brs_sample_point* is 75%.
+
+
+ The time quanta tq is the basic unit of time for the CAN bus. tq is the CAN
+ prescaler value divided by PCLK1 (the frequency of internal peripheral bus 1);
+ see :meth:`pyb.freq()` to determine PCLK1.
+
+ A single bit is made up of the synchronisation segment, which is always 1 tq.
+ Then follows bit segment 1, then bit segment 2. The sample point is after bit
+ segment 1 finishes. The transmit point is after bit segment 2 finishes.
+ The baud rate will be 1/bittime, where the bittime is 1 + BS1 + BS2 multiplied
+ by the time quanta tq.
+
+ For example, with PCLK1=42MHz, prescaler=100, sjw=1, bs1=6, bs2=8, the value of
+ tq is 2.38 microseconds. The bittime is 35.7 microseconds, and the baudrate
+ is 28kHz.
+
+ See page 680 of the STM32F405 datasheet for more details.
+
+.. method:: CAN.deinit()
+
+ Turn off the CAN bus.
+
+.. method:: CAN.restart()
+
+ Force a software restart of the CAN controller without resetting its
+ configuration.
+
+ If the controller enters the bus-off state then it will no longer participate
+ in bus activity. If the controller is not configured to automatically restart
+ (see :meth:`~CAN.init()`) then this method can be used to trigger a restart,
+ and the controller will follow the CAN protocol to leave the bus-off state and
+ go into the error active state.
+
+.. method:: CAN.state()
+
+ Return the state of the controller. The return value can be one of:
+
+ - ``CAN.STOPPED`` -- the controller is completely off and reset;
+ - ``CAN.ERROR_ACTIVE`` -- the controller is on and in the Error Active state
+ (both TEC and REC are less than 96);
+ - ``CAN.ERROR_WARNING`` -- the controller is on and in the Error Warning state
+ (at least one of TEC or REC is 96 or greater);
+ - ``CAN.ERROR_PASSIVE`` -- the controller is on and in the Error Passive state
+ (at least one of TEC or REC is 128 or greater);
+ - ``CAN.BUS_OFF`` -- the controller is on but not participating in bus activity
+ (TEC overflowed beyond 255).
+
+.. method:: CAN.info([list])
+
+ Get information about the controller's error states and TX and RX buffers.
+ If *list* is provided then it should be a list object with at least 8 entries,
+ which will be filled in with the information. Otherwise a new list will be
+ created and filled in. In both cases the return value of the method is the
+ populated list.
+
+ The values in the list are:
+
+ - TEC value
+ - REC value
+ - number of times the controller enterted the Error Warning state (wrapped
+ around to 0 after 65535)
+ - number of times the controller enterted the Error Passive state (wrapped
+ around to 0 after 65535)
+ - number of times the controller enterted the Bus Off state (wrapped
+ around to 0 after 65535)
+ - number of pending TX messages
+ - number of pending RX messages on fifo 0
+ - number of pending RX messages on fifo 1
+
+.. method:: CAN.setfilter(bank, mode, fifo, params, *, rtr, extframe=False)
+
+ Configure a filter bank:
+
+ - *bank* is the classic CAN controller filter bank, or CAN FD filter index, to configure.
+ - *mode* is the mode the filter should operate in, see the tables below.
+ - *fifo* is which fifo (0 or 1) a message should be stored in, if it is accepted by this filter.
+ - *params* is an array of values the defines the filter. The contents of the array depends on the *mode* argument.
+
+ +-----------+---------------------------------------------------------+
+ |*mode* |Contents of *params* array for classic CAN controller |
+ +===========+=========================================================+
+ |CAN.LIST16 |Four 16 bit ids that will be accepted |
+ +-----------+---------------------------------------------------------+
+ |CAN.LIST32 |Two 32 bit ids that will be accepted |
+ +-----------+---------------------------------------------------------+
+ |CAN.MASK16 |Two 16 bit id/mask pairs. E.g. (1, 3, 4, 4) |
+ | | | The first pair, 1 and 3 will accept all ids |
+ | | | that have bit 0 = 1 and bit 1 = 0. |
+ | | | The second pair, 4 and 4, will accept all ids |
+ | | | that have bit 2 = 1. |
+ +-----------+---------------------------------------------------------+
+ |CAN.MASK32 |As with CAN.MASK16 but with only one 32 bit id/mask pair.|
+ +-----------+---------------------------------------------------------+
+
+ +-----------+---------------------------------------------------------+
+ |*mode* |Contents of *params* array for CAN FD controller |
+ +===========+=========================================================+
+ |CAN.RANGE |Two ids that represent a range of accepted ids. |
+ +-----------+---------------------------------------------------------+
+ |CAN.DUAL |Two ids that will be accepted. For example (1, 2) |
+ +-----------+---------------------------------------------------------+
+ |CAN.MASK |One filter ID and a mask. For example (0x111, 0x7FF) |
+ +-----------+---------------------------------------------------------+
+
+ - *rtr* For classic CAN controllers, this is an array of booleans that states if
+ a filter should accept a remote transmission request message. If this argument
+ is not given then it defaults to ``False`` for all entries. The length of the
+ array depends on the *mode* argument. For CAN FD, this argument is ignored.
+
+ +-----------+----------------------+
+ |*mode* |length of *rtr* array |
+ +===========+======================+
+ |CAN.LIST16 |4 |
+ +-----------+----------------------+
+ |CAN.LIST32 |2 |
+ +-----------+----------------------+
+ |CAN.MASK16 |2 |
+ +-----------+----------------------+
+ |CAN.MASK32 |1 |
+ +-----------+----------------------+
+
+ - *extframe* If True the frame will have an extended identifier (29 bits),
+ otherwise a standard identifier (11 bits) is used.
+
+
+.. method:: CAN.clearfilter(bank, extframe=False)
+
+ Clear and disables a filter bank:
+
+ - *bank* is the classic CAN controller filter bank, or CAN FD filter index, to clear.
+ - *extframe* For CAN FD controllers, if True, clear an extended filter (configured with extframe=True),
+ otherwise the clear a standard identifier (configured with extframe=False).
+
+.. method:: CAN.any(fifo)
+
+ Return ``True`` if any message waiting on the FIFO, else ``False``.
+
+.. method:: CAN.recv(fifo, list=None, *, timeout=5000)
+
+ Receive data on the bus:
+
+ - *fifo* is an integer, which is the FIFO to receive on
+ - *list* is an optional list object to be used as the return value
+ - *timeout* is the timeout in milliseconds to wait for the receive.
+
+ Return value: A tuple containing five values.
+
+ - The id of the message.
+ - A boolean that indicates if the message ID is standard or extended.
+ - A boolean that indicates if the message is an RTR message.
+ - The FMI (Filter Match Index) value.
+ - An array containing the data.
+
+ If *list* is ``None`` then a new tuple will be allocated, as well as a new
+ bytes object to contain the data (as the fifth element in the tuple).
+
+ If *list* is not ``None`` then it should be a list object with a least five
+ elements. The fifth element should be a memoryview object which is created
+ from either a bytearray or an array of type 'B' or 'b', and this array must
+ have enough room for at least 8 bytes. The list object will then be
+ populated with the first four return values above, and the memoryview object
+ will be resized inplace to the size of the data and filled in with that data.
+ The same list and memoryview objects can be reused in subsequent calls to
+ this method, providing a way of receiving data without using the heap.
+ For example::
+
+ buf = bytearray(8)
+ lst = [0, 0, 0, memoryview(buf)]
+ # No heap memory is allocated in the following call
+ can.recv(0, lst)
+
+.. method:: CAN.send(data, id, *, timeout=0, rtr=False, extframe=False, fdf=False, brs=False)
+
+ Send a message on the bus:
+
+ - *data* is the data to send (an integer to send, or a buffer object).
+ - *id* is the id of the message to be sent.
+ - *timeout* is the timeout in milliseconds to wait for the send.
+ - *rtr* is a boolean that specifies if the message shall be sent as
+ a remote transmission request. If *rtr* is True then only the length
+ of *data* is used to fill in the DLC slot of the frame; the actual
+ bytes in *data* are unused.
+ - *extframe* if True the frame will have an extended identifier (29 bits),
+ otherwise a standard identifier (11 bits) is used.
+ - *fdf* for CAN FD controllers, if set to True, the frame will have an FD
+ frame format, which supports data payloads up to 64 bytes.
+ - *brs* for CAN FD controllers, if set to True, the bitrate switching mode
+ is enabled, in which the data phase is transmitted at a differet bitrate.
+ See :meth:`CAN.init` for the data bit timing configuration parameters.
+
+ If timeout is 0 the message is placed in a buffer in one of three hardware
+ buffers and the method returns immediately. If all three buffers are in use
+ an exception is thrown. If timeout is not 0, the method waits until the
+ message is transmitted. If the message can't be transmitted within the
+ specified time an exception is thrown.
+
+ Return value: ``None``.
+
+.. method:: CAN.rxcallback(fifo, fun)
+
+ Register a function to be called when a message is accepted into a empty fifo:
+
+ - *fifo* is the receiving fifo.
+ - *fun* is the function to be called when the fifo becomes non empty.
+
+ The callback function takes two arguments the first is the can object it self the second is
+ a integer that indicates the reason for the callback.
+
+ +--------+------------------------------------------------+
+ | Reason | |
+ +========+================================================+
+ | 0 | A message has been accepted into a empty FIFO. |
+ +--------+------------------------------------------------+
+ | 1 | The FIFO is full |
+ +--------+------------------------------------------------+
+ | 2 | A message has been lost due to a full FIFO |
+ +--------+------------------------------------------------+
+
+ Example use of rxcallback::
+
+ def cb0(bus, reason):
+ print('cb0')
+ if reason == 0:
+ print('pending')
+ if reason == 1:
+ print('full')
+ if reason == 2:
+ print('overflow')
+
+ can = CAN(1, CAN.LOOPBACK)
+ can.rxcallback(0, cb0)
+
+Constants
+---------
+
+.. data:: CAN.NORMAL
+ CAN.LOOPBACK
+ CAN.SILENT
+ CAN.SILENT_LOOPBACK
+
+ The mode of the CAN bus used in :meth:`~CAN.init()`.
+
+.. data:: CAN.STOPPED
+ CAN.ERROR_ACTIVE
+ CAN.ERROR_WARNING
+ CAN.ERROR_PASSIVE
+ CAN.BUS_OFF
+
+ Possible states of the CAN controller returned from :meth:`~CAN.state()`.
+
+.. data:: CAN.LIST16
+ CAN.MASK16
+ CAN.LIST32
+ CAN.MASK32
+
+ The operation mode of a filter used in :meth:`~CAN.setfilter()` for classic CAN.
+
+.. data:: CAN.DUAL
+ CAN.RANGE
+ CAN.MASK
+
+ The operation mode of a filter used in :meth:`~CAN.setfilter()` for CAN FD.
diff --git a/components/language/micropython/docs/library/pyb.DAC.rst b/components/language/micropython/docs/library/pyb.DAC.rst
new file mode 100644
index 00000000..0eb469be
--- /dev/null
+++ b/components/language/micropython/docs/library/pyb.DAC.rst
@@ -0,0 +1,136 @@
+.. currentmodule:: pyb
+.. _pyb.DAC:
+
+class DAC -- digital to analog conversion
+=========================================
+
+The DAC is used to output analog values (a specific voltage) on pin X5 or pin X6.
+The voltage will be between 0 and 3.3V.
+
+*This module will undergo changes to the API.*
+
+Example usage::
+
+ from pyb import DAC
+
+ dac = DAC(1) # create DAC 1 on pin X5
+ dac.write(128) # write a value to the DAC (makes X5 1.65V)
+
+ dac = DAC(1, bits=12) # use 12 bit resolution
+ dac.write(4095) # output maximum value, 3.3V
+
+To output a continuous sine-wave::
+
+ import math
+ from pyb import DAC
+
+ # create a buffer containing a sine-wave
+ buf = bytearray(100)
+ for i in range(len(buf)):
+ buf[i] = 128 + int(127 * math.sin(2 * math.pi * i / len(buf)))
+
+ # output the sine-wave at 400Hz
+ dac = DAC(1)
+ dac.write_timed(buf, 400 * len(buf), mode=DAC.CIRCULAR)
+
+To output a continuous sine-wave at 12-bit resolution::
+
+ import math
+ from array import array
+ from pyb import DAC
+
+ # create a buffer containing a sine-wave, using half-word samples
+ buf = array('H', 2048 + int(2047 * math.sin(2 * math.pi * i / 128)) for i in range(128))
+
+ # output the sine-wave at 400Hz
+ dac = DAC(1, bits=12)
+ dac.write_timed(buf, 400 * len(buf), mode=DAC.CIRCULAR)
+
+Constructors
+------------
+
+.. class:: pyb.DAC(port, bits=8, *, buffering=None)
+
+ Construct a new DAC object.
+
+ ``port`` can be a pin object, or an integer (1 or 2).
+ DAC(1) is on pin X5 and DAC(2) is on pin X6.
+
+ ``bits`` is an integer specifying the resolution, and can be 8 or 12.
+ The maximum value for the write and write_timed methods will be
+ 2\*\*``bits``-1.
+
+ The *buffering* parameter selects the behaviour of the DAC op-amp output
+ buffer, whose purpose is to reduce the output impedance. It can be
+ ``None`` to select the default (buffering enabled for :meth:`DAC.noise`,
+ :meth:`DAC.triangle` and :meth:`DAC.write_timed`, and disabled for
+ :meth:`DAC.write`), ``False`` to disable buffering completely, or ``True``
+ to enable output buffering.
+
+ When buffering is enabled the DAC pin can drive loads down to 5KΩ.
+ Otherwise it has an output impedance of 15KΩ maximum: consequently
+ to achieve a 1% accuracy without buffering requires the applied load
+ to be less than 1.5MΩ. Using the buffer incurs a penalty in accuracy,
+ especially near the extremes of range.
+
+Methods
+-------
+
+.. method:: DAC.init(bits=8, *, buffering=None)
+
+ Reinitialise the DAC. *bits* can be 8 or 12. *buffering* can be
+ ``None``, ``False`` or ``True``; see above constructor for the meaning
+ of this parameter.
+
+.. method:: DAC.deinit()
+
+ De-initialise the DAC making its pin available for other uses.
+
+.. method:: DAC.noise(freq)
+
+ Generate a pseudo-random noise signal. A new random sample is written
+ to the DAC output at the given frequency.
+
+.. method:: DAC.triangle(freq)
+
+ Generate a triangle wave. The value on the DAC output changes at the given
+ frequency and ramps through the full 12-bit range (up and down). Therefore
+ the frequency of the repeating triangle wave itself is 8192 times smaller.
+
+.. method:: DAC.write(value)
+
+ Direct access to the DAC output. The minimum value is 0. The maximum
+ value is 2\*\*``bits``-1, where ``bits`` is set when creating the DAC
+ object or by using the ``init`` method.
+
+.. method:: DAC.write_timed(data, freq, *, mode=DAC.NORMAL)
+
+ Initiates a burst of RAM to DAC using a DMA transfer.
+ The input data is treated as an array of bytes in 8-bit mode, and
+ an array of unsigned half-words (array typecode 'H') in 12-bit mode.
+
+ ``freq`` can be an integer specifying the frequency to write the DAC
+ samples at, using Timer(6). Or it can be an already-initialised
+ Timer object which is used to trigger the DAC sample. Valid timers
+ are 2, 4, 5, 6, 7 and 8.
+
+ ``mode`` can be ``DAC.NORMAL`` or ``DAC.CIRCULAR``.
+
+ Example using both DACs at the same time::
+
+ dac1 = DAC(1)
+ dac2 = DAC(2)
+ dac1.write_timed(buf1, pyb.Timer(6, freq=100), mode=DAC.CIRCULAR)
+ dac2.write_timed(buf2, pyb.Timer(7, freq=200), mode=DAC.CIRCULAR)
+
+Constants
+---------
+
+.. data:: DAC.NORMAL
+
+ NORMAL mode does a single transmission of the waveform in the data buffer,
+
+.. data:: DAC.CIRCULAR
+
+ CIRCULAR mode does a transmission of the waveform in the data buffer, and wraps around
+ to the start of the data buffer every time it reaches the end of the table.
diff --git a/components/language/micropython/docs/library/pyb.ExtInt.rst b/components/language/micropython/docs/library/pyb.ExtInt.rst
new file mode 100644
index 00000000..7741cc51
--- /dev/null
+++ b/components/language/micropython/docs/library/pyb.ExtInt.rst
@@ -0,0 +1,114 @@
+.. currentmodule:: pyb
+.. _pyb.ExtInt:
+
+class ExtInt -- configure I/O pins to interrupt on external events
+==================================================================
+
+There are a total of 22 interrupt lines. 16 of these can come from GPIO pins
+and the remaining 6 are from internal sources.
+
+For lines 0 through 15, a given line can map to the corresponding line from an
+arbitrary port. So line 0 can map to Px0 where x is A, B, C, ... and
+line 1 can map to Px1 where x is A, B, C, ... ::
+
+ def callback(line):
+ print("line =", line)
+
+Note: ExtInt will automatically configure the gpio line as an input. ::
+
+ extint = pyb.ExtInt(pin, pyb.ExtInt.IRQ_FALLING, pyb.Pin.PULL_UP, callback)
+
+Now every time a falling edge is seen on the X1 pin, the callback will be
+called. Caution: mechanical pushbuttons have "bounce" and pushing or
+releasing a switch will often generate multiple edges.
+See: http://www.eng.utah.edu/~cs5780/debouncing.pdf for a detailed
+explanation, along with various techniques for debouncing.
+
+Trying to register 2 callbacks onto the same pin will throw an exception.
+
+If pin is passed as an integer, then it is assumed to map to one of the
+internal interrupt sources, and must be in the range 16 through 22.
+
+All other pin objects go through the pin mapper to come up with one of the
+gpio pins. ::
+
+ extint = pyb.ExtInt(pin, mode, pull, callback)
+
+Valid modes are pyb.ExtInt.IRQ_RISING, pyb.ExtInt.IRQ_FALLING,
+pyb.ExtInt.IRQ_RISING_FALLING, pyb.ExtInt.EVT_RISING,
+pyb.ExtInt.EVT_FALLING, and pyb.ExtInt.EVT_RISING_FALLING.
+
+Only the IRQ_xxx modes have been tested. The EVT_xxx modes have
+something to do with sleep mode and the WFE instruction.
+
+Valid pull values are pyb.Pin.PULL_UP, pyb.Pin.PULL_DOWN, pyb.Pin.PULL_NONE.
+
+There is also a C API, so that drivers which require EXTI interrupt lines
+can also use this code. See extint.h for the available functions and
+usrsw.h for an example of using this.
+
+
+Constructors
+------------
+
+.. class:: pyb.ExtInt(pin, mode, pull, callback)
+
+ Create an ExtInt object:
+
+ - ``pin`` is the pin on which to enable the interrupt (can be a pin object or any valid pin name).
+ - ``mode`` can be one of:
+ - ``ExtInt.IRQ_RISING`` - trigger on a rising edge;
+ - ``ExtInt.IRQ_FALLING`` - trigger on a falling edge;
+ - ``ExtInt.IRQ_RISING_FALLING`` - trigger on a rising or falling edge.
+ - ``pull`` can be one of:
+ - ``pyb.Pin.PULL_NONE`` - no pull up or down resistors;
+ - ``pyb.Pin.PULL_UP`` - enable the pull-up resistor;
+ - ``pyb.Pin.PULL_DOWN`` - enable the pull-down resistor.
+ - ``callback`` is the function to call when the interrupt triggers. The
+ callback function must accept exactly 1 argument, which is the line that
+ triggered the interrupt.
+
+
+Class methods
+-------------
+
+.. classmethod:: ExtInt.regs()
+
+ Dump the values of the EXTI registers.
+
+
+Methods
+-------
+
+.. method:: ExtInt.disable()
+
+ Disable the interrupt associated with the ExtInt object.
+ This could be useful for debouncing.
+
+.. method:: ExtInt.enable()
+
+ Enable a disabled interrupt.
+
+.. method:: ExtInt.line()
+
+ Return the line number that the pin is mapped to.
+
+.. method:: ExtInt.swint()
+
+ Trigger the callback from software.
+
+
+Constants
+---------
+
+.. data:: ExtInt.IRQ_FALLING
+
+ interrupt on a falling edge
+
+.. data:: ExtInt.IRQ_RISING
+
+ interrupt on a rising edge
+
+.. data:: ExtInt.IRQ_RISING_FALLING
+
+ interrupt on a rising or falling edge
diff --git a/components/language/micropython/docs/library/pyb.Flash.rst b/components/language/micropython/docs/library/pyb.Flash.rst
new file mode 100644
index 00000000..01b3a0ac
--- /dev/null
+++ b/components/language/micropython/docs/library/pyb.Flash.rst
@@ -0,0 +1,53 @@
+.. currentmodule:: pyb
+.. _pyb.Flash:
+
+class Flash -- access to built-in flash storage
+===============================================
+
+The Flash class allows direct access to the primary flash device on the pyboard.
+
+In most cases, to store persistent data on the device, you'll want to use a
+higher-level abstraction, for example the filesystem via Python's standard file
+API, but this interface is useful to :ref:`customise the filesystem
+configuration ` or implement a low-level storage system for your
+application.
+
+Constructors
+------------
+
+.. class:: pyb.Flash()
+
+ Create and return a block device that represents the flash device presented
+ to the USB mass storage interface.
+
+ It includes a virtual partition table at the start, and the actual flash
+ starts at block ``0x100``.
+
+ This constructor is deprecated and will be removed in a future version of MicroPython.
+
+.. class:: pyb.Flash(*, start=-1, len=-1)
+ :noindex:
+
+ Create and return a block device that accesses the flash at the specified offset. The length defaults to the remaining size of the device.
+
+ The *start* and *len* offsets are in bytes, and must be a multiple of the block size (typically 512 for internal flash).
+
+Methods
+-------
+
+.. method:: Flash.readblocks(block_num, buf)
+ Flash.readblocks(block_num, buf, offset)
+.. method:: Flash.writeblocks(block_num, buf)
+ Flash.writeblocks(block_num, buf, offset)
+.. method:: Flash.ioctl(cmd, arg)
+
+ These methods implement the simple and :ref:`extended
+ ` block protocol defined by
+ :class:`os.AbstractBlockDev`.
+
+Hardware Note
+-------------
+
+On boards with external spiflash (e.g. Pyboard D), the MicroPython firmware will
+be configured to use that as the primary flash storage. On all other boards, the
+internal flash inside the :term:`MCU` will be used.
diff --git a/components/language/micropython/docs/library/pyb.I2C.rst b/components/language/micropython/docs/library/pyb.I2C.rst
new file mode 100644
index 00000000..f60b5068
--- /dev/null
+++ b/components/language/micropython/docs/library/pyb.I2C.rst
@@ -0,0 +1,165 @@
+.. currentmodule:: pyb
+.. _pyb.I2C:
+
+class I2C -- a two-wire serial protocol
+=======================================
+
+I2C is a two-wire protocol for communicating between devices. At the physical
+level it consists of 2 wires: SCL and SDA, the clock and data lines respectively.
+
+I2C objects are created attached to a specific bus. They can be initialised
+when created, or initialised later on.
+
+Example::
+
+ from pyb import I2C
+
+ i2c = I2C(1) # create on bus 1
+ i2c = I2C(1, I2C.CONTROLLER) # create and init as a controller
+ i2c.init(I2C.CONTROLLER, baudrate=20000) # init as a controller
+ i2c.init(I2C.PERIPHERAL, addr=0x42) # init as a peripheral with given address
+ i2c.deinit() # turn off the I2C unit
+
+Printing the i2c object gives you information about its configuration.
+
+The basic methods are send and recv::
+
+ i2c.send('abc') # send 3 bytes
+ i2c.send(0x42) # send a single byte, given by the number
+ data = i2c.recv(3) # receive 3 bytes
+
+To receive inplace, first create a bytearray::
+
+ data = bytearray(3) # create a buffer
+ i2c.recv(data) # receive 3 bytes, writing them into data
+
+You can specify a timeout (in ms)::
+
+ i2c.send(b'123', timeout=2000) # timeout after 2 seconds
+
+A controller must specify the recipient's address::
+
+ i2c.init(I2C.CONTROLLER)
+ i2c.send('123', 0x42) # send 3 bytes to peripheral with address 0x42
+ i2c.send(b'456', addr=0x42) # keyword for address
+
+Master also has other methods::
+
+ i2c.is_ready(0x42) # check if peripheral 0x42 is ready
+ i2c.scan() # scan for peripherals on the bus, returning
+ # a list of valid addresses
+ i2c.mem_read(3, 0x42, 2) # read 3 bytes from memory of peripheral 0x42,
+ # starting at address 2 in the peripheral
+ i2c.mem_write('abc', 0x42, 2, timeout=1000) # write 'abc' (3 bytes) to memory of peripheral 0x42
+ # starting at address 2 in the peripheral, timeout after 1 second
+
+Constructors
+------------
+
+.. class:: pyb.I2C(bus, ...)
+
+ Construct an I2C object on the given bus. ``bus`` can be 1 or 2, 'X' or
+ 'Y'. With no additional parameters, the I2C object is created but not
+ initialised (it has the settings from the last initialisation of
+ the bus, if any). If extra arguments are given, the bus is initialised.
+ See ``init`` for parameters of initialisation.
+
+ The physical pins of the I2C buses on Pyboards V1.0 and V1.1 are:
+
+ - ``I2C(1)`` is on the X position: ``(SCL, SDA) = (X9, X10) = (PB6, PB7)``
+ - ``I2C(2)`` is on the Y position: ``(SCL, SDA) = (Y9, Y10) = (PB10, PB11)``
+
+ On the Pyboard Lite:
+
+ - ``I2C(1)`` is on the X position: ``(SCL, SDA) = (X9, X10) = (PB6, PB7)``
+ - ``I2C(3)`` is on the Y position: ``(SCL, SDA) = (Y9, Y10) = (PA8, PB8)``
+
+ Calling the constructor with 'X' or 'Y' enables portability between Pyboard
+ types.
+
+Methods
+-------
+
+.. method:: I2C.deinit()
+
+ Turn off the I2C bus.
+
+.. method:: I2C.init(mode, *, addr=0x12, baudrate=400000, gencall=False, dma=False)
+
+ Initialise the I2C bus with the given parameters:
+
+ - ``mode`` must be either ``I2C.CONTROLLER`` or ``I2C.PERIPHERAL``
+ - ``addr`` is the 7-bit address (only sensible for a peripheral)
+ - ``baudrate`` is the SCL clock rate (only sensible for a controller)
+ - ``gencall`` is whether to support general call mode
+ - ``dma`` is whether to allow the use of DMA for the I2C transfers (note
+ that DMA transfers have more precise timing but currently do not handle bus
+ errors properly)
+
+.. method:: I2C.is_ready(addr)
+
+ Check if an I2C device responds to the given address. Only valid when in controller mode.
+
+.. method:: I2C.mem_read(data, addr, memaddr, *, timeout=5000, addr_size=8)
+
+ Read from the memory of an I2C device:
+
+ - ``data`` can be an integer (number of bytes to read) or a buffer to read into
+ - ``addr`` is the I2C device address
+ - ``memaddr`` is the memory location within the I2C device
+ - ``timeout`` is the timeout in milliseconds to wait for the read
+ - ``addr_size`` selects width of memaddr: 8 or 16 bits
+
+ Returns the read data.
+ This is only valid in controller mode.
+
+.. method:: I2C.mem_write(data, addr, memaddr, *, timeout=5000, addr_size=8)
+
+ Write to the memory of an I2C device:
+
+ - ``data`` can be an integer or a buffer to write from
+ - ``addr`` is the I2C device address
+ - ``memaddr`` is the memory location within the I2C device
+ - ``timeout`` is the timeout in milliseconds to wait for the write
+ - ``addr_size`` selects width of memaddr: 8 or 16 bits
+
+ Returns ``None``.
+ This is only valid in controller mode.
+
+.. method:: I2C.recv(recv, addr=0x00, *, timeout=5000)
+
+ Receive data on the bus:
+
+ - ``recv`` can be an integer, which is the number of bytes to receive,
+ or a mutable buffer, which will be filled with received bytes
+ - ``addr`` is the address to receive from (only required in controller mode)
+ - ``timeout`` is the timeout in milliseconds to wait for the receive
+
+ Return value: if ``recv`` is an integer then a new buffer of the bytes received,
+ otherwise the same buffer that was passed in to ``recv``.
+
+.. method:: I2C.send(send, addr=0x00, *, timeout=5000)
+
+ Send data on the bus:
+
+ - ``send`` is the data to send (an integer to send, or a buffer object)
+ - ``addr`` is the address to send to (only required in controller mode)
+ - ``timeout`` is the timeout in milliseconds to wait for the send
+
+ Return value: ``None``.
+
+.. method:: I2C.scan()
+
+ Scan all I2C addresses from 0x01 to 0x7f and return a list of those that respond.
+ Only valid when in controller mode.
+
+Constants
+---------
+
+.. data:: I2C.CONTROLLER
+
+ for initialising the bus to controller mode
+
+.. data:: I2C.PERIPHERAL
+
+ for initialising the bus to peripheral mode
diff --git a/components/language/micropython/docs/library/pyb.LCD.rst b/components/language/micropython/docs/library/pyb.LCD.rst
new file mode 100644
index 00000000..018902ca
--- /dev/null
+++ b/components/language/micropython/docs/library/pyb.LCD.rst
@@ -0,0 +1,97 @@
+.. currentmodule:: pyb
+.. _pyb.LCD:
+
+class LCD -- LCD control for the LCD touch-sensor pyskin
+========================================================
+
+The LCD class is used to control the LCD on the LCD touch-sensor pyskin,
+LCD32MKv1.0. The LCD is a 128x32 pixel monochrome screen, part NHD-C12832A1Z.
+
+The pyskin must be connected in either the X or Y positions, and then
+an LCD object is made using::
+
+ lcd = pyb.LCD('X') # if pyskin is in the X position
+ lcd = pyb.LCD('Y') # if pyskin is in the Y position
+
+Then you can use::
+
+ lcd.light(True) # turn the backlight on
+ lcd.write('Hello world!\n') # print text to the screen
+
+This driver implements a double buffer for setting/getting pixels.
+For example, to make a bouncing dot, try::
+
+ x = y = 0
+ dx = dy = 1
+ while True:
+ # update the dot's position
+ x += dx
+ y += dy
+
+ # make the dot bounce of the edges of the screen
+ if x <= 0 or x >= 127: dx = -dx
+ if y <= 0 or y >= 31: dy = -dy
+
+ lcd.fill(0) # clear the buffer
+ lcd.pixel(x, y, 1) # draw the dot
+ lcd.show() # show the buffer
+ pyb.delay(50) # pause for 50ms
+
+
+Constructors
+------------
+
+.. class:: pyb.LCD(skin_position)
+
+ Construct an LCD object in the given skin position. ``skin_position`` can be 'X' or 'Y', and
+ should match the position where the LCD pyskin is plugged in.
+
+
+Methods
+-------
+
+.. method:: LCD.command(instr_data, buf)
+
+ Send an arbitrary command to the LCD. Pass 0 for ``instr_data`` to send an
+ instruction, otherwise pass 1 to send data. ``buf`` is a buffer with the
+ instructions/data to send.
+
+.. method:: LCD.contrast(value)
+
+ Set the contrast of the LCD. Valid values are between 0 and 47.
+
+.. method:: LCD.fill(colour)
+
+ Fill the screen with the given colour (0 or 1 for white or black).
+
+ This method writes to the hidden buffer. Use ``show()`` to show the buffer.
+
+.. method:: LCD.get(x, y)
+
+ Get the pixel at the position ``(x, y)``. Returns 0 or 1.
+
+ This method reads from the visible buffer.
+
+.. method:: LCD.light(value)
+
+ Turn the backlight on/off. True or 1 turns it on, False or 0 turns it off.
+
+.. method:: LCD.pixel(x, y, colour)
+
+ Set the pixel at ``(x, y)`` to the given colour (0 or 1).
+
+ This method writes to the hidden buffer. Use ``show()`` to show the buffer.
+
+.. method:: LCD.show()
+
+ Show the hidden buffer on the screen.
+
+.. method:: LCD.text(str, x, y, colour)
+
+ Draw the given text to the position ``(x, y)`` using the given colour (0 or 1).
+
+ This method writes to the hidden buffer. Use ``show()`` to show the buffer.
+
+.. method:: LCD.write(str)
+
+ Write the string ``str`` to the screen. It will appear immediately.
diff --git a/components/language/micropython/docs/library/pyb.LED.rst b/components/language/micropython/docs/library/pyb.LED.rst
new file mode 100644
index 00000000..d3ab965e
--- /dev/null
+++ b/components/language/micropython/docs/library/pyb.LED.rst
@@ -0,0 +1,46 @@
+.. currentmodule:: pyb
+.. _pyb.LED:
+
+class LED -- LED object
+=======================
+
+The LED object controls an individual LED (Light Emitting Diode).
+
+
+Constructors
+------------
+
+.. class:: pyb.LED(id)
+
+ Create an LED object associated with the given LED:
+
+ - ``id`` is the LED number, 1-4.
+
+
+Methods
+-------
+
+.. method:: LED.intensity([value])
+
+ Get or set the LED intensity. Intensity ranges between 0 (off) and 255 (full on).
+ If no argument is given, return the LED intensity.
+ If an argument is given, set the LED intensity and return ``None``.
+
+ *Note:* Only LED(3) and LED(4) can have a smoothly varying intensity, and
+ they use timer PWM to implement it. LED(3) uses Timer(2) and LED(4) uses
+ Timer(3). These timers are only configured for PWM if the intensity of the
+ relevant LED is set to a value between 1 and 254. Otherwise the timers are
+ free for general purpose use.
+
+.. method:: LED.off()
+
+ Turn the LED off.
+
+.. method:: LED.on()
+
+ Turn the LED on, to maximum intensity.
+
+.. method:: LED.toggle()
+
+ Toggle the LED between on (maximum intensity) and off. If the LED is at
+ non-zero intensity then it is considered "on" and toggle will turn it off.
diff --git a/components/language/micropython/docs/library/pyb.Pin.rst b/components/language/micropython/docs/library/pyb.Pin.rst
new file mode 100644
index 00000000..33b994e3
--- /dev/null
+++ b/components/language/micropython/docs/library/pyb.Pin.rst
@@ -0,0 +1,271 @@
+.. currentmodule:: pyb
+.. _pyb.Pin:
+
+class Pin -- control I/O pins
+=============================
+
+A pin is the basic object to control I/O pins. It has methods to set
+the mode of the pin (input, output, etc) and methods to get and set the
+digital logic level. For analog control of a pin, see the ADC class.
+
+Usage Model:
+
+All Board Pins are predefined as pyb.Pin.board.Name::
+
+ x1_pin = pyb.Pin.board.X1
+
+ g = pyb.Pin(pyb.Pin.board.X1, pyb.Pin.IN)
+
+CPU pins which correspond to the board pins are available
+as ``pyb.Pin.cpu.Name``. For the CPU pins, the names are the port letter
+followed by the pin number. On the PYBv1.0, ``pyb.Pin.board.X1`` and
+``pyb.Pin.cpu.A0`` are the same pin.
+
+You can also use strings::
+
+ g = pyb.Pin('X1', pyb.Pin.OUT_PP)
+
+Users can add their own names::
+
+ MyMapperDict = { 'LeftMotorDir' : pyb.Pin.cpu.C12 }
+ pyb.Pin.dict(MyMapperDict)
+ g = pyb.Pin("LeftMotorDir", pyb.Pin.OUT_OD)
+
+and can query mappings::
+
+ pin = pyb.Pin("LeftMotorDir")
+
+Users can also add their own mapping function::
+
+ def MyMapper(pin_name):
+ if pin_name == "LeftMotorDir":
+ return pyb.Pin.cpu.A0
+
+ pyb.Pin.mapper(MyMapper)
+
+So, if you were to call: ``pyb.Pin("LeftMotorDir", pyb.Pin.OUT_PP)``
+then ``"LeftMotorDir"`` is passed directly to the mapper function.
+
+To summarise, the following order determines how things get mapped into
+an ordinal pin number:
+
+1. Directly specify a pin object
+2. User supplied mapping function
+3. User supplied mapping (object must be usable as a dictionary key)
+4. Supply a string which matches a board pin
+5. Supply a string which matches a CPU port/pin
+
+You can set ``pyb.Pin.debug(True)`` to get some debug information about
+how a particular object gets mapped to a pin.
+
+When a pin has the ``Pin.PULL_UP`` or ``Pin.PULL_DOWN`` pull-mode enabled,
+that pin has an effective 40k Ohm resistor pulling it to 3V3 or GND
+respectively (except pin Y5 which has 11k Ohm resistors).
+
+Now every time a falling edge is seen on the gpio pin, the callback will be
+executed. Caution: mechanical push buttons have "bounce" and pushing or
+releasing a switch will often generate multiple edges.
+See: http://www.eng.utah.edu/~cs5780/debouncing.pdf for a detailed
+explanation, along with various techniques for debouncing.
+
+All pin objects go through the pin mapper to come up with one of the
+gpio pins.
+
+Constructors
+------------
+
+.. class:: pyb.Pin(id, ...)
+
+ Create a new Pin object associated with the id. If additional arguments are given,
+ they are used to initialise the pin. See :meth:`pin.init`.
+
+Class methods
+-------------
+
+.. classmethod:: Pin.debug([state])
+
+ Get or set the debugging state (``True`` or ``False`` for on or off).
+
+.. classmethod:: Pin.dict([dict])
+
+ Get or set the pin mapper dictionary.
+
+.. classmethod:: Pin.mapper([fun])
+
+ Get or set the pin mapper function.
+
+
+Methods
+-------
+
+.. method:: Pin.init(mode, pull=Pin.PULL_NONE, *, value=None, alt=-1)
+
+ Initialise the pin:
+
+ - *mode* can be one of:
+
+ - ``Pin.IN`` - configure the pin for input;
+ - ``Pin.OUT_PP`` - configure the pin for output, with push-pull control;
+ - ``Pin.OUT_OD`` - configure the pin for output, with open-drain control;
+ - ``Pin.AF_PP`` - configure the pin for alternate function, pull-pull;
+ - ``Pin.AF_OD`` - configure the pin for alternate function, open-drain;
+ - ``Pin.ANALOG`` - configure the pin for analog.
+
+ - *pull* can be one of:
+
+ - ``Pin.PULL_NONE`` - no pull up or down resistors;
+ - ``Pin.PULL_UP`` - enable the pull-up resistor;
+ - ``Pin.PULL_DOWN`` - enable the pull-down resistor.
+
+ - *value* if not None will set the port output value before enabling the pin.
+
+ - *alt* can be used when mode is ``Pin.AF_PP`` or ``Pin.AF_OD`` to set the
+ index or name of one of the alternate functions associated with a pin.
+ This arg was previously called *af* which can still be used if needed.
+
+ Returns: ``None``.
+
+.. method:: Pin.value([value])
+
+ Get or set the digital logic level of the pin:
+
+ - With no argument, return 0 or 1 depending on the logic level of the pin.
+ - With ``value`` given, set the logic level of the pin. ``value`` can be
+ anything that converts to a boolean. If it converts to ``True``, the pin
+ is set high, otherwise it is set low.
+
+.. method:: Pin.__str__()
+
+ Return a string describing the pin object.
+
+.. method:: Pin.af()
+
+ Returns the currently configured alternate-function of the pin. The
+ integer returned will match one of the allowed constants for the af
+ argument to the init function.
+
+.. method:: Pin.af_list()
+
+ Returns an array of alternate functions available for this pin.
+
+.. method:: Pin.gpio()
+
+ Returns the base address of the GPIO block associated with this pin.
+
+.. method:: Pin.mode()
+
+ Returns the currently configured mode of the pin. The integer returned
+ will match one of the allowed constants for the mode argument to the init
+ function.
+
+.. method:: Pin.name()
+
+ Get the pin name.
+
+.. method:: Pin.names()
+
+ Returns the cpu and board names for this pin.
+
+.. method:: Pin.pin()
+
+ Get the pin number.
+
+.. method:: Pin.port()
+
+ Get the pin port.
+
+.. method:: Pin.pull()
+
+ Returns the currently configured pull of the pin. The integer returned
+ will match one of the allowed constants for the pull argument to the init
+ function.
+
+Constants
+---------
+
+.. data:: Pin.AF_OD
+
+ initialise the pin to alternate-function mode with an open-drain drive
+
+.. data:: Pin.AF_PP
+
+ initialise the pin to alternate-function mode with a push-pull drive
+
+.. data:: Pin.ANALOG
+
+ initialise the pin to analog mode
+
+.. data:: Pin.IN
+
+ initialise the pin to input mode
+
+.. data:: Pin.OUT_OD
+
+ initialise the pin to output mode with an open-drain drive
+
+.. data:: Pin.OUT_PP
+
+ initialise the pin to output mode with a push-pull drive
+
+.. data:: Pin.PULL_DOWN
+
+ enable the pull-down resistor on the pin
+
+.. data:: Pin.PULL_NONE
+
+ don't enable any pull up or down resistors on the pin
+
+.. data:: Pin.PULL_UP
+
+ enable the pull-up resistor on the pin
+
+class PinAF -- Pin Alternate Functions
+======================================
+
+A Pin represents a physical pin on the microprocessor. Each pin
+can have a variety of functions (GPIO, I2C SDA, etc). Each PinAF
+object represents a particular function for a pin.
+
+Usage Model::
+
+ x3 = pyb.Pin.board.X3
+ x3_af = x3.af_list()
+
+x3_af will now contain an array of PinAF objects which are available on
+pin X3.
+
+For the pyboard, x3_af would contain:
+ [Pin.AF1_TIM2, Pin.AF2_TIM5, Pin.AF3_TIM9, Pin.AF7_USART2]
+
+Normally, each peripheral would configure the alternate function automatically,
+but sometimes the same function is available on multiple pins, and having more
+control is desired.
+
+To configure X3 to expose TIM2_CH3, you could use::
+
+ pin = pyb.Pin(pyb.Pin.board.X3, mode=pyb.Pin.AF_PP, alt=pyb.Pin.AF1_TIM2)
+
+or::
+
+ pin = pyb.Pin(pyb.Pin.board.X3, mode=pyb.Pin.AF_PP, alt=1)
+
+Methods
+-------
+
+.. method:: pinaf.__str__()
+
+ Return a string describing the alternate function.
+
+.. method:: pinaf.index()
+
+ Return the alternate function index.
+
+.. method:: pinaf.name()
+
+ Return the name of the alternate function.
+
+.. method:: pinaf.reg()
+
+ Return the base register associated with the peripheral assigned to this
+ alternate function. For example, if the alternate function were TIM2_CH3
+ this would return stm.TIM2
diff --git a/components/language/micropython/docs/library/pyb.RTC.rst b/components/language/micropython/docs/library/pyb.RTC.rst
new file mode 100644
index 00000000..c477e7f0
--- /dev/null
+++ b/components/language/micropython/docs/library/pyb.RTC.rst
@@ -0,0 +1,78 @@
+.. currentmodule:: pyb
+.. _pyb.RTC:
+
+class RTC -- real time clock
+============================
+
+The RTC is an independent clock that keeps track of the date
+and time.
+
+Example usage::
+
+ rtc = pyb.RTC()
+ rtc.datetime((2014, 5, 1, 4, 13, 0, 0, 0))
+ print(rtc.datetime())
+
+
+Constructors
+------------
+
+.. class:: pyb.RTC()
+
+ Create an RTC object.
+
+
+Methods
+-------
+
+.. method:: RTC.datetime([datetimetuple])
+
+ Get or set the date and time of the RTC.
+
+ With no arguments, this method returns an 8-tuple with the current
+ date and time. With 1 argument (being an 8-tuple) it sets the date
+ and time (and ``subseconds`` is reset to 255).
+
+ The 8-tuple has the following format:
+
+ (year, month, day, weekday, hours, minutes, seconds, subseconds)
+
+ ``weekday`` is 1-7 for Monday through Sunday.
+
+ ``subseconds`` counts down from 255 to 0
+
+.. method:: RTC.wakeup(timeout, callback=None)
+
+ Set the RTC wakeup timer to trigger repeatedly at every ``timeout``
+ milliseconds. This trigger can wake the pyboard from both the sleep
+ states: :meth:`pyb.stop` and :meth:`pyb.standby`.
+
+ If ``timeout`` is ``None`` then the wakeup timer is disabled.
+
+ If ``callback`` is given then it is executed at every trigger of the
+ wakeup timer. ``callback`` must take exactly one argument.
+
+.. method:: RTC.info()
+
+ Get information about the startup time and reset source.
+
+ - The lower 0xffff are the number of milliseconds the RTC took to
+ start up.
+ - Bit 0x10000 is set if a power-on reset occurred.
+ - Bit 0x20000 is set if an external reset occurred
+
+.. method:: RTC.calibration(cal)
+
+ Get or set RTC calibration.
+
+ With no arguments, ``calibration()`` returns the current calibration
+ value, which is an integer in the range [-511 : 512]. With one
+ argument it sets the RTC calibration.
+
+ The RTC Smooth Calibration mechanism adjusts the RTC clock rate by
+ adding or subtracting the given number of ticks from the 32768 Hz
+ clock over a 32 second period (corresponding to 2^20 clock ticks.)
+ Each tick added will speed up the clock by 1 part in 2^20, or 0.954
+ ppm; likewise the RTC clock it slowed by negative values. The
+ usable calibration range is:
+ (-511 * 0.954) ~= -487.5 ppm up to (512 * 0.954) ~= 488.5 ppm
diff --git a/components/language/micropython/docs/library/pyb.SPI.rst b/components/language/micropython/docs/library/pyb.SPI.rst
new file mode 100644
index 00000000..14b90a22
--- /dev/null
+++ b/components/language/micropython/docs/library/pyb.SPI.rst
@@ -0,0 +1,123 @@
+.. currentmodule:: pyb
+.. _pyb.SPI:
+
+class SPI -- a controller-driven serial protocol
+================================================
+
+SPI is a serial protocol that is driven by a controller. At the physical level
+there are 3 lines: SCK, MOSI, MISO.
+
+See usage model of I2C; SPI is very similar. Main difference is
+parameters to init the SPI bus::
+
+ from pyb import SPI
+ spi = SPI(1, SPI.CONTROLLER, baudrate=600000, polarity=1, phase=0, crc=0x7)
+
+Only required parameter is mode, SPI.CONTROLLER or SPI.PERIPHERAL. Polarity can be
+0 or 1, and is the level the idle clock line sits at. Phase can be 0 or 1
+to sample data on the first or second clock edge respectively. Crc can be
+None for no CRC, or a polynomial specifier.
+
+Additional methods for SPI::
+
+ data = spi.send_recv(b'1234') # send 4 bytes and receive 4 bytes
+ buf = bytearray(4)
+ spi.send_recv(b'1234', buf) # send 4 bytes and receive 4 into buf
+ spi.send_recv(buf, buf) # send/recv 4 bytes from/to buf
+
+Constructors
+------------
+
+.. class:: pyb.SPI(bus, ...)
+
+ Construct an SPI object on the given bus. ``bus`` can be 1 or 2, or
+ 'X' or 'Y'. With no additional parameters, the SPI object is created but
+ not initialised (it has the settings from the last initialisation of
+ the bus, if any). If extra arguments are given, the bus is initialised.
+ See ``init`` for parameters of initialisation.
+
+ The physical pins of the SPI buses are:
+
+ - ``SPI(1)`` is on the X position: ``(NSS, SCK, MISO, MOSI) = (X5, X6, X7, X8) = (PA4, PA5, PA6, PA7)``
+ - ``SPI(2)`` is on the Y position: ``(NSS, SCK, MISO, MOSI) = (Y5, Y6, Y7, Y8) = (PB12, PB13, PB14, PB15)``
+
+ At the moment, the NSS pin is not used by the SPI driver and is free
+ for other use.
+
+Methods
+-------
+
+.. method:: SPI.deinit()
+
+ Turn off the SPI bus.
+
+.. method:: SPI.init(mode, baudrate=328125, *, prescaler=-1, polarity=1, phase=0, bits=8, firstbit=SPI.MSB, ti=False, crc=None)
+
+ Initialise the SPI bus with the given parameters:
+
+ - ``mode`` must be either ``SPI.CONTROLLER`` or ``SPI.PERIPHERAL``.
+ - ``baudrate`` is the SCK clock rate (only sensible for a controller).
+ - ``prescaler`` is the prescaler to use to derive SCK from the APB bus frequency;
+ use of ``prescaler`` overrides ``baudrate``.
+ - ``polarity`` can be 0 or 1, and is the level the idle clock line sits at.
+ - ``phase`` can be 0 or 1 to sample data on the first or second clock edge
+ respectively.
+ - ``bits`` can be 8 or 16, and is the number of bits in each transferred word.
+ - ``firstbit`` can be ``SPI.MSB`` or ``SPI.LSB``.
+ - ``ti`` True indicates Texas Instruments, as opposed to Motorola, signal conventions.
+ - ``crc`` can be None for no CRC, or a polynomial specifier.
+
+ Note that the SPI clock frequency will not always be the requested baudrate.
+ The hardware only supports baudrates that are the APB bus frequency
+ (see :meth:`pyb.freq`) divided by a prescaler, which can be 2, 4, 8, 16, 32,
+ 64, 128 or 256. SPI(1) is on AHB2, and SPI(2) is on AHB1. For precise
+ control over the SPI clock frequency, specify ``prescaler`` instead of
+ ``baudrate``.
+
+ Printing the SPI object will show you the computed baudrate and the chosen
+ prescaler.
+
+.. method:: SPI.recv(recv, *, timeout=5000)
+
+ Receive data on the bus:
+
+ - ``recv`` can be an integer, which is the number of bytes to receive,
+ or a mutable buffer, which will be filled with received bytes.
+ - ``timeout`` is the timeout in milliseconds to wait for the receive.
+
+ Return value: if ``recv`` is an integer then a new buffer of the bytes received,
+ otherwise the same buffer that was passed in to ``recv``.
+
+.. method:: SPI.send(send, *, timeout=5000)
+
+ Send data on the bus:
+
+ - ``send`` is the data to send (an integer to send, or a buffer object).
+ - ``timeout`` is the timeout in milliseconds to wait for the send.
+
+ Return value: ``None``.
+
+.. method:: SPI.send_recv(send, recv=None, *, timeout=5000)
+
+ Send and receive data on the bus at the same time:
+
+ - ``send`` is the data to send (an integer to send, or a buffer object).
+ - ``recv`` is a mutable buffer which will be filled with received bytes.
+ It can be the same as ``send``, or omitted. If omitted, a new buffer will
+ be created.
+ - ``timeout`` is the timeout in milliseconds to wait for the receive.
+
+ Return value: the buffer with the received bytes.
+
+Constants
+---------
+
+.. data:: SPI.CONTROLLER
+.. data:: SPI.PERIPHERAL
+
+ for initialising the SPI bus to controller or peripheral mode
+
+.. data:: SPI.LSB
+.. data:: SPI.MSB
+
+ set the first bit to be the least or most significant bit
diff --git a/components/language/micropython/docs/library/pyb.Servo.rst b/components/language/micropython/docs/library/pyb.Servo.rst
new file mode 100644
index 00000000..b3ce71d1
--- /dev/null
+++ b/components/language/micropython/docs/library/pyb.Servo.rst
@@ -0,0 +1,80 @@
+.. currentmodule:: pyb
+.. _pyb.Servo:
+
+class Servo -- 3-wire hobby servo driver
+========================================
+
+Servo objects control standard hobby servo motors with 3-wires (ground, power,
+signal). There are 4 positions on the pyboard where these motors can be plugged
+in: pins X1 through X4 are the signal pins, and next to them are 4 sets of power
+and ground pins.
+
+Example usage::
+
+ import pyb
+
+ s1 = pyb.Servo(1) # create a servo object on position X1
+ s2 = pyb.Servo(2) # create a servo object on position X2
+
+ s1.angle(45) # move servo 1 to 45 degrees
+ s2.angle(0) # move servo 2 to 0 degrees
+
+ # move servo1 and servo2 synchronously, taking 1500ms
+ s1.angle(-60, 1500)
+ s2.angle(30, 1500)
+
+.. note:: The Servo objects use Timer(5) to produce the PWM output. You can
+ use Timer(5) for Servo control, or your own purposes, but not both at the
+ same time.
+
+Constructors
+------------
+
+.. class:: pyb.Servo(id)
+
+ Create a servo object. ``id`` is 1-4, and corresponds to pins X1 through X4.
+
+
+Methods
+-------
+
+.. method:: Servo.angle([angle, time=0])
+
+ If no arguments are given, this function returns the current angle.
+
+ If arguments are given, this function sets the angle of the servo:
+
+ - ``angle`` is the angle to move to in degrees.
+ - ``time`` is the number of milliseconds to take to get to the specified
+ angle. If omitted, then the servo moves as quickly as possible to its
+ new position.
+
+.. method:: Servo.speed([speed, time=0])
+
+ If no arguments are given, this function returns the current speed.
+
+ If arguments are given, this function sets the speed of the servo:
+
+ - ``speed`` is the speed to change to, between -100 and 100.
+ - ``time`` is the number of milliseconds to take to get to the specified
+ speed. If omitted, then the servo accelerates as quickly as possible.
+
+.. method:: Servo.pulse_width([value])
+
+ If no arguments are given, this function returns the current raw pulse-width
+ value.
+
+ If an argument is given, this function sets the raw pulse-width value.
+
+.. method:: Servo.calibration([pulse_min, pulse_max, pulse_centre, [pulse_angle_90, pulse_speed_100]])
+
+ If no arguments are given, this function returns the current calibration
+ data, as a 5-tuple.
+
+ If arguments are given, this function sets the timing calibration:
+
+ - ``pulse_min`` is the minimum allowed pulse width.
+ - ``pulse_max`` is the maximum allowed pulse width.
+ - ``pulse_centre`` is the pulse width corresponding to the centre/zero position.
+ - ``pulse_angle_90`` is the pulse width corresponding to 90 degrees.
+ - ``pulse_speed_100`` is the pulse width corresponding to a speed of 100.
diff --git a/components/language/micropython/docs/library/pyb.Switch.rst b/components/language/micropython/docs/library/pyb.Switch.rst
new file mode 100644
index 00000000..1edcbf84
--- /dev/null
+++ b/components/language/micropython/docs/library/pyb.Switch.rst
@@ -0,0 +1,46 @@
+.. currentmodule:: pyb
+.. _pyb.Switch:
+
+class Switch -- switch object
+=============================
+
+A Switch object is used to control a push-button switch.
+
+Usage::
+
+ sw = pyb.Switch() # create a switch object
+ sw.value() # get state (True if pressed, False otherwise)
+ sw() # shorthand notation to get the switch state
+ sw.callback(f) # register a callback to be called when the
+ # switch is pressed down
+ sw.callback(None) # remove the callback
+
+Example::
+
+ pyb.Switch().callback(lambda: pyb.LED(1).toggle())
+
+
+Constructors
+------------
+
+.. class:: pyb.Switch()
+
+ Create and return a switch object.
+
+
+Methods
+-------
+
+.. method:: Switch.__call__()
+
+ Call switch object directly to get its state: ``True`` if pressed down,
+ ``False`` otherwise.
+
+.. method:: Switch.value()
+
+ Get the switch state. Returns ``True`` if pressed down, otherwise ``False``.
+
+.. method:: Switch.callback(fun)
+
+ Register the given function to be called when the switch is pressed down.
+ If ``fun`` is ``None``, then it disables the callback.
diff --git a/components/language/micropython/docs/library/pyb.Timer.rst b/components/language/micropython/docs/library/pyb.Timer.rst
new file mode 100644
index 00000000..cc7a01f5
--- /dev/null
+++ b/components/language/micropython/docs/library/pyb.Timer.rst
@@ -0,0 +1,273 @@
+.. currentmodule:: pyb
+.. _pyb.Timer:
+
+class Timer -- control internal timers
+======================================
+
+Timers can be used for a great variety of tasks. At the moment, only
+the simplest case is implemented: that of calling a function periodically.
+
+Each timer consists of a counter that counts up at a certain rate. The rate
+at which it counts is the peripheral clock frequency (in Hz) divided by the
+timer prescaler. When the counter reaches the timer period it triggers an
+event, and the counter resets back to zero. By using the callback method,
+the timer event can call a Python function.
+
+Example usage to toggle an LED at a fixed frequency::
+
+ tim = pyb.Timer(4) # create a timer object using timer 4
+ tim.init(freq=2) # trigger at 2Hz
+ tim.callback(lambda t:pyb.LED(1).toggle())
+
+Example using named function for the callback::
+
+ def tick(timer): # we will receive the timer object when being called
+ print(timer.counter()) # show current timer's counter value
+ tim = pyb.Timer(4, freq=1) # create a timer object using timer 4 - trigger at 1Hz
+ tim.callback(tick) # set the callback to our tick function
+
+Further examples::
+
+ tim = pyb.Timer(4, freq=100) # freq in Hz
+ tim = pyb.Timer(4, prescaler=0, period=99)
+ tim.counter() # get counter (can also set)
+ tim.prescaler(2) # set prescaler (can also get)
+ tim.period(199) # set period (can also get)
+ tim.callback(lambda t: ...) # set callback for update interrupt (t=tim instance)
+ tim.callback(None) # clear callback
+
+*Note:* Timer(2) and Timer(3) are used for PWM to set the intensity of LED(3)
+and LED(4) respectively. But these timers are only configured for PWM if
+the intensity of the relevant LED is set to a value between 1 and 254. If
+the intensity feature of the LEDs is not used then these timers are free for
+general purpose use. Similarly, Timer(5) controls the servo driver, and
+Timer(6) is used for timed ADC/DAC reading/writing. It is recommended to
+use the other timers in your programs.
+
+*Note:* Memory can't be allocated during a callback (an interrupt) and so
+exceptions raised within a callback don't give much information. See
+:func:`micropython.alloc_emergency_exception_buf` for how to get around this
+limitation.
+
+
+Constructors
+------------
+
+.. class:: pyb.Timer(id, ...)
+
+ Construct a new timer object of the given id. If additional
+ arguments are given, then the timer is initialised by ``init(...)``.
+ ``id`` can be 1 to 14.
+
+Methods
+-------
+
+.. method:: Timer.init(*, freq, prescaler, period, mode=Timer.UP, div=1, callback=None, deadtime=0)
+
+ Initialise the timer. Initialisation must be either by frequency (in Hz)
+ or by prescaler and period::
+
+ tim.init(freq=100) # set the timer to trigger at 100Hz
+ tim.init(prescaler=83, period=999) # set the prescaler and period directly
+
+ Keyword arguments:
+
+ - ``freq`` --- specifies the periodic frequency of the timer. You might also
+ view this as the frequency with which the timer goes through one complete cycle.
+
+ - ``prescaler`` [0-0xffff] - specifies the value to be loaded into the
+ timer's Prescaler Register (PSC). The timer clock source is divided by
+ (``prescaler + 1``) to arrive at the timer clock. Timers 2-7 and 12-14
+ have a clock source of 84 MHz (pyb.freq()[2] \* 2), and Timers 1, and 8-11
+ have a clock source of 168 MHz (pyb.freq()[3] \* 2).
+
+ - ``period`` [0-0xffff] for timers 1, 3, 4, and 6-15. [0-0x3fffffff] for timers 2 & 5.
+ Specifies the value to be loaded into the timer's AutoReload
+ Register (ARR). This determines the period of the timer (i.e. when the
+ counter cycles). The timer counter will roll-over after ``period + 1``
+ timer clock cycles.
+
+ - ``mode`` can be one of:
+
+ - ``Timer.UP`` - configures the timer to count from 0 to ARR (default)
+ - ``Timer.DOWN`` - configures the timer to count from ARR down to 0.
+ - ``Timer.CENTER`` - configures the timer to count from 0 to ARR and
+ then back down to 0.
+
+ - ``div`` can be one of 1, 2, or 4. Divides the timer clock to determine
+ the sampling clock used by the digital filters.
+
+ - ``callback`` - as per Timer.callback()
+
+ - ``deadtime`` - specifies the amount of "dead" or inactive time between
+ transitions on complimentary channels (both channels will be inactive)
+ for this time). ``deadtime`` may be an integer between 0 and 1008, with
+ the following restrictions: 0-128 in steps of 1. 128-256 in steps of
+ 2, 256-512 in steps of 8, and 512-1008 in steps of 16. ``deadtime``
+ measures ticks of ``source_freq`` divided by ``div`` clock ticks.
+ ``deadtime`` is only available on timers 1 and 8.
+
+ You must either specify freq or both of period and prescaler.
+
+.. method:: Timer.deinit()
+
+ Deinitialises the timer.
+
+ Disables the callback (and the associated irq).
+
+ Disables any channel callbacks (and the associated irq).
+ Stops the timer, and disables the timer peripheral.
+
+.. method:: Timer.callback(fun)
+
+ Set the function to be called when the timer triggers.
+ ``fun`` is passed 1 argument, the timer object.
+ If ``fun`` is ``None`` then the callback will be disabled.
+
+.. method:: Timer.channel(channel, mode, ...)
+
+ If only a channel number is passed, then a previously initialized channel
+ object is returned (or ``None`` if there is no previous channel).
+
+ Otherwise, a TimerChannel object is initialized and returned.
+
+ Each channel can be configured to perform pwm, output compare, or
+ input capture. All channels share the same underlying timer, which means
+ that they share the same timer clock.
+
+ Keyword arguments:
+
+ - ``mode`` can be one of:
+
+ - ``Timer.PWM`` --- configure the timer in PWM mode (active high).
+ - ``Timer.PWM_INVERTED`` --- configure the timer in PWM mode (active low).
+ - ``Timer.OC_TIMING`` --- indicates that no pin is driven.
+ - ``Timer.OC_ACTIVE`` --- the pin will be made active when a compare match occurs (active is determined by polarity)
+ - ``Timer.OC_INACTIVE`` --- the pin will be made inactive when a compare match occurs.
+ - ``Timer.OC_TOGGLE`` --- the pin will be toggled when an compare match occurs.
+ - ``Timer.OC_FORCED_ACTIVE`` --- the pin is forced active (compare match is ignored).
+ - ``Timer.OC_FORCED_INACTIVE`` --- the pin is forced inactive (compare match is ignored).
+ - ``Timer.IC`` --- configure the timer in Input Capture mode.
+ - ``Timer.ENC_A`` --- configure the timer in Encoder mode. The counter only changes when CH1 changes.
+ - ``Timer.ENC_B`` --- configure the timer in Encoder mode. The counter only changes when CH2 changes.
+ - ``Timer.ENC_AB`` --- configure the timer in Encoder mode. The counter changes when CH1 or CH2 changes.
+
+ - ``callback`` - as per TimerChannel.callback()
+
+ - ``pin`` None (the default) or a Pin object. If specified (and not None)
+ this will cause the alternate function of the the indicated pin
+ to be configured for this timer channel. An error will be raised if
+ the pin doesn't support any alternate functions for this timer channel.
+
+ Keyword arguments for Timer.PWM modes:
+
+ - ``pulse_width`` - determines the initial pulse width value to use.
+ - ``pulse_width_percent`` - determines the initial pulse width percentage to use.
+
+ Keyword arguments for Timer.OC modes:
+
+ - ``compare`` - determines the initial value of the compare register.
+
+ - ``polarity`` can be one of:
+
+ - ``Timer.HIGH`` - output is active high
+ - ``Timer.LOW`` - output is active low
+
+ Optional keyword arguments for Timer.IC modes:
+
+ - ``polarity`` can be one of:
+
+ - ``Timer.RISING`` - captures on rising edge.
+ - ``Timer.FALLING`` - captures on falling edge.
+ - ``Timer.BOTH`` - captures on both edges.
+
+ Note that capture only works on the primary channel, and not on the
+ complimentary channels.
+
+ Notes for Timer.ENC modes:
+
+ - Requires 2 pins, so one or both pins will need to be configured to use
+ the appropriate timer AF using the Pin API.
+ - Read the encoder value using the timer.counter() method.
+ - Only works on CH1 and CH2 (and not on CH1N or CH2N)
+ - The channel number is ignored when setting the encoder mode.
+
+ PWM Example::
+
+ timer = pyb.Timer(2, freq=1000)
+ ch2 = timer.channel(2, pyb.Timer.PWM, pin=pyb.Pin.board.X2, pulse_width=8000)
+ ch3 = timer.channel(3, pyb.Timer.PWM, pin=pyb.Pin.board.X3, pulse_width=16000)
+
+.. method:: Timer.counter([value])
+
+ Get or set the timer counter.
+
+.. method:: Timer.freq([value])
+
+ Get or set the frequency for the timer (changes prescaler and period if set).
+
+.. method:: Timer.period([value])
+
+ Get or set the period of the timer.
+
+.. method:: Timer.prescaler([value])
+
+ Get or set the prescaler for the timer.
+
+.. method:: Timer.source_freq()
+
+ Get the frequency of the source of the timer.
+
+class TimerChannel --- setup a channel for a timer
+==================================================
+
+Timer channels are used to generate/capture a signal using a timer.
+
+TimerChannel objects are created using the Timer.channel() method.
+
+Methods
+-------
+
+.. method:: timerchannel.callback(fun)
+
+ Set the function to be called when the timer channel triggers.
+ ``fun`` is passed 1 argument, the timer object.
+ If ``fun`` is ``None`` then the callback will be disabled.
+
+.. method:: timerchannel.capture([value])
+
+ Get or set the capture value associated with a channel.
+ capture, compare, and pulse_width are all aliases for the same function.
+ capture is the logical name to use when the channel is in input capture mode.
+
+.. method:: timerchannel.compare([value])
+
+ Get or set the compare value associated with a channel.
+ capture, compare, and pulse_width are all aliases for the same function.
+ compare is the logical name to use when the channel is in output compare mode.
+
+.. method:: timerchannel.pulse_width([value])
+
+ Get or set the pulse width value associated with a channel.
+ capture, compare, and pulse_width are all aliases for the same function.
+ pulse_width is the logical name to use when the channel is in PWM mode.
+
+ In edge aligned mode, a pulse_width of ``period + 1`` corresponds to a duty cycle of 100%
+ In center aligned mode, a pulse width of ``period`` corresponds to a duty cycle of 100%
+
+.. method:: timerchannel.pulse_width_percent([value])
+
+ Get or set the pulse width percentage associated with a channel. The value
+ is a number between 0 and 100 and sets the percentage of the timer period
+ for which the pulse is active. The value can be an integer or
+ floating-point number for more accuracy. For example, a value of 25 gives
+ a duty cycle of 25%.
+
+Constants
+---------
+
+.. data:: Timer.UP
+ Timer.DOWN
+ Timer.CENTER
+
+ Configures the timer to count Up, Down, or from 0 to ARR and then back down to 0.
diff --git a/components/language/micropython/docs/library/pyb.UART.rst b/components/language/micropython/docs/library/pyb.UART.rst
new file mode 100644
index 00000000..e1735403
--- /dev/null
+++ b/components/language/micropython/docs/library/pyb.UART.rst
@@ -0,0 +1,240 @@
+.. currentmodule:: pyb
+.. _pyb.UART:
+
+class UART -- duplex serial communication bus
+=============================================
+
+UART implements the standard UART/USART duplex serial communications protocol. At
+the physical level it consists of 2 lines: RX and TX. The unit of communication
+is a character (not to be confused with a string character) which can be 8 or 9
+bits wide.
+
+UART objects can be created and initialised using::
+
+ from pyb import UART
+
+ uart = UART(1, 9600) # init with given baudrate
+ uart.init(9600, bits=8, parity=None, stop=1) # init with given parameters
+
+Bits can be 7, 8 or 9. Parity can be None, 0 (even) or 1 (odd). Stop can be 1 or 2.
+
+*Note:* with parity=None, only 8 and 9 bits are supported. With parity enabled,
+only 7 and 8 bits are supported.
+
+A UART object acts like a `stream` object and reading and writing is done
+using the standard stream methods::
+
+ uart.read(10) # read 10 characters, returns a bytes object
+ uart.read() # read all available characters
+ uart.readline() # read a line
+ uart.readinto(buf) # read and store into the given buffer
+ uart.write('abc') # write the 3 characters
+
+Individual characters can be read/written using::
+
+ uart.readchar() # read 1 character and returns it as an integer
+ uart.writechar(42) # write 1 character
+
+To check if there is anything to be read, use::
+
+ uart.any() # returns the number of characters waiting
+
+
+*Note:* The stream functions ``read``, ``write``, etc. are new in MicroPython v1.3.4.
+Earlier versions use ``uart.send`` and ``uart.recv``.
+
+Constructors
+------------
+
+.. class:: pyb.UART(bus, ...)
+
+ Construct a UART object on the given bus.
+ For Pyboard ``bus`` can be 1-4, 6, 'XA', 'XB', 'YA', or 'YB'.
+ For Pyboard Lite ``bus`` can be 1, 2, 6, 'XB', or 'YA'.
+ For Pyboard D ``bus`` can be 1-4, 'XA', 'YA' or 'YB'.
+ With no additional parameters, the UART object is created but not
+ initialised (it has the settings from the last initialisation of
+ the bus, if any). If extra arguments are given, the bus is initialised.
+ See ``init`` for parameters of initialisation.
+
+ The physical pins of the UART buses on Pyboard are:
+
+ - ``UART(4)`` is on ``XA``: ``(TX, RX) = (X1, X2) = (PA0, PA1)``
+ - ``UART(1)`` is on ``XB``: ``(TX, RX) = (X9, X10) = (PB6, PB7)``
+ - ``UART(6)`` is on ``YA``: ``(TX, RX) = (Y1, Y2) = (PC6, PC7)``
+ - ``UART(3)`` is on ``YB``: ``(TX, RX) = (Y9, Y10) = (PB10, PB11)``
+ - ``UART(2)`` is on: ``(TX, RX) = (X3, X4) = (PA2, PA3)``
+
+ The Pyboard Lite supports UART(1), UART(2) and UART(6) only, pins are:
+
+ - ``UART(1)`` is on ``XB``: ``(TX, RX) = (X9, X10) = (PB6, PB7)``
+ - ``UART(6)`` is on ``YA``: ``(TX, RX) = (Y1, Y2) = (PC6, PC7)``
+ - ``UART(2)`` is on: ``(TX, RX) = (X1, X2) = (PA2, PA3)``
+
+ The Pyboard D supports UART(1), UART(2), UART(3) and UART(4) only, pins are:
+
+ - ``UART(4)`` is on ``XA``: ``(TX, RX) = (X1, X2) = (PA0, PA1)``
+ - ``UART(1)`` is on ``YA``: ``(TX, RX) = (Y1, Y2) = (PA9, PA10)``
+ - ``UART(3)`` is on ``YB``: ``(TX, RX) = (Y9, Y10) = (PB10, PB11)``
+ - ``UART(2)`` is on: ``(TX, RX) = (X3, X4) = (PA2, PA3)``
+
+ *Note:* Pyboard D has ``UART(1)`` on ``YA``, unlike Pyboard and Pyboard Lite that both
+ have ``UART(1)`` on ``XB`` and ``UART(6)`` on ``YA``.
+
+Methods
+-------
+
+.. method:: UART.init(baudrate, bits=8, parity=None, stop=1, *, timeout=0, flow=0, timeout_char=0, read_buf_len=64)
+
+ Initialise the UART bus with the given parameters:
+
+ - ``baudrate`` is the clock rate.
+ - ``bits`` is the number of bits per character, 7, 8 or 9.
+ - ``parity`` is the parity, ``None``, 0 (even) or 1 (odd).
+ - ``stop`` is the number of stop bits, 1 or 2.
+ - ``flow`` sets the flow control type. Can be 0, ``UART.RTS``, ``UART.CTS``
+ or ``UART.RTS | UART.CTS``.
+ - ``timeout`` is the timeout in milliseconds to wait for writing/reading the first character.
+ - ``timeout_char`` is the timeout in milliseconds to wait between characters while writing or reading.
+ - ``read_buf_len`` is the character length of the read buffer (0 to disable).
+
+ This method will raise an exception if the baudrate could not be set within
+ 5% of the desired value. The minimum baudrate is dictated by the frequency
+ of the bus that the UART is on; UART(1) and UART(6) are APB2, the rest are on
+ APB1. The default bus frequencies give a minimum baudrate of 1300 for
+ UART(1) and UART(6) and 650 for the others. Use :func:`pyb.freq `
+ to reduce the bus frequencies to get lower baudrates.
+
+ *Note:* with parity=None, only 8 and 9 bits are supported. With parity enabled,
+ only 7 and 8 bits are supported.
+
+.. method:: UART.deinit()
+
+ Turn off the UART bus.
+
+.. method:: UART.any()
+
+ Returns the number of bytes waiting (may be 0).
+
+.. method:: UART.read([nbytes])
+
+ Read characters. If ``nbytes`` is specified then read at most that many bytes.
+ If ``nbytes`` are available in the buffer, returns immediately, otherwise returns
+ when sufficient characters arrive or the timeout elapses.
+
+ If ``nbytes`` is not given then the method reads as much data as possible. It
+ returns after the timeout has elapsed.
+
+ *Note:* for 9 bit characters each character takes two bytes, ``nbytes`` must
+ be even, and the number of characters is ``nbytes/2``.
+
+ Return value: a bytes object containing the bytes read in. Returns ``None``
+ on timeout.
+
+.. method:: UART.readchar()
+
+ Receive a single character on the bus.
+
+ Return value: The character read, as an integer. Returns -1 on timeout.
+
+.. method:: UART.readinto(buf[, nbytes])
+
+ Read bytes into the ``buf``. If ``nbytes`` is specified then read at most
+ that many bytes. Otherwise, read at most ``len(buf)`` bytes.
+
+ Return value: number of bytes read and stored into ``buf`` or ``None`` on
+ timeout.
+
+.. method:: UART.readline()
+
+ Read a line, ending in a newline character. If such a line exists, return is
+ immediate. If the timeout elapses, all available data is returned regardless
+ of whether a newline exists.
+
+ Return value: the line read or ``None`` on timeout if no data is available.
+
+.. method:: UART.write(buf)
+
+ Write the buffer of bytes to the bus. If characters are 7 or 8 bits wide
+ then each byte is one character. If characters are 9 bits wide then two
+ bytes are used for each character (little endian), and ``buf`` must contain
+ an even number of bytes.
+
+ Return value: number of bytes written. If a timeout occurs and no bytes
+ were written returns ``None``.
+
+.. method:: UART.writechar(char)
+
+ Write a single character on the bus. ``char`` is an integer to write.
+ Return value: ``None``. See note below if CTS flow control is used.
+
+.. method:: UART.sendbreak()
+
+ Send a break condition on the bus. This drives the bus low for a duration
+ of 13 bits.
+ Return value: ``None``.
+
+Constants
+---------
+
+.. data:: UART.RTS
+ UART.CTS
+
+ to select the flow control type.
+
+Flow Control
+------------
+
+On Pyboards V1 and V1.1 ``UART(2)`` and ``UART(3)`` support RTS/CTS hardware flow control
+using the following pins:
+
+ - ``UART(2)`` is on: ``(TX, RX, nRTS, nCTS) = (X3, X4, X2, X1) = (PA2, PA3, PA1, PA0)``
+ - ``UART(3)`` is on :``(TX, RX, nRTS, nCTS) = (Y9, Y10, Y7, Y6) = (PB10, PB11, PB14, PB13)``
+
+On the Pyboard Lite only ``UART(2)`` supports flow control on these pins:
+
+ ``(TX, RX, nRTS, nCTS) = (X1, X2, X4, X3) = (PA2, PA3, PA1, PA0)``
+
+In the following paragraphs the term "target" refers to the device connected to
+the UART.
+
+When the UART's ``init()`` method is called with ``flow`` set to one or both of
+``UART.RTS`` and ``UART.CTS`` the relevant flow control pins are configured.
+``nRTS`` is an active low output, ``nCTS`` is an active low input with pullup
+enabled. To achieve flow control the Pyboard's ``nCTS`` signal should be connected
+to the target's ``nRTS`` and the Pyboard's ``nRTS`` to the target's ``nCTS``.
+
+CTS: target controls Pyboard transmitter
+~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+
+If CTS flow control is enabled the write behaviour is as follows:
+
+If the Pyboard's ``UART.write(buf)`` method is called, transmission will stall for
+any periods when ``nCTS`` is ``False``. This will result in a timeout if the entire
+buffer was not transmitted in the timeout period. The method returns the number of
+bytes written, enabling the user to write the remainder of the data if required. In
+the event of a timeout, a character will remain in the UART pending ``nCTS``. The
+number of bytes composing this character will be included in the return value.
+
+If ``UART.writechar()`` is called when ``nCTS`` is ``False`` the method will time
+out unless the target asserts ``nCTS`` in time. If it times out ``OSError 116``
+will be raised. The character will be transmitted as soon as the target asserts ``nCTS``.
+
+RTS: Pyboard controls target's transmitter
+~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+
+If RTS flow control is enabled, behaviour is as follows:
+
+If buffered input is used (``read_buf_len`` > 0), incoming characters are buffered.
+If the buffer becomes full, the next character to arrive will cause ``nRTS`` to go
+``False``: the target should cease transmission. ``nRTS`` will go ``True`` when
+characters are read from the buffer.
+
+Note that the ``any()`` method returns the number of bytes in the buffer. Assume a
+buffer length of ``N`` bytes. If the buffer becomes full, and another character arrives,
+``nRTS`` will be set False, and ``any()`` will return the count ``N``. When
+characters are read the additional character will be placed in the buffer and will
+be included in the result of a subsequent ``any()`` call.
+
+If buffered input is not used (``read_buf_len`` == 0) the arrival of a character will
+cause ``nRTS`` to go ``False`` until the character is read.
diff --git a/components/language/micropython/docs/library/pyb.USB_HID.rst b/components/language/micropython/docs/library/pyb.USB_HID.rst
new file mode 100644
index 00000000..7e23d131
--- /dev/null
+++ b/components/language/micropython/docs/library/pyb.USB_HID.rst
@@ -0,0 +1,40 @@
+.. currentmodule:: pyb
+.. _pyb.USB_HID:
+
+class USB_HID -- USB Human Interface Device (HID)
+=================================================
+
+The USB_HID class allows creation of an object representing the USB
+Human Interface Device (HID) interface. It can be used to emulate
+a peripheral such as a mouse or keyboard.
+
+Before you can use this class, you need to use :meth:`pyb.usb_mode()` to set the USB mode to include the HID interface.
+
+Constructors
+------------
+
+.. class:: pyb.USB_HID()
+
+ Create a new USB_HID object.
+
+
+Methods
+-------
+
+.. method:: USB_HID.recv(data, *, timeout=5000)
+
+ Receive data on the bus:
+
+ - ``data`` can be an integer, which is the number of bytes to receive,
+ or a mutable buffer, which will be filled with received bytes.
+ - ``timeout`` is the timeout in milliseconds to wait for the receive.
+
+ Return value: if ``data`` is an integer then a new buffer of the bytes received,
+ otherwise the number of bytes read into ``data`` is returned.
+
+.. method:: USB_HID.send(data)
+
+ Send data over the USB HID interface:
+
+ - ``data`` is the data to send (a tuple/list of integers, or a
+ bytearray).
diff --git a/components/language/micropython/docs/library/pyb.USB_VCP.rst b/components/language/micropython/docs/library/pyb.USB_VCP.rst
new file mode 100644
index 00000000..1cca8dca
--- /dev/null
+++ b/components/language/micropython/docs/library/pyb.USB_VCP.rst
@@ -0,0 +1,133 @@
+.. currentmodule:: pyb
+.. _pyb.USB_VCP:
+
+class USB_VCP -- USB virtual comm port
+======================================
+
+The USB_VCP class allows creation of a `stream`-like object representing the USB
+virtual comm port. It can be used to read and write data over USB to
+the connected host.
+
+
+Constructors
+------------
+
+.. class:: pyb.USB_VCP(id=0)
+
+ Create a new USB_VCP object. The *id* argument specifies which USB VCP port to
+ use.
+
+
+Methods
+-------
+
+.. method:: USB_VCP.init(*, flow=-1)
+
+ Configure the USB VCP port. If the *flow* argument is not -1 then the value sets
+ the flow control, which can be a bitwise-or of ``USB_VCP.RTS`` and ``USB_VCP.CTS``.
+ RTS is used to control read behaviour and CTS, to control write behaviour.
+
+.. method:: USB_VCP.setinterrupt(chr)
+
+ Set the character which interrupts running Python code. This is set
+ to 3 (CTRL-C) by default, and when a CTRL-C character is received over
+ the USB VCP port, a KeyboardInterrupt exception is raised.
+
+ Set to -1 to disable this interrupt feature. This is useful when you
+ want to send raw bytes over the USB VCP port.
+
+.. method:: USB_VCP.isconnected()
+
+ Return ``True`` if USB is connected as a serial device, else ``False``.
+
+.. method:: USB_VCP.any()
+
+ Return ``True`` if any characters waiting, else ``False``.
+
+.. method:: USB_VCP.close()
+
+ This method does nothing. It exists so the USB_VCP object can act as
+ a file.
+
+.. method:: USB_VCP.read([nbytes])
+
+ Read at most ``nbytes`` from the serial device and return them as a
+ bytes object. If ``nbytes`` is not specified then the method reads
+ all available bytes from the serial device.
+ USB_VCP `stream` implicitly works in non-blocking mode,
+ so if no pending data available, this method will return immediately
+ with ``None`` value.
+
+.. method:: USB_VCP.readinto(buf, [maxlen])
+
+ Read bytes from the serial device and store them into ``buf``, which
+ should be a buffer-like object. At most ``len(buf)`` bytes are read.
+ If ``maxlen`` is given and then at most ``min(maxlen, len(buf))`` bytes
+ are read.
+
+ Returns the number of bytes read and stored into ``buf`` or ``None``
+ if no pending data available.
+
+.. method:: USB_VCP.readline()
+
+ Read a whole line from the serial device.
+
+ Returns a bytes object containing the data, including the trailing
+ newline character or ``None`` if no pending data available.
+
+.. method:: USB_VCP.readlines()
+
+ Read as much data as possible from the serial device, breaking it into
+ lines.
+
+ Returns a list of bytes objects, each object being one of the lines.
+ Each line will include the newline character.
+
+.. method:: USB_VCP.write(buf)
+
+ Write the bytes from ``buf`` to the serial device.
+
+ Returns the number of bytes written.
+
+.. method:: USB_VCP.recv(data, *, timeout=5000)
+
+ Receive data on the bus:
+
+ - ``data`` can be an integer, which is the number of bytes to receive,
+ or a mutable buffer, which will be filled with received bytes.
+ - ``timeout`` is the timeout in milliseconds to wait for the receive.
+
+ Return value: if ``data`` is an integer then a new buffer of the bytes received,
+ otherwise the number of bytes read into ``data`` is returned.
+
+.. method:: USB_VCP.send(data, *, timeout=5000)
+
+ Send data over the USB VCP:
+
+ - ``data`` is the data to send (an integer to send, or a buffer object).
+ - ``timeout`` is the timeout in milliseconds to wait for the send.
+
+ Return value: number of bytes sent.
+
+.. method:: USB_VCP.irq(handler=None, trigger=IRQ_RX, hard=False)
+
+ Register *handler* to be called whenever an event specified by *trigger*
+ occurs. The *handler* function must take exactly one argument, which will
+ be the USB VCP object. Pass in ``None`` to disable the callback.
+
+ Valid values for *trigger* are:
+
+ - ``USB_VCP.IRQ_RX``: new data is available for reading from the USB VCP object.
+
+
+Constants
+---------
+
+.. data:: USB_VCP.RTS
+ USB_VCP.CTS
+
+ to select the flow control type.
+
+.. data:: USB_VCP.IRQ_RX
+
+ IRQ trigger values for :meth:`USB_VCP.irq`.
diff --git a/components/language/micropython/docs/library/pyb.rst b/components/language/micropython/docs/library/pyb.rst
new file mode 100644
index 00000000..c8ef2c53
--- /dev/null
+++ b/components/language/micropython/docs/library/pyb.rst
@@ -0,0 +1,333 @@
+:mod:`pyb` --- functions related to the board
+=============================================
+
+.. module:: pyb
+ :synopsis: functions related to the board
+
+The ``pyb`` module contains specific functions related to the board.
+
+Time related functions
+----------------------
+
+.. function:: delay(ms)
+
+ Delay for the given number of milliseconds.
+
+.. function:: udelay(us)
+
+ Delay for the given number of microseconds.
+
+.. function:: millis()
+
+ Returns the number of milliseconds since the board was last reset.
+
+ The result is always a MicroPython smallint (31-bit signed number), so
+ after 2^30 milliseconds (about 12.4 days) this will start to return
+ negative numbers.
+
+ Note that if :meth:`pyb.stop()` is issued the hardware counter supporting this
+ function will pause for the duration of the "sleeping" state. This
+ will affect the outcome of :meth:`pyb.elapsed_millis()`.
+
+.. function:: micros()
+
+ Returns the number of microseconds since the board was last reset.
+
+ The result is always a MicroPython smallint (31-bit signed number), so
+ after 2^30 microseconds (about 17.8 minutes) this will start to return
+ negative numbers.
+
+ Note that if :meth:`pyb.stop()` is issued the hardware counter supporting this
+ function will pause for the duration of the "sleeping" state. This
+ will affect the outcome of :meth:`pyb.elapsed_micros()`.
+
+.. function:: elapsed_millis(start)
+
+ Returns the number of milliseconds which have elapsed since ``start``.
+
+ This function takes care of counter wrap, and always returns a positive
+ number. This means it can be used to measure periods up to about 12.4 days.
+
+ Example::
+
+ start = pyb.millis()
+ while pyb.elapsed_millis(start) < 1000:
+ # Perform some operation
+
+.. function:: elapsed_micros(start)
+
+ Returns the number of microseconds which have elapsed since ``start``.
+
+ This function takes care of counter wrap, and always returns a positive
+ number. This means it can be used to measure periods up to about 17.8 minutes.
+
+ Example::
+
+ start = pyb.micros()
+ while pyb.elapsed_micros(start) < 1000:
+ # Perform some operation
+ pass
+
+Reset related functions
+-----------------------
+
+.. function:: hard_reset()
+
+ Resets the pyboard in a manner similar to pushing the external RESET
+ button.
+
+.. function:: bootloader()
+
+ Activate the bootloader without BOOT\* pins.
+
+.. function:: fault_debug(value)
+
+ Enable or disable hard-fault debugging. A hard-fault is when there is a fatal
+ error in the underlying system, like an invalid memory access.
+
+ If the *value* argument is ``False`` then the board will automatically reset if
+ there is a hard fault.
+
+ If *value* is ``True`` then, when the board has a hard fault, it will print the
+ registers and the stack trace, and then cycle the LEDs indefinitely.
+
+ The default value is disabled, i.e. to automatically reset.
+
+Interrupt related functions
+---------------------------
+
+.. function:: disable_irq()
+
+ Disable interrupt requests.
+ Returns the previous IRQ state: ``False``/``True`` for disabled/enabled IRQs
+ respectively. This return value can be passed to enable_irq to restore
+ the IRQ to its original state.
+
+.. function:: enable_irq(state=True)
+
+ Enable interrupt requests.
+ If ``state`` is ``True`` (the default value) then IRQs are enabled.
+ If ``state`` is ``False`` then IRQs are disabled. The most common use of
+ this function is to pass it the value returned by ``disable_irq`` to
+ exit a critical section.
+
+Power related functions
+-----------------------
+
+.. function:: freq([sysclk[, hclk[, pclk1[, pclk2]]]])
+
+ If given no arguments, returns a tuple of clock frequencies:
+ (sysclk, hclk, pclk1, pclk2).
+ These correspond to:
+
+ - sysclk: frequency of the CPU
+ - hclk: frequency of the AHB bus, core memory and DMA
+ - pclk1: frequency of the APB1 bus
+ - pclk2: frequency of the APB2 bus
+
+ If given any arguments then the function sets the frequency of the CPU,
+ and the buses if additional arguments are given. Frequencies are given in
+ Hz. Eg freq(120000000) sets sysclk (the CPU frequency) to 120MHz. Note that
+ not all values are supported and the largest supported frequency not greater
+ than the given value will be selected.
+
+ Supported sysclk frequencies are (in MHz): 8, 16, 24, 30, 32, 36, 40, 42, 48,
+ 54, 56, 60, 64, 72, 84, 96, 108, 120, 144, 168.
+
+ The maximum frequency of hclk is 168MHz, of pclk1 is 42MHz, and of pclk2 is
+ 84MHz. Be sure not to set frequencies above these values.
+
+ The hclk, pclk1 and pclk2 frequencies are derived from the sysclk frequency
+ using a prescaler (divider). Supported prescalers for hclk are: 1, 2, 4, 8,
+ 16, 64, 128, 256, 512. Supported prescalers for pclk1 and pclk2 are: 1, 2,
+ 4, 8. A prescaler will be chosen to best match the requested frequency.
+
+ A sysclk frequency of
+ 8MHz uses the HSE (external crystal) directly and 16MHz uses the HSI
+ (internal oscillator) directly. The higher frequencies use the HSE to
+ drive the PLL (phase locked loop), and then use the output of the PLL.
+
+ Note that if you change the frequency while the USB is enabled then
+ the USB may become unreliable. It is best to change the frequency
+ in boot.py, before the USB peripheral is started. Also note that sysclk
+ frequencies below 36MHz do not allow the USB to function correctly.
+
+.. function:: wfi()
+
+ Wait for an internal or external interrupt.
+
+ This executes a ``wfi`` instruction which reduces power consumption
+ of the MCU until any interrupt occurs (be it internal or external),
+ at which point execution continues. Note that the system-tick interrupt
+ occurs once every millisecond (1000Hz) so this function will block for
+ at most 1ms.
+
+.. function:: stop()
+
+ Put the pyboard in a "sleeping" state.
+
+ This reduces power consumption to less than 500 uA. To wake from this
+ sleep state requires an external interrupt or a real-time-clock event.
+ Upon waking execution continues where it left off.
+
+ See :meth:`rtc.wakeup` to configure a real-time-clock wakeup event.
+
+.. function:: standby()
+
+ Put the pyboard into a "deep sleep" state.
+
+ This reduces power consumption to less than 50 uA. To wake from this
+ sleep state requires a real-time-clock event, or an external interrupt
+ on X1 (PA0=WKUP) or X18 (PC13=TAMP1).
+ Upon waking the system undergoes a hard reset.
+
+ See :meth:`rtc.wakeup` to configure a real-time-clock wakeup event.
+
+Miscellaneous functions
+-----------------------
+
+.. function:: have_cdc()
+
+ Return True if USB is connected as a serial device, False otherwise.
+
+ .. note:: This function is deprecated. Use pyb.USB_VCP().isconnected() instead.
+
+.. function:: hid((buttons, x, y, z))
+
+ Takes a 4-tuple (or list) and sends it to the USB host (the PC) to
+ signal a HID mouse-motion event.
+
+ .. note:: This function is deprecated. Use :meth:`pyb.USB_HID.send()` instead.
+
+.. function:: info([dump_alloc_table])
+
+ Print out lots of information about the board.
+
+.. function:: main(filename)
+
+ Set the filename of the main script to run after boot.py is finished. If
+ this function is not called then the default file main.py will be executed.
+
+ It only makes sense to call this function from within boot.py.
+
+.. function:: mount(device, mountpoint, *, readonly=False, mkfs=False)
+
+ .. note:: This function is deprecated. Mounting and unmounting devices should
+ be performed by :meth:`os.mount` and :meth:`os.umount` instead.
+
+ Mount a block device and make it available as part of the filesystem.
+ ``device`` must be an object that provides the block protocol. (The
+ following is also deprecated. See :class:`os.AbstractBlockDev` for the
+ correct way to create a block device.)
+
+ - ``readblocks(self, blocknum, buf)``
+ - ``writeblocks(self, blocknum, buf)`` (optional)
+ - ``count(self)``
+ - ``sync(self)`` (optional)
+
+ ``readblocks`` and ``writeblocks`` should copy data between ``buf`` and
+ the block device, starting from block number ``blocknum`` on the device.
+ ``buf`` will be a bytearray with length a multiple of 512. If
+ ``writeblocks`` is not defined then the device is mounted read-only.
+ The return value of these two functions is ignored.
+
+ ``count`` should return the number of blocks available on the device.
+ ``sync``, if implemented, should sync the data on the device.
+
+ The parameter ``mountpoint`` is the location in the root of the filesystem
+ to mount the device. It must begin with a forward-slash.
+
+ If ``readonly`` is ``True``, then the device is mounted read-only,
+ otherwise it is mounted read-write.
+
+ If ``mkfs`` is ``True``, then a new filesystem is created if one does not
+ already exist.
+
+.. function:: repl_uart(uart)
+
+ Get or set the UART object where the REPL is repeated on.
+
+.. function:: rng()
+
+ Return a 30-bit hardware generated random number.
+
+.. function:: sync()
+
+ Sync all file systems.
+
+.. function:: unique_id()
+
+ Returns a string of 12 bytes (96 bits), which is the unique ID of the MCU.
+
+.. function:: usb_mode([modestr], port=-1, vid=0xf055, pid=-1, msc=(), hid=pyb.hid_mouse, high_speed=False)
+
+ If called with no arguments, return the current USB mode as a string.
+
+ If called with *modestr* provided, attempts to configure the USB mode.
+ The following values of *modestr* are understood:
+
+ - ``None``: disables USB
+ - ``'VCP'``: enable with VCP (Virtual COM Port) interface
+ - ``'MSC'``: enable with MSC (mass storage device class) interface
+ - ``'VCP+MSC'``: enable with VCP and MSC
+ - ``'VCP+HID'``: enable with VCP and HID (human interface device)
+ - ``'VCP+MSC+HID'``: enabled with VCP, MSC and HID (only available on PYBD boards)
+
+ For backwards compatibility, ``'CDC'`` is understood to mean
+ ``'VCP'`` (and similarly for ``'CDC+MSC'`` and ``'CDC+HID'``).
+
+ The *port* parameter should be an integer (0, 1, ...) and selects which
+ USB port to use if the board supports multiple ports. A value of -1 uses
+ the default or automatically selected port.
+
+ The *vid* and *pid* parameters allow you to specify the VID (vendor id)
+ and PID (product id). A *pid* value of -1 will select a PID based on the
+ value of *modestr*.
+
+ If enabling MSC mode, the *msc* parameter can be used to specify a list
+ of SCSI LUNs to expose on the mass storage interface. For example
+ ``msc=(pyb.Flash(), pyb.SDCard())``.
+
+ If enabling HID mode, you may also specify the HID details by
+ passing the *hid* keyword parameter. It takes a tuple of
+ (subclass, protocol, max packet length, polling interval, report
+ descriptor). By default it will set appropriate values for a USB
+ mouse. There is also a ``pyb.hid_keyboard`` constant, which is an
+ appropriate tuple for a USB keyboard.
+
+ The *high_speed* parameter, when set to ``True``, enables USB HS mode if
+ it is supported by the hardware.
+
+Constants
+---------
+
+.. data:: pyb.hid_mouse
+ pyb.hid_keyboard
+
+ A tuple of (subclass, protocol, max packet length, polling interval, report
+ descriptor) to set appropriate values for a USB mouse or keyboard.
+
+Classes
+-------
+
+.. toctree::
+ :maxdepth: 1
+
+ pyb.Accel.rst
+ pyb.ADC.rst
+ pyb.CAN.rst
+ pyb.DAC.rst
+ pyb.ExtInt.rst
+ pyb.Flash.rst
+ pyb.I2C.rst
+ pyb.LCD.rst
+ pyb.LED.rst
+ pyb.Pin.rst
+ pyb.RTC.rst
+ pyb.Servo.rst
+ pyb.SPI.rst
+ pyb.Switch.rst
+ pyb.Timer.rst
+ pyb.UART.rst
+ pyb.USB_HID.rst
+ pyb.USB_VCP.rst
diff --git a/components/language/micropython/docs/library/random.rst b/components/language/micropython/docs/library/random.rst
new file mode 100644
index 00000000..dd8b47c8
--- /dev/null
+++ b/components/language/micropython/docs/library/random.rst
@@ -0,0 +1,82 @@
+:mod:`random` -- generate random numbers
+========================================
+
+.. module:: random
+ :synopsis: random numbers
+
+This module implements a pseudo-random number generator (PRNG).
+
+|see_cpython_module| :mod:`python:random` .
+
+.. note::
+
+ The following notation is used for intervals:
+
+ - () are open interval brackets and do not include their endpoints.
+ For example, (0, 1) means greater than 0 and less than 1.
+ In set notation: (0, 1) = {x | 0 < x < 1}.
+
+ - [] are closed interval brackets which include all their limit points.
+ For example, [0, 1] means greater than or equal to 0 and less than
+ or equal to 1.
+ In set notation: [0, 1] = {x | 0 <= x <= 1}.
+
+.. note::
+
+ The :func:`randrange`, :func:`randint` and :func:`choice` functions are only
+ available if the ``MICROPY_PY_URANDOM_EXTRA_FUNCS`` configuration option is
+ enabled.
+
+
+Functions for integers
+----------------------
+
+.. function:: getrandbits(n)
+
+ Return an integer with *n* random bits (0 <= n <= 32).
+
+.. function:: randint(a, b)
+
+ Return a random integer in the range [*a*, *b*].
+
+.. function:: randrange(stop)
+ randrange(start, stop)
+ randrange(start, stop[, step])
+
+ The first form returns a random integer from the range [0, *stop*).
+ The second form returns a random integer from the range [*start*, *stop*).
+ The third form returns a random integer from the range [*start*, *stop*) in
+ steps of *step*. For instance, calling ``randrange(1, 10, 2)`` will
+ return odd numbers between 1 and 9 inclusive.
+
+
+Functions for floats
+--------------------
+
+.. function:: random()
+
+ Return a random floating point number in the range [0.0, 1.0).
+
+.. function:: uniform(a, b)
+
+ Return a random floating point number N such that *a* <= N <= *b* for *a* <= *b*,
+ and *b* <= N <= *a* for *b* < *a*.
+
+
+Other Functions
+---------------
+
+.. function:: seed(n=None, /)
+
+ Initialise the random number generator module with the seed *n* which should
+ be an integer. When no argument (or ``None``) is passed in it will (if
+ supported by the port) initialise the PRNG with a true random number
+ (usually a hardware generated random number).
+
+ The ``None`` case only works if ``MICROPY_PY_URANDOM_SEED_INIT_FUNC`` is
+ enabled by the port, otherwise it raises ``ValueError``.
+
+.. function:: choice(sequence)
+
+ Chooses and returns one item at random from *sequence* (tuple, list or
+ any object that supports the subscript operation).
diff --git a/components/language/micropython/docs/library/re.rst b/components/language/micropython/docs/library/re.rst
new file mode 100644
index 00000000..19b15d2d
--- /dev/null
+++ b/components/language/micropython/docs/library/re.rst
@@ -0,0 +1,202 @@
+:mod:`re` -- simple regular expressions
+=======================================
+
+.. module:: re
+ :synopsis: regular expressions
+
+|see_cpython_module| :mod:`python:re`.
+
+This module implements regular expression operations. Regular expression
+syntax supported is a subset of CPython ``re`` module (and actually is
+a subset of POSIX extended regular expressions).
+
+Supported operators and special sequences are:
+
+``.``
+ Match any character.
+
+``[...]``
+ Match set of characters. Individual characters and ranges are supported,
+ including negated sets (e.g. ``[^a-c]``).
+
+``^``
+ Match the start of the string.
+
+``$``
+ Match the end of the string.
+
+``?``
+ Match zero or one of the previous sub-pattern.
+
+``*``
+ Match zero or more of the previous sub-pattern.
+
+``+``
+ Match one or more of the previous sub-pattern.
+
+``??``
+ Non-greedy version of ``?``, match zero or one, with the preference
+ for zero.
+
+``*?``
+ Non-greedy version of ``*``, match zero or more, with the preference
+ for the shortest match.
+
+``+?``
+ Non-greedy version of ``+``, match one or more, with the preference
+ for the shortest match.
+
+``|``
+ Match either the left-hand side or the right-hand side sub-patterns of
+ this operator.
+
+``(...)``
+ Grouping. Each group is capturing (a substring it captures can be accessed
+ with `match.group()` method).
+
+``\d``
+ Matches digit. Equivalent to ``[0-9]``.
+
+``\D``
+ Matches non-digit. Equivalent to ``[^0-9]``.
+
+``\s``
+ Matches whitespace. Equivalent to ``[ \t-\r]``.
+
+``\S``
+ Matches non-whitespace. Equivalent to ``[^ \t-\r]``.
+
+``\w``
+ Matches "word characters" (ASCII only). Equivalent to ``[A-Za-z0-9_]``.
+
+``\W``
+ Matches non "word characters" (ASCII only). Equivalent to ``[^A-Za-z0-9_]``.
+
+``\``
+ Escape character. Any other character following the backslash, except
+ for those listed above, is taken literally. For example, ``\*`` is
+ equivalent to literal ``*`` (not treated as the ``*`` operator).
+ Note that ``\r``, ``\n``, etc. are not handled specially, and will be
+ equivalent to literal letters ``r``, ``n``, etc. Due to this, it's
+ not recommended to use raw Python strings (``r""``) for regular
+ expressions. For example, ``r"\r\n"`` when used as the regular
+ expression is equivalent to ``"rn"``. To match CR character followed
+ by LF, use ``"\r\n"``.
+
+**NOT SUPPORTED**:
+
+* counted repetitions (``{m,n}``)
+* named groups (``(?P...)``)
+* non-capturing groups (``(?:...)``)
+* more advanced assertions (``\b``, ``\B``)
+* special character escapes like ``\r``, ``\n`` - use Python's own escaping
+ instead
+* etc.
+
+Example::
+
+ import re
+
+ # As re doesn't support escapes itself, use of r"" strings is not
+ # recommended.
+ regex = re.compile("[\r\n]")
+
+ regex.split("line1\rline2\nline3\r\n")
+
+ # Result:
+ # ['line1', 'line2', 'line3', '', '']
+
+Functions
+---------
+
+.. function:: compile(regex_str, [flags])
+
+ Compile regular expression, return `regex ` object.
+
+.. function:: match(regex_str, string)
+
+ Compile *regex_str* and match against *string*. Match always happens
+ from starting position in a string.
+
+.. function:: search(regex_str, string)
+
+ Compile *regex_str* and search it in a *string*. Unlike `match`, this will search
+ string for first position which matches regex (which still may be
+ 0 if regex is anchored).
+
+.. function:: sub(regex_str, replace, string, count=0, flags=0, /)
+
+ Compile *regex_str* and search for it in *string*, replacing all matches
+ with *replace*, and returning the new string.
+
+ *replace* can be a string or a function. If it is a string then escape
+ sequences of the form ``\`` and ``\g`` can be used to
+ expand to the corresponding group (or an empty string for unmatched groups).
+ If *replace* is a function then it must take a single argument (the match)
+ and should return a replacement string.
+
+ If *count* is specified and non-zero then substitution will stop after
+ this many substitutions are made. The *flags* argument is ignored.
+
+ Note: availability of this function depends on :term:`MicroPython port`.
+
+.. data:: DEBUG
+
+ Flag value, display debug information about compiled expression.
+ (Availability depends on :term:`MicroPython port`.)
+
+
+.. _regex:
+
+Regex objects
+-------------
+
+Compiled regular expression. Instances of this class are created using
+`re.compile()`.
+
+.. method:: regex.match(string)
+ regex.search(string)
+ regex.sub(replace, string, count=0, flags=0, /)
+
+ Similar to the module-level functions :meth:`match`, :meth:`search`
+ and :meth:`sub`.
+ Using methods is (much) more efficient if the same regex is applied to
+ multiple strings.
+
+.. method:: regex.split(string, max_split=-1, /)
+
+ Split a *string* using regex. If *max_split* is given, it specifies
+ maximum number of splits to perform. Returns list of strings (there
+ may be up to *max_split+1* elements if it's specified).
+
+Match objects
+-------------
+
+Match objects as returned by `match()` and `search()` methods, and passed
+to the replacement function in `sub()`.
+
+.. method:: match.group(index)
+
+ Return matching (sub)string. *index* is 0 for entire match,
+ 1 and above for each capturing group. Only numeric groups are supported.
+
+.. method:: match.groups()
+
+ Return a tuple containing all the substrings of the groups of the match.
+
+ Note: availability of this method depends on :term:`MicroPython port`.
+
+.. method:: match.start([index])
+ match.end([index])
+
+ Return the index in the original string of the start or end of the
+ substring group that was matched. *index* defaults to the entire
+ group, otherwise it will select a group.
+
+ Note: availability of these methods depends on :term:`MicroPython port`.
+
+.. method:: match.span([index])
+
+ Returns the 2-tuple ``(match.start(index), match.end(index))``.
+
+ Note: availability of this method depends on :term:`MicroPython port`.
diff --git a/components/language/micropython/docs/library/rp2.Flash.rst b/components/language/micropython/docs/library/rp2.Flash.rst
new file mode 100644
index 00000000..1e94cf51
--- /dev/null
+++ b/components/language/micropython/docs/library/rp2.Flash.rst
@@ -0,0 +1,36 @@
+.. currentmodule:: rp2
+.. _rp2.Flash:
+
+class Flash -- access to built-in flash storage
+===============================================
+
+This class gives access to the SPI flash memory.
+
+In most cases, to store persistent data on the device, you'll want to use a
+higher-level abstraction, for example the filesystem via Python's standard file
+API, but this interface is useful to :ref:`customise the filesystem
+configuration ` or implement a low-level storage system for your
+application.
+
+
+Constructors
+------------
+
+.. class:: Flash()
+
+ Gets the singleton object for accessing the SPI flash memory.
+
+
+Methods
+-------
+
+.. method:: Flash.readblocks(block_num, buf)
+ Flash.readblocks(block_num, buf, offset)
+.. method:: Flash.writeblocks(block_num, buf)
+ Flash.writeblocks(block_num, buf, offset)
+.. method:: Flash.ioctl(cmd, arg)
+
+ These methods implement the simple and extended
+ :ref:`block protocol ` defined by
+ :class:`os.AbstractBlockDev`.
+
diff --git a/components/language/micropython/docs/library/rp2.PIO.rst b/components/language/micropython/docs/library/rp2.PIO.rst
new file mode 100644
index 00000000..e0675af1
--- /dev/null
+++ b/components/language/micropython/docs/library/rp2.PIO.rst
@@ -0,0 +1,94 @@
+.. currentmodule:: rp2
+.. _rp2.PIO:
+
+class PIO -- advanced PIO usage
+===============================
+
+The :class:`PIO` class gives access to an instance of the RP2040's PIO
+(programmable I/O) interface.
+
+The preferred way to interact with PIO is using :class:`rp2.StateMachine`, the
+PIO class is for advanced use.
+
+For assembling PIO programs, see :func:`rp2.asm_pio`.
+
+
+Constructors
+------------
+
+.. class:: PIO(id)
+
+ Gets the PIO instance numbered *id*. The RP2040 has two PIO instances,
+ numbered 0 and 1.
+
+ Raises a ``ValueError`` if any other argument is provided.
+
+
+Methods
+-------
+
+.. method:: PIO.add_program(program)
+
+ Add the *program* to the instruction memory of this PIO instance.
+
+ The amount of memory available for programs on each PIO instance is
+ limited. If there isn't enough space left in the PIO's program memory
+ this method will raise ``OSError(ENOMEM)``.
+
+.. method:: PIO.remove_program([program])
+
+ Remove *program* from the instruction memory of this PIO instance.
+
+ If no program is provided, it removes all programs.
+
+ It is not an error to remove a program which has already been removed.
+
+.. method:: PIO.state_machine(id, [program, ...])
+
+ Gets the state machine numbered *id*. On the RP2040, each PIO instance has
+ four state machines, numbered 0 to 3.
+
+ Optionally initialize it with a *program*: see `StateMachine.init`.
+
+ >>> rp2.PIO(1).state_machine(3)
+ StateMachine(7)
+
+.. method:: PIO.irq(handler=None, trigger=IRQ_SM0|IRQ_SM1|IRQ_SM2|IRQ_SM3, hard=False)
+
+ Returns the IRQ object for this PIO instance.
+
+ MicroPython only uses IRQ 0 on each PIO instance. IRQ 1 is not available.
+
+ Optionally configure it.
+
+
+Constants
+---------
+
+.. data:: PIO.IN_LOW
+ PIO.IN_HIGH
+ PIO.OUT_LOW
+ PIO.OUT_HIGH
+
+ These constants are used for the *out_init*, *set_init*, and *sideset_init*
+ arguments to `asm_pio`.
+
+.. data:: PIO.SHIFT_LEFT
+ PIO.SHIFT_RIGHT
+
+ These constants are used for the *in_shiftdir* and *out_shiftdir* arguments
+ to `asm_pio` or `StateMachine.init`.
+
+.. data:: PIO.JOIN_NONE
+ PIO.JOIN_TX
+ PIO.JOIN_RX
+
+ These constants are used for the *fifo_join* argument to `asm_pio`.
+
+.. data:: PIO.IRQ_SM0
+ PIO.IRQ_SM1
+ PIO.IRQ_SM2
+ PIO.IRQ_SM3
+
+ These constants are used for the *trigger* argument to `PIO.irq`.
+
diff --git a/components/language/micropython/docs/library/rp2.StateMachine.rst b/components/language/micropython/docs/library/rp2.StateMachine.rst
new file mode 100644
index 00000000..8d73ccf7
--- /dev/null
+++ b/components/language/micropython/docs/library/rp2.StateMachine.rst
@@ -0,0 +1,131 @@
+.. currentmodule:: rp2
+.. _rp2.StateMachine:
+
+class StateMachine -- access to the RP2040's programmable I/O interface
+=======================================================================
+
+The :class:`StateMachine` class gives access to the RP2040's PIO (programmable
+I/O) interface.
+
+For assembling PIO programs, see :func:`rp2.asm_pio`.
+
+
+Constructors
+------------
+
+.. class:: StateMachine(id, [program, ...])
+
+ Get the state machine numbered *id*. The RP2040 has two identical PIO
+ instances, each with 4 state machines: so there are 8 state machines in
+ total, numbered 0 to 7.
+
+ Optionally initialize it with the given program *program*: see
+ `StateMachine.init`.
+
+
+Methods
+-------
+
+.. method:: StateMachine.init(program, freq=-1, *, in_base=None, out_base=None, set_base=None, jmp_pin=None, sideset_base=None, in_shiftdir=None, out_shiftdir=None, push_thresh=None, pull_thresh=None)
+
+ Configure the state machine instance to run the given *program*.
+
+ The program is added to the instruction memory of this PIO instance. If the
+ instruction memory already contains this program, then its offset is
+ re-used so as to save on instruction memory.
+
+ - *freq* is the frequency in Hz to run the state machine at. Defaults to
+ the system clock frequency.
+
+ The clock divider is computed as ``system clock frequency / freq``, so
+ there can be slight rounding errors.
+
+ The minimum possible clock divider is one 65536th of the system clock: so
+ at the default system clock frequency of 125MHz, the minimum value of
+ *freq* is ``1908``. To run state machines at slower frequencies, you'll
+ need to reduce the system clock speed with `machine.freq()`.
+ - *in_base* is the first pin to use for ``in()`` instructions.
+ - *out_base* is the first pin to use for ``out()`` instructions.
+ - *set_base* is the first pin to use for ``set()`` instructions.
+ - *jmp_pin* is the first pin to use for ``jmp(pin, ...)`` instructions.
+ - *sideset_base* is the first pin to use for side-setting.
+ - *in_shiftdir* is the direction the ISR will shift, either
+ `PIO.SHIFT_LEFT` or `PIO.SHIFT_RIGHT`.
+ - *out_shiftdir* is the direction the OSR will shift, either
+ `PIO.SHIFT_LEFT` or `PIO.SHIFT_RIGHT`.
+ - *push_thresh* is the threshold in bits before auto-push or conditional
+ re-pushing is triggered.
+ - *pull_thresh* is the threshold in bits before auto-push or conditional
+ re-pushing is triggered.
+
+.. method:: StateMachine.active([value])
+
+ Gets or sets whether the state machine is currently running.
+
+ >>> sm.active()
+ True
+ >>> sm.active(0)
+ False
+
+.. method:: StateMachine.restart()
+
+ Restarts the state machine and jumps to the beginning of the program.
+
+ This method clears the state machine's internal state using the RP2040's
+ ``SM_RESTART`` register. This includes:
+
+ - input and output shift counters
+ - the contents of the input shift register
+ - the delay counter
+ - the waiting-on-IRQ state
+ - a stalled instruction run using `StateMachine.exec()`
+
+.. method:: StateMachine.exec(instr)
+
+ Execute a single PIO instruction. Uses `asm_pio_encode` to encode the
+ instruction from the given string *instr*.
+
+ >>> sm.exec("set(0, 1)")
+
+.. method:: StateMachine.get(buf=None, shift=0)
+
+ Pull a word from the state machine's RX FIFO.
+
+ If the FIFO is empty, it blocks until data arrives (i.e. the state machine
+ pushes a word).
+
+ The value is shifted right by *shift* bits before returning, i.e. the
+ return value is ``word >> shift``.
+
+.. method:: StateMachine.put(value, shift=0)
+
+ Push a word onto the state machine's TX FIFO.
+
+ If the FIFO is full, it blocks until there is space (i.e. the state machine
+ pulls a word).
+
+ The value is first shifted left by *shift* bits, i.e. the state machine
+ receives ``value << shift``.
+
+.. method:: StateMachine.rx_fifo()
+
+ Returns the number of words in the state machine's RX FIFO. A value of 0
+ indicates the FIFO is empty.
+
+ Useful for checking if data is waiting to be read, before calling
+ `StateMachine.get()`.
+
+.. method:: StateMachine.tx_fifo()
+
+ Returns the number of words in the state machine's TX FIFO. A value of 0
+ indicates the FIFO is empty.
+
+ Useful for checking if there is space to push another word using
+ `StateMachine.put()`.
+
+.. method:: StateMachine.irq(handler=None, trigger=0|1, hard=False)
+
+ Returns the IRQ object for the given StateMachine.
+
+ Optionally configure it.
+
diff --git a/components/language/micropython/docs/library/rp2.rst b/components/language/micropython/docs/library/rp2.rst
new file mode 100644
index 00000000..06affaae
--- /dev/null
+++ b/components/language/micropython/docs/library/rp2.rst
@@ -0,0 +1,235 @@
+.. currentmodule:: rp2
+
+:mod:`rp2` --- functionality specific to the RP2040
+===================================================
+
+.. module:: rp2
+ :synopsis: functionality specific to the RP2
+
+The ``rp2`` module contains functions and classes specific to the RP2040, as
+used in the Raspberry Pi Pico.
+
+See the `RP2040 Python datasheet
+`_
+for more information, and `pico-micropython-examples
+`_
+for example code.
+
+
+PIO related functions
+---------------------
+
+The ``rp2`` module includes functions for assembling PIO programs.
+
+For running PIO programs, see :class:`rp2.StateMachine`.
+
+.. function:: asm_pio(*, out_init=None, set_init=None, sideset_init=None, in_shiftdir=0, out_shiftdir=0, autopush=False, autopull=False, push_thresh=32, pull_thresh=32, fifo_join=PIO.JOIN_NONE)
+
+ Assemble a PIO program.
+
+ The following parameters control the initial state of the GPIO pins, as one
+ of `PIO.IN_LOW`, `PIO.IN_HIGH`, `PIO.OUT_LOW` or `PIO.OUT_HIGH`. If the
+ program uses more than one pin, provide a tuple, e.g.
+ ``out_init=(PIO.OUT_LOW, PIO.OUT_LOW)``.
+
+ - *out_init* configures the pins used for ``out()`` instructions.
+ - *set_init* configures the pins used for ``set()`` instructions. There can
+ be at most 5.
+ - *sideset_init* configures the pins used side-setting. There can be at
+ most 5.
+
+ The following parameters are used by default, but can be overridden in
+ `StateMachine.init()`:
+
+ - *in_shiftdir* is the default direction the ISR will shift, either
+ `PIO.SHIFT_LEFT` or `PIO.SHIFT_RIGHT`.
+ - *out_shiftdir* is the default direction the OSR will shift, either
+ `PIO.SHIFT_LEFT` or `PIO.SHIFT_RIGHT`.
+ - *push_thresh* is the threshold in bits before auto-push or conditional
+ re-pushing is triggered.
+ - *pull_thresh* is the threshold in bits before auto-push or conditional
+ re-pushing is triggered.
+
+ The remaining parameters are:
+
+ - *autopush* configures whether auto-push is enabled.
+ - *autopull* configures whether auto-pull is enabled.
+ - *fifo_join* configures whether the 4-word TX and RX FIFOs should be
+ combined into a single 8-word FIFO for one direction only. The options
+ are `PIO.JOIN_NONE`, `PIO.JOIN_RX` and `PIO.JOIN_TX`.
+
+.. function:: asm_pio_encode(instr, sideset_count, sideset_opt=False)
+
+ Assemble a single PIO instruction. You usually want to use `asm_pio()`
+ instead.
+
+ >>> rp2.asm_pio_encode("set(0, 1)", 0)
+ 57345
+
+.. class:: PIOASMError
+
+ This exception is raised from `asm_pio()` or `asm_pio_encode()` if there is
+ an error assembling a PIO program.
+
+
+PIO assembly language instructions
+----------------------------------
+
+PIO state machines are programmed in a custom assembly language with nine core
+PIO-machine instructions. In MicroPython, PIO assembly routines are written as
+a Python function with the decorator ``@rp2.asm_pio()``, and they use Python
+syntax. Such routines support standard Python variables and arithmetic, as well
+as the following custom functions that encode PIO instructions and direct the
+assembler. See sec 3.4 of the RP2040 datasheet for further details.
+
+wrap_target()
+ Specify the location where execution continues after program wrapping.
+ By default this is the start of the PIO routine.
+
+wrap()
+ Specify the location where the program finishes and wraps around.
+ If this directive is not used then it is added automatically at the end of
+ the PIO routine. Wrapping does not cost any execution cycles.
+
+label(label)
+ Define a label called *label* at the current location. *label* can be a
+ string or integer.
+
+word(instr, label=None)
+ Insert an arbitrary 16-bit word in the assembled output.
+
+ - *instr*: the 16-bit value
+ - *label*: if given, look up the label and logical-or the label's value with
+ *instr*
+
+jmp(...)
+ This instruction takes two forms:
+
+ jmp(label)
+ - *label*: label to jump to unconditionally
+
+ jmp(cond, label)
+ - *cond*: the condition to check, one of:
+
+ - ``not_x``, ``not_y``: true if register is zero
+ - ``x_dec``, ``y_dec``: true if register is non-zero, and do post
+ decrement
+ - ``x_not_y``: true if X is not equal to Y
+ - ``pin``: true if the input pin is set
+ - ``not_osre``: true if OSR is not empty (hasn't reached its
+ threshold)
+
+ - *label*: label to jump to if condition is true
+
+wait(polarity, src, index)
+ Block, waiting for high/low on a pin or IRQ line.
+
+ - *polarity*: 0 or 1, whether to wait for a low or high value
+ - *src*: one of: ``gpio`` (absolute pin), ``pin`` (pin relative to
+ StateMachine's ``in_base`` argument), ``irq``
+ - *index*: 0-31, the index for *src*
+
+in_(src, bit_count)
+ Shift data in from *src* to ISR.
+
+ - *src*: one of: ``pins``, ``x``, ``y``, ``null``, ``isr``, ``osr``
+ - *bit_count*: number of bits to shift in (1-32)
+
+out(dest, bit_count)
+ Shift data out from OSR to *dest*.
+
+ - *dest*: one of: ``pins``, ``x``, ``y``, ``pindirs``, ``pc``, ``isr``,
+ ``exec``
+ - *bit_count*: number of bits to shift out (1-32)
+
+push(...)
+ Push ISR to the RX FIFO, then clear ISR to zero.
+ This instruction takes the following forms:
+
+ - push()
+ - push(block)
+ - push(noblock)
+ - push(iffull)
+ - push(iffull, block)
+ - push(iffull, noblock)
+
+ If ``block`` is used then the instruction stalls if the RX FIFO is full.
+ The default is to block. If ``iffull`` is used then it only pushes if the
+ input shift count has reached its threshold.
+
+pull(...)
+ Pull from the TX FIFO into OSR.
+ This instruction takes the following forms:
+
+ - pull()
+ - pull(block)
+ - pull(noblock)
+ - pull(ifempty)
+ - pull(ifempty, block)
+ - pull(ifempty, noblock)
+
+ If ``block`` is used then the instruction stalls if the TX FIFO is empty.
+ The default is to block. If ``ifempty`` is used then it only pulls if the
+ output shift count has reached its threshold.
+
+mov(dest, src)
+ Move into *dest* the value from *src*.
+
+ - *dest*: one of: ``pins``, ``x``, ``y``, ``exec``, ``pc``, ``isr``, ``osr``
+ - *src*: one of: ``pins``, ``x``, ``y``, ``null``, ``status``, ``isr``,
+ ``osr``; this argument can be optionally modified by wrapping it in
+ ``invert()`` or ``reverse()`` (but not both together)
+
+irq(...)
+ Set or clear an IRQ flag.
+ This instruction takes two forms:
+
+ irq(index)
+ - *index*: 0-7, or ``rel(0)`` to ``rel(7)``
+
+ irq(mode, index)
+ - *mode*: one of: ``block``, ``clear``
+ - *index*: 0-7, or ``rel(0)`` to ``rel(7)``
+
+ If ``block`` is used then the instruction stalls until the flag is cleared
+ by another entity. If ``clear`` is used then the flag is cleared instead of
+ being set. Relative IRQ indices add the state machine ID to the IRQ index
+ with modulo-4 addition. IRQs 0-3 are visible from to the processor, 4-7 are
+ internal to the state machines.
+
+set(dest, data)
+ Set *dest* with the value *data*.
+
+ - *dest*: ``pins``, ``x``, ``y``, ``pindirs``
+ - *data*: value (0-31)
+
+nop()
+ This is a pseudoinstruction that assembles to ``mov(y, y)`` and has no side
+ effect.
+
+.side(value)
+ This is a modifier which can be applied to any instruction, and is used to
+ control side-set pin values.
+
+ - *value*: the value (bits) to output on the side-set pins
+
+.delay(value)
+ This is a modifier which can be applied to any instruction, and specifies
+ how many cycles to delay for after the instruction executes.
+
+ - *value*: cycles to delay, 0-31 (maximum value reduced if side-set pins are
+ used)
+
+[value]
+ This is a modifier and is equivalent to ``.delay(value)``.
+
+
+Classes
+-------
+
+.. toctree::
+ :maxdepth: 1
+
+ rp2.Flash.rst
+ rp2.PIO.rst
+ rp2.StateMachine.rst
diff --git a/components/language/micropython/docs/library/select.rst b/components/language/micropython/docs/library/select.rst
new file mode 100644
index 00000000..57adbb49
--- /dev/null
+++ b/components/language/micropython/docs/library/select.rst
@@ -0,0 +1,99 @@
+:mod:`select` -- wait for events on a set of streams
+====================================================
+
+.. module:: select
+ :synopsis: wait for events on a set of streams
+
+|see_cpython_module| :mod:`python:select`.
+
+This module provides functions to efficiently wait for events on multiple
+`streams ` (select streams which are ready for operations).
+
+Functions
+---------
+
+.. function:: poll()
+
+ Create an instance of the Poll class.
+
+.. function:: select(rlist, wlist, xlist[, timeout])
+
+ Wait for activity on a set of objects.
+
+ This function is provided by some MicroPython ports for compatibility
+ and is not efficient. Usage of :class:`Poll` is recommended instead.
+
+.. _class: Poll
+
+class ``Poll``
+--------------
+
+Methods
+~~~~~~~
+
+.. method:: poll.register(obj[, eventmask])
+
+ Register `stream` *obj* for polling. *eventmask* is logical OR of:
+
+ * ``select.POLLIN`` - data available for reading
+ * ``select.POLLOUT`` - more data can be written
+
+ Note that flags like ``select.POLLHUP`` and ``select.POLLERR`` are
+ *not* valid as input eventmask (these are unsolicited events which
+ will be returned from `poll()` regardless of whether they are asked
+ for). This semantics is per POSIX.
+
+ *eventmask* defaults to ``select.POLLIN | select.POLLOUT``.
+
+ It is OK to call this function multiple times for the same *obj*.
+ Successive calls will update *obj*'s eventmask to the value of
+ *eventmask* (i.e. will behave as `modify()`).
+
+.. method:: poll.unregister(obj)
+
+ Unregister *obj* from polling.
+
+.. method:: poll.modify(obj, eventmask)
+
+ Modify the *eventmask* for *obj*. If *obj* is not registered, `OSError`
+ is raised with error of ENOENT.
+
+.. method:: poll.poll(timeout=-1, /)
+
+ Wait for at least one of the registered objects to become ready or have an
+ exceptional condition, with optional timeout in milliseconds (if *timeout*
+ arg is not specified or -1, there is no timeout).
+
+ Returns list of (``obj``, ``event``, ...) tuples. There may be other elements in
+ tuple, depending on a platform and version, so don't assume that its size is 2.
+ The ``event`` element specifies which events happened with a stream and
+ is a combination of ``select.POLL*`` constants described above. Note that
+ flags ``select.POLLHUP`` and ``select.POLLERR`` can be returned at any time
+ (even if were not asked for), and must be acted on accordingly (the
+ corresponding stream unregistered from poll and likely closed), because
+ otherwise all further invocations of `poll()` may return immediately with
+ these flags set for this stream again.
+
+ In case of timeout, an empty list is returned.
+
+ .. admonition:: Difference to CPython
+ :class: attention
+
+ Tuples returned may contain more than 2 elements as described above.
+
+.. method:: poll.ipoll(timeout=-1, flags=0, /)
+
+ Like :meth:`poll.poll`, but instead returns an iterator which yields a
+ `callee-owned tuple`. This function provides an efficient, allocation-free
+ way to poll on streams.
+
+ If *flags* is 1, one-shot behaviour for events is employed: streams for
+ which events happened will have their event masks automatically reset
+ (equivalent to ``poll.modify(obj, 0)``), so new events for such a stream
+ won't be processed until new mask is set with `poll.modify()`. This
+ behaviour is useful for asynchronous I/O schedulers.
+
+ .. admonition:: Difference to CPython
+ :class: attention
+
+ This function is a MicroPython extension.
diff --git a/components/language/micropython/docs/library/socket.rst b/components/language/micropython/docs/library/socket.rst
new file mode 100644
index 00000000..1d1c23ab
--- /dev/null
+++ b/components/language/micropython/docs/library/socket.rst
@@ -0,0 +1,353 @@
+******************************
+:mod:`socket` -- socket module
+******************************
+
+.. module:: socket
+ :synopsis: socket module
+
+|see_cpython_module| :mod:`python:socket`.
+
+This module provides access to the BSD socket interface.
+
+.. admonition:: Difference to CPython
+ :class: attention
+
+ For efficiency and consistency, socket objects in MicroPython implement a `stream`
+ (file-like) interface directly. In CPython, you need to convert a socket to
+ a file-like object using `makefile()` method. This method is still supported
+ by MicroPython (but is a no-op), so where compatibility with CPython matters,
+ be sure to use it.
+
+Socket address format(s)
+------------------------
+
+The native socket address format of the ``socket`` module is an opaque data type
+returned by `getaddrinfo` function, which must be used to resolve textual address
+(including numeric addresses)::
+
+ sockaddr = socket.getaddrinfo('www.micropython.org', 80)[0][-1]
+ # You must use getaddrinfo() even for numeric addresses
+ sockaddr = socket.getaddrinfo('127.0.0.1', 80)[0][-1]
+ # Now you can use that address
+ sock.connect(addr)
+
+Using `getaddrinfo` is the most efficient (both in terms of memory and processing
+power) and portable way to work with addresses.
+
+However, ``socket`` module (note the difference with native MicroPython
+``socket`` module described here) provides CPython-compatible way to specify
+addresses using tuples, as described below. Note that depending on a
+:term:`MicroPython port`, ``socket`` module can be builtin or need to be
+installed from `micropython-lib` (as in the case of :term:`MicroPython Unix port`),
+and some ports still accept only numeric addresses in the tuple format,
+and require to use `getaddrinfo` function to resolve domain names.
+
+Summing up:
+
+* Always use `getaddrinfo` when writing portable applications.
+* Tuple addresses described below can be used as a shortcut for
+ quick hacks and interactive use, if your port supports them.
+
+Tuple address format for ``socket`` module:
+
+* IPv4: *(ipv4_address, port)*, where *ipv4_address* is a string with
+ dot-notation numeric IPv4 address, e.g. ``"8.8.8.8"``, and *port* is and
+ integer port number in the range 1-65535. Note the domain names are not
+ accepted as *ipv4_address*, they should be resolved first using
+ `socket.getaddrinfo()`.
+* IPv6: *(ipv6_address, port, flowinfo, scopeid)*, where *ipv6_address*
+ is a string with colon-notation numeric IPv6 address, e.g. ``"2001:db8::1"``,
+ and *port* is an integer port number in the range 1-65535. *flowinfo*
+ must be 0. *scopeid* is the interface scope identifier for link-local
+ addresses. Note the domain names are not accepted as *ipv6_address*,
+ they should be resolved first using `socket.getaddrinfo()`. Availability
+ of IPv6 support depends on a :term:`MicroPython port`.
+
+Functions
+---------
+
+.. function:: getaddrinfo(host, port, af=0, type=0, proto=0, flags=0, /)
+
+ Translate the host/port argument into a sequence of 5-tuples that contain all the
+ necessary arguments for creating a socket connected to that service. Arguments
+ *af*, *type*, and *proto* (which have the same meaning as for the `socket()` function)
+ can be used to filter which kind of addresses are returned. If a parameter is not
+ specified or zero, all combinations of addresses can be returned (requiring
+ filtering on the user side).
+
+ The resulting list of 5-tuples has the following structure::
+
+ (family, type, proto, canonname, sockaddr)
+
+ The following example shows how to connect to a given url::
+
+ s = socket.socket()
+ # This assumes that if "type" is not specified, an address for
+ # SOCK_STREAM will be returned, which may be not true
+ s.connect(socket.getaddrinfo('www.micropython.org', 80)[0][-1])
+
+ Recommended use of filtering params::
+
+ s = socket.socket()
+ # Guaranteed to return an address which can be connect'ed to for
+ # stream operation.
+ s.connect(socket.getaddrinfo('www.micropython.org', 80, 0, SOCK_STREAM)[0][-1])
+
+ .. admonition:: Difference to CPython
+ :class: attention
+
+ CPython raises a ``socket.gaierror`` exception (`OSError` subclass) in case
+ of error in this function. MicroPython doesn't have ``socket.gaierror``
+ and raises OSError directly. Note that error numbers of `getaddrinfo()`
+ form a separate namespace and may not match error numbers from
+ the :mod:`errno` module. To distinguish `getaddrinfo()` errors, they are
+ represented by negative numbers, whereas standard system errors are
+ positive numbers (error numbers are accessible using ``e.args[0]`` property
+ from an exception object). The use of negative values is a provisional
+ detail which may change in the future.
+
+.. function:: inet_ntop(af, bin_addr)
+
+ Convert a binary network address *bin_addr* of the given address family *af*
+ to a textual representation::
+
+ >>> socket.inet_ntop(socket.AF_INET, b"\x7f\0\0\1")
+ '127.0.0.1'
+
+.. function:: inet_pton(af, txt_addr)
+
+ Convert a textual network address *txt_addr* of the given address family *af*
+ to a binary representation::
+
+ >>> socket.inet_pton(socket.AF_INET, "1.2.3.4")
+ b'\x01\x02\x03\x04'
+
+Constants
+---------
+
+.. data:: AF_INET
+ AF_INET6
+
+ Address family types. Availability depends on a particular :term:`MicroPython port`.
+
+.. data:: SOCK_STREAM
+ SOCK_DGRAM
+
+ Socket types.
+
+.. data:: IPPROTO_UDP
+ IPPROTO_TCP
+
+ IP protocol numbers. Availability depends on a particular :term:`MicroPython port`.
+ Note that you don't need to specify these in a call to `socket.socket()`,
+ because `SOCK_STREAM` socket type automatically selects `IPPROTO_TCP`, and
+ `SOCK_DGRAM` - `IPPROTO_UDP`. Thus, the only real use of these constants
+ is as an argument to `setsockopt()`.
+
+.. data:: socket.SOL_*
+
+ Socket option levels (an argument to `setsockopt()`). The exact
+ inventory depends on a :term:`MicroPython port`.
+
+.. data:: socket.SO_*
+
+ Socket options (an argument to `setsockopt()`). The exact
+ inventory depends on a :term:`MicroPython port`.
+
+Constants specific to WiPy:
+
+.. data:: IPPROTO_SEC
+
+ Special protocol value to create SSL-compatible socket.
+
+class socket
+============
+
+.. class:: socket(af=AF_INET, type=SOCK_STREAM, proto=IPPROTO_TCP, /)
+
+ Create a new socket using the given address family, socket type and
+ protocol number. Note that specifying *proto* in most cases is not
+ required (and not recommended, as some MicroPython ports may omit
+ ``IPPROTO_*`` constants). Instead, *type* argument will select needed
+ protocol automatically::
+
+ # Create STREAM TCP socket
+ socket(AF_INET, SOCK_STREAM)
+ # Create DGRAM UDP socket
+ socket(AF_INET, SOCK_DGRAM)
+
+Methods
+-------
+
+.. method:: socket.close()
+
+ Mark the socket closed and release all resources. Once that happens, all future operations
+ on the socket object will fail. The remote end will receive EOF indication if
+ supported by protocol.
+
+ Sockets are automatically closed when they are garbage-collected, but it is recommended
+ to `close()` them explicitly as soon you finished working with them.
+
+.. method:: socket.bind(address)
+
+ Bind the socket to *address*. The socket must not already be bound.
+
+.. method:: socket.listen([backlog])
+
+ Enable a server to accept connections. If *backlog* is specified, it must be at least 0
+ (if it's lower, it will be set to 0); and specifies the number of unaccepted connections
+ that the system will allow before refusing new connections. If not specified, a default
+ reasonable value is chosen.
+
+.. method:: socket.accept()
+
+ Accept a connection. The socket must be bound to an address and listening for connections.
+ The return value is a pair (conn, address) where conn is a new socket object usable to send
+ and receive data on the connection, and address is the address bound to the socket on the
+ other end of the connection.
+
+.. method:: socket.connect(address)
+
+ Connect to a remote socket at *address*.
+
+.. method:: socket.send(bytes)
+
+ Send data to the socket. The socket must be connected to a remote socket.
+ Returns number of bytes sent, which may be smaller than the length of data
+ ("short write").
+
+.. method:: socket.sendall(bytes)
+
+ Send all data to the socket. The socket must be connected to a remote socket.
+ Unlike `send()`, this method will try to send all of data, by sending data
+ chunk by chunk consecutively.
+
+ The behaviour of this method on non-blocking sockets is undefined. Due to this,
+ on MicroPython, it's recommended to use `write()` method instead, which
+ has the same "no short writes" policy for blocking sockets, and will return
+ number of bytes sent on non-blocking sockets.
+
+.. method:: socket.recv(bufsize)
+
+ Receive data from the socket. The return value is a bytes object representing the data
+ received. The maximum amount of data to be received at once is specified by bufsize.
+
+.. method:: socket.sendto(bytes, address)
+
+ Send data to the socket. The socket should not be connected to a remote socket, since the
+ destination socket is specified by *address*.
+
+.. method:: socket.recvfrom(bufsize)
+
+ Receive data from the socket. The return value is a pair *(bytes, address)* where *bytes* is a
+ bytes object representing the data received and *address* is the address of the socket sending
+ the data.
+
+.. method:: socket.setsockopt(level, optname, value)
+
+ Set the value of the given socket option. The needed symbolic constants are defined in the
+ socket module (SO_* etc.). The *value* can be an integer or a bytes-like object representing
+ a buffer.
+
+.. method:: socket.settimeout(value)
+
+ **Note**: Not every port supports this method, see below.
+
+ Set a timeout on blocking socket operations. The value argument can be a nonnegative floating
+ point number expressing seconds, or None. If a non-zero value is given, subsequent socket operations
+ will raise an `OSError` exception if the timeout period value has elapsed before the operation has
+ completed. If zero is given, the socket is put in non-blocking mode. If None is given, the socket
+ is put in blocking mode.
+
+ Not every :term:`MicroPython port` supports this method. A more portable and
+ generic solution is to use `select.poll` object. This allows to wait on
+ multiple objects at the same time (and not just on sockets, but on generic
+ `stream` objects which support polling). Example::
+
+ # Instead of:
+ s.settimeout(1.0) # time in seconds
+ s.read(10) # may timeout
+
+ # Use:
+ poller = select.poll()
+ poller.register(s, select.POLLIN)
+ res = poller.poll(1000) # time in milliseconds
+ if not res:
+ # s is still not ready for input, i.e. operation timed out
+
+ .. admonition:: Difference to CPython
+ :class: attention
+
+ CPython raises a ``socket.timeout`` exception in case of timeout,
+ which is an `OSError` subclass. MicroPython raises an OSError directly
+ instead. If you use ``except OSError:`` to catch the exception,
+ your code will work both in MicroPython and CPython.
+
+.. method:: socket.setblocking(flag)
+
+ Set blocking or non-blocking mode of the socket: if flag is false, the socket is set to non-blocking,
+ else to blocking mode.
+
+ This method is a shorthand for certain `settimeout()` calls:
+
+ * ``sock.setblocking(True)`` is equivalent to ``sock.settimeout(None)``
+ * ``sock.setblocking(False)`` is equivalent to ``sock.settimeout(0)``
+
+.. method:: socket.makefile(mode='rb', buffering=0, /)
+
+ Return a file object associated with the socket. The exact returned type depends on the arguments
+ given to makefile(). The support is limited to binary modes only ('rb', 'wb', and 'rwb').
+ CPython's arguments: *encoding*, *errors* and *newline* are not supported.
+
+ .. admonition:: Difference to CPython
+ :class: attention
+
+ As MicroPython doesn't support buffered streams, values of *buffering*
+ parameter is ignored and treated as if it was 0 (unbuffered).
+
+ .. admonition:: Difference to CPython
+ :class: attention
+
+ Closing the file object returned by makefile() WILL close the
+ original socket as well.
+
+.. method:: socket.read([size])
+
+ Read up to size bytes from the socket. Return a bytes object. If *size* is not given, it
+ reads all data available from the socket until EOF; as such the method will not return until
+ the socket is closed. This function tries to read as much data as
+ requested (no "short reads"). This may be not possible with
+ non-blocking socket though, and then less data will be returned.
+
+.. method:: socket.readinto(buf[, nbytes])
+
+ Read bytes into the *buf*. If *nbytes* is specified then read at most
+ that many bytes. Otherwise, read at most *len(buf)* bytes. Just as
+ `read()`, this method follows "no short reads" policy.
+
+ Return value: number of bytes read and stored into *buf*.
+
+.. method:: socket.readline()
+
+ Read a line, ending in a newline character.
+
+ Return value: the line read.
+
+.. method:: socket.write(buf)
+
+ Write the buffer of bytes to the socket. This function will try to
+ write all data to a socket (no "short writes"). This may be not possible
+ with a non-blocking socket though, and returned value will be less than
+ the length of *buf*.
+
+ Return value: number of bytes written.
+
+.. exception:: socket.error
+
+ MicroPython does NOT have this exception.
+
+ .. admonition:: Difference to CPython
+ :class: attention
+
+ CPython used to have a ``socket.error`` exception which is now deprecated,
+ and is an alias of `OSError`. In MicroPython, use `OSError` directly.
diff --git a/components/language/micropython/docs/library/ssl.rst b/components/language/micropython/docs/library/ssl.rst
new file mode 100644
index 00000000..4726daa5
--- /dev/null
+++ b/components/language/micropython/docs/library/ssl.rst
@@ -0,0 +1,61 @@
+:mod:`ssl` -- SSL/TLS module
+============================
+
+.. module:: ssl
+ :synopsis: TLS/SSL wrapper for socket objects
+
+|see_cpython_module| :mod:`python:ssl`.
+
+This module provides access to Transport Layer Security (previously and
+widely known as “Secure Sockets Layer”) encryption and peer authentication
+facilities for network sockets, both client-side and server-side.
+
+Functions
+---------
+
+.. function:: ssl.wrap_socket(sock, server_side=False, keyfile=None, certfile=None, cert_reqs=CERT_NONE, ca_certs=None, do_handshake=True)
+
+ Takes a `stream` *sock* (usually socket.socket instance of ``SOCK_STREAM`` type),
+ and returns an instance of ssl.SSLSocket, which wraps the underlying stream in
+ an SSL context. Returned object has the usual `stream` interface methods like
+ ``read()``, ``write()``, etc.
+ A server-side SSL socket should be created from a normal socket returned from
+ :meth:`~socket.socket.accept()` on a non-SSL listening server socket.
+
+ - *do_handshake* determines whether the handshake is done as part of the ``wrap_socket``
+ or whether it is deferred to be done as part of the initial reads or writes
+ (there is no ``do_handshake`` method as in CPython).
+ For blocking sockets doing the handshake immediately is standard. For non-blocking
+ sockets (i.e. when the *sock* passed into ``wrap_socket`` is in non-blocking mode)
+ the handshake should generally be deferred because otherwise ``wrap_socket`` blocks
+ until it completes. Note that in AXTLS the handshake can be deferred until the first
+ read or write but it then blocks until completion.
+
+ Depending on the underlying module implementation in a particular
+ :term:`MicroPython port`, some or all keyword arguments above may be not supported.
+
+.. warning::
+
+ Some implementations of ``ssl`` module do NOT validate server certificates,
+ which makes an SSL connection established prone to man-in-the-middle attacks.
+
+ CPython's ``wrap_socket`` returns an ``SSLSocket`` object which has methods typical
+ for sockets, such as ``send``, ``recv``, etc. MicroPython's ``wrap_socket``
+ returns an object more similar to CPython's ``SSLObject`` which does not have
+ these socket methods.
+
+Exceptions
+----------
+
+.. data:: ssl.SSLError
+
+ This exception does NOT exist. Instead its base class, OSError, is used.
+
+Constants
+---------
+
+.. data:: ssl.CERT_NONE
+ ssl.CERT_OPTIONAL
+ ssl.CERT_REQUIRED
+
+ Supported values for *cert_reqs* parameter.
diff --git a/components/language/micropython/docs/library/stm.rst b/components/language/micropython/docs/library/stm.rst
new file mode 100644
index 00000000..a181d604
--- /dev/null
+++ b/components/language/micropython/docs/library/stm.rst
@@ -0,0 +1,104 @@
+.. currentmodule:: stm
+
+:mod:`stm` --- functionality specific to STM32 MCUs
+===================================================
+
+.. module:: stm
+ :synopsis: functionality specific to STM32 MCUs
+
+This module provides functionality specific to STM32 microcontrollers, including
+direct access to peripheral registers.
+
+Memory access
+-------------
+
+The module exposes three objects used for raw memory access.
+
+.. data:: mem8
+
+ Read/write 8 bits of memory.
+
+.. data:: mem16
+
+ Read/write 16 bits of memory.
+
+.. data:: mem32
+
+ Read/write 32 bits of memory.
+
+Use subscript notation ``[...]`` to index these objects with the address of
+interest.
+
+These memory objects can be used in combination with the peripheral register
+constants to read and write registers of the MCU hardware peripherals, as well
+as all other areas of address space.
+
+
+Peripheral register constants
+-----------------------------
+
+The module defines constants for registers which are generated from CMSIS header
+files, and the constants available depend on the microcontroller series that is
+being compiled for. Examples of some constants include:
+
+.. data:: GPIOA
+
+ Base address of the GPIOA peripheral.
+
+.. data:: GPIOB
+
+ Base address of the GPIOB peripheral.
+
+.. data:: GPIO_BSRR
+
+ Offset of the GPIO bit set/reset register.
+
+.. data:: GPIO_IDR
+
+ Offset of the GPIO input data register.
+
+.. data:: GPIO_ODR
+
+ Offset of the GPIO output data register.
+
+Constants that are named after a peripheral, like ``GPIOA``, are the absolute
+address of that peripheral. Constants that have a prefix which is the name of a
+peripheral, like ``GPIO_BSRR``, are relative offsets of the register. Accessing
+peripheral registers requires adding the absolute base address of the peripheral
+and the relative register offset. For example ``GPIOA + GPIO_BSRR`` is the
+full, absolute address of the ``GPIOA->BSRR`` register.
+
+Example use:
+
+.. code-block:: python3
+
+ # set PA2 high
+ stm.mem32[stm.GPIOA + stm.GPIO_BSRR] = 1 << 2
+
+ # read PA3
+ value = (stm.mem32[stm.GPIOA + stm.GPIO_IDR] >> 3) & 1
+
+
+Functions specific to STM32WBxx MCUs
+------------------------------------
+
+These functions are available on STM32WBxx microcontrollers, and interact with
+the second CPU, the RF core.
+
+.. function:: rfcore_status()
+
+ Returns the status of the second CPU as an integer (the first word of device
+ info table).
+
+.. function:: rfcore_fw_version(id)
+
+ Get the version of the firmware running on the second CPU. Pass in 0 for
+ *id* to get the FUS version, and 1 to get the WS version.
+
+ Returns a 5-tuple with the full version number.
+
+.. function:: rfcore_sys_hci(ogf, ocf, data, timeout_ms=0)
+
+ Execute a HCI command on the SYS channel. The execution is synchronous.
+
+ Returns a bytes object with the result of the SYS command.
diff --git a/components/language/micropython/docs/library/struct.rst b/components/language/micropython/docs/library/struct.rst
new file mode 100644
index 00000000..92757aba
--- /dev/null
+++ b/components/language/micropython/docs/library/struct.rst
@@ -0,0 +1,47 @@
+:mod:`struct` -- pack and unpack primitive data types
+=====================================================
+
+.. module:: struct
+ :synopsis: pack and unpack primitive data types
+
+|see_cpython_module| :mod:`python:struct`.
+
+Supported size/byte order prefixes: ``@``, ``<``, ``>``, ``!``.
+
+Supported format codes: ``b``, ``B``, ``h``, ``H``, ``i``, ``I``, ``l``,
+``L``, ``q``, ``Q``, ``s``, ``P``, ``f``, ``d`` (the latter 2 depending
+on the floating-point support).
+
+.. admonition:: Difference to CPython
+ :class: attention
+
+ Whitespace is not supported in format strings.
+
+Functions
+---------
+
+.. function:: calcsize(fmt)
+
+ Return the number of bytes needed to store the given *fmt*.
+
+.. function:: pack(fmt, v1, v2, ...)
+
+ Pack the values *v1*, *v2*, ... according to the format string *fmt*.
+ The return value is a bytes object encoding the values.
+
+.. function:: pack_into(fmt, buffer, offset, v1, v2, ...)
+
+ Pack the values *v1*, *v2*, ... according to the format string *fmt*
+ into a *buffer* starting at *offset*. *offset* may be negative to count
+ from the end of *buffer*.
+
+.. function:: unpack(fmt, data)
+
+ Unpack from the *data* according to the format string *fmt*.
+ The return value is a tuple of the unpacked values.
+
+.. function:: unpack_from(fmt, data, offset=0, /)
+
+ Unpack from the *data* starting at *offset* according to the format string
+ *fmt*. *offset* may be negative to count from the end of *buffer*. The return
+ value is a tuple of the unpacked values.
diff --git a/components/language/micropython/docs/library/sys.rst b/components/language/micropython/docs/library/sys.rst
new file mode 100644
index 00000000..3efdce96
--- /dev/null
+++ b/components/language/micropython/docs/library/sys.rst
@@ -0,0 +1,175 @@
+:mod:`sys` -- system specific functions
+=======================================
+
+.. module:: sys
+ :synopsis: system specific functions
+
+|see_cpython_module| :mod:`python:sys`.
+
+Functions
+---------
+
+.. function:: exit(retval=0, /)
+
+ Terminate current program with a given exit code. Underlyingly, this
+ function raise as `SystemExit` exception. If an argument is given, its
+ value given as an argument to `SystemExit`.
+
+.. function:: atexit(func)
+
+ Register *func* to be called upon termination. *func* must be a callable
+ that takes no arguments, or ``None`` to disable the call. The ``atexit``
+ function will return the previous value set by this function, which is
+ initially ``None``.
+
+ .. admonition:: Difference to CPython
+ :class: attention
+
+ This function is a MicroPython extension intended to provide similar
+ functionality to the :mod:`atexit` module in CPython.
+
+.. function:: print_exception(exc, file=sys.stdout, /)
+
+ Print exception with a traceback to a file-like object *file* (or
+ `sys.stdout` by default).
+
+ .. admonition:: Difference to CPython
+ :class: attention
+
+ This is simplified version of a function which appears in the
+ ``traceback`` module in CPython. Unlike ``traceback.print_exception()``,
+ this function takes just exception value instead of exception type,
+ exception value, and traceback object; *file* argument should be
+ positional; further arguments are not supported. CPython-compatible
+ ``traceback`` module can be found in `micropython-lib`.
+
+.. function:: settrace(tracefunc)
+
+ Enable tracing of bytecode execution. For details see the `CPython
+ documentaion `_.
+
+ This function requires a custom MicroPython build as it is typically not
+ present in pre-built firmware (due to it affecting performance). The relevant
+ configuration option is *MICROPY_PY_SYS_SETTRACE*.
+
+Constants
+---------
+
+.. data:: argv
+
+ A mutable list of arguments the current program was started with.
+
+.. data:: byteorder
+
+ The byte order of the system (``"little"`` or ``"big"``).
+
+.. data:: implementation
+
+ Object with information about the current Python implementation. For
+ MicroPython, it has following attributes:
+
+ * *name* - string "micropython"
+ * *version* - tuple (major, minor, micro), e.g. (1, 7, 0)
+ * *_machine* - string describing the underlying machine
+ * *_mpy* - supported mpy file-format version (optional attribute)
+
+ This object is the recommended way to distinguish MicroPython from other
+ Python implementations (note that it still may not exist in the very
+ minimal ports).
+
+ .. admonition:: Difference to CPython
+ :class: attention
+
+ CPython mandates more attributes for this object, but the actual useful
+ bare minimum is implemented in MicroPython.
+
+.. data:: maxsize
+
+ Maximum value which a native integer type can hold on the current platform,
+ or maximum value representable by MicroPython integer type, if it's smaller
+ than platform max value (that is the case for MicroPython ports without
+ long int support).
+
+ This attribute is useful for detecting "bitness" of a platform (32-bit vs
+ 64-bit, etc.). It's recommended to not compare this attribute to some
+ value directly, but instead count number of bits in it::
+
+ bits = 0
+ v = sys.maxsize
+ while v:
+ bits += 1
+ v >>= 1
+ if bits > 32:
+ # 64-bit (or more) platform
+ ...
+ else:
+ # 32-bit (or less) platform
+ # Note that on 32-bit platform, value of bits may be less than 32
+ # (e.g. 31) due to peculiarities described above, so use "> 16",
+ # "> 32", "> 64" style of comparisons.
+
+.. data:: modules
+
+ Dictionary of loaded modules. On some ports, it may not include builtin
+ modules.
+
+.. data:: path
+
+ A mutable list of directories to search for imported modules.
+
+ .. admonition:: Difference to CPython
+ :class: attention
+
+ On MicroPython, an entry with the value ``".frozen"`` will indicate that import
+ should search :term:`frozen modules ` at that point in the search.
+ If no frozen module is found then search will *not* look for a directory called
+ ``.frozen``, instead it will continue with the next entry in ``sys.path``.
+
+.. data:: platform
+
+ The platform that MicroPython is running on. For OS/RTOS ports, this is
+ usually an identifier of the OS, e.g. ``"linux"``. For baremetal ports it
+ is an identifier of a board, e.g. ``"pyboard"`` for the original MicroPython
+ reference board. It thus can be used to distinguish one board from another.
+ If you need to check whether your program runs on MicroPython (vs other
+ Python implementation), use `sys.implementation` instead.
+
+.. data:: ps1
+ ps2
+
+ Mutable attributes holding strings, which are used for the REPL prompt. The defaults
+ give the standard Python prompt of ``>>>`` and ``...``.
+
+.. data:: stderr
+
+ Standard error `stream`.
+
+.. data:: stdin
+
+ Standard input `stream`.
+
+.. data:: stdout
+
+ Standard output `stream`.
+
+.. data:: tracebacklimit
+
+ A mutable attribute holding an integer value which is the maximum number of traceback
+ entries to store in an exception. Set to 0 to disable adding tracebacks. Defaults
+ to 1000.
+
+ Note: this is not available on all ports.
+
+.. data:: version
+
+ Python language version that this implementation conforms to, as a string.
+
+.. data:: version_info
+
+ Python language version that this implementation conforms to, as a tuple of ints.
+
+ .. admonition:: Difference to CPython
+ :class: attention
+
+ Only the first three version numbers (major, minor, micro) are supported and
+ they can be referenced only by index, not by name.
diff --git a/components/language/micropython/docs/library/time.rst b/components/language/micropython/docs/library/time.rst
new file mode 100644
index 00000000..6ca172f2
--- /dev/null
+++ b/components/language/micropython/docs/library/time.rst
@@ -0,0 +1,250 @@
+:mod:`time` -- time related functions
+=====================================
+
+.. module:: time
+ :synopsis: time related functions
+
+|see_cpython_module| :mod:`python:time`.
+
+The ``time`` module provides functions for getting the current time and date,
+measuring time intervals, and for delays.
+
+**Time Epoch**: Unix port uses standard for POSIX systems epoch of
+1970-01-01 00:00:00 UTC. However, embedded ports use epoch of
+2000-01-01 00:00:00 UTC.
+
+**Maintaining actual calendar date/time**: This requires a
+Real Time Clock (RTC). On systems with underlying OS (including some
+RTOS), an RTC may be implicit. Setting and maintaining actual calendar
+time is responsibility of OS/RTOS and is done outside of MicroPython,
+it just uses OS API to query date/time. On baremetal ports however
+system time depends on ``machine.RTC()`` object. The current calendar time
+may be set using ``machine.RTC().datetime(tuple)`` function, and maintained
+by following means:
+
+* By a backup battery (which may be an additional, optional component for
+ a particular board).
+* Using networked time protocol (requires setup by a port/user).
+* Set manually by a user on each power-up (many boards then maintain
+ RTC time across hard resets, though some may require setting it again
+ in such case).
+
+If actual calendar time is not maintained with a system/MicroPython RTC,
+functions below which require reference to current absolute time may
+behave not as expected.
+
+Functions
+---------
+
+.. function:: gmtime([secs])
+ localtime([secs])
+
+ Convert the time *secs* expressed in seconds since the Epoch (see above) into an
+ 8-tuple which contains: ``(year, month, mday, hour, minute, second, weekday, yearday)``
+ If *secs* is not provided or None, then the current time from the RTC is used.
+
+ The `gmtime()` function returns a date-time tuple in UTC, and `localtime()` returns a
+ date-time tuple in local time.
+
+ The format of the entries in the 8-tuple are:
+
+ * year includes the century (for example 2014).
+ * month is 1-12
+ * mday is 1-31
+ * hour is 0-23
+ * minute is 0-59
+ * second is 0-59
+ * weekday is 0-6 for Mon-Sun
+ * yearday is 1-366
+
+.. function:: mktime()
+
+ This is inverse function of localtime. It's argument is a full 8-tuple
+ which expresses a time as per localtime. It returns an integer which is
+ the number of seconds since Jan 1, 2000.
+
+.. function:: sleep(seconds)
+
+ Sleep for the given number of seconds. Some boards may accept *seconds* as a
+ floating-point number to sleep for a fractional number of seconds. Note that
+ other boards may not accept a floating-point argument, for compatibility with
+ them use `sleep_ms()` and `sleep_us()` functions.
+
+.. function:: sleep_ms(ms)
+
+ Delay for given number of milliseconds, should be positive or 0.
+
+ This function will delay for at least the given number of milliseconds, but
+ may take longer than that if other processing must take place, for example
+ interrupt handlers or other threads. Passing in 0 for *ms* will still allow
+ this other processing to occur. Use `sleep_us()` for more precise delays.
+
+.. function:: sleep_us(us)
+
+ Delay for given number of microseconds, should be positive or 0.
+
+ This function attempts to provide an accurate delay of at least *us*
+ microseconds, but it may take longer if the system has other higher priority
+ processing to perform.
+
+.. function:: ticks_ms()
+
+ Returns an increasing millisecond counter with an arbitrary reference point, that
+ wraps around after some value.
+
+ The wrap-around value is not explicitly exposed, but we will
+ refer to it as *TICKS_MAX* to simplify discussion. Period of the values is
+ *TICKS_PERIOD = TICKS_MAX + 1*. *TICKS_PERIOD* is guaranteed to be a power of
+ two, but otherwise may differ from port to port. The same period value is used
+ for all of `ticks_ms()`, `ticks_us()`, `ticks_cpu()` functions (for
+ simplicity). Thus, these functions will return a value in range [*0* ..
+ *TICKS_MAX*], inclusive, total *TICKS_PERIOD* values. Note that only
+ non-negative values are used. For the most part, you should treat values returned
+ by these functions as opaque. The only operations available for them are
+ `ticks_diff()` and `ticks_add()` functions described below.
+
+ Note: Performing standard mathematical operations (+, -) or relational
+ operators (<, <=, >, >=) directly on these value will lead to invalid
+ result. Performing mathematical operations and then passing their results
+ as arguments to `ticks_diff()` or `ticks_add()` will also lead to
+ invalid results from the latter functions.
+
+.. function:: ticks_us()
+
+ Just like `ticks_ms()` above, but in microseconds.
+
+.. function:: ticks_cpu()
+
+ Similar to `ticks_ms()` and `ticks_us()`, but with the highest possible resolution
+ in the system. This is usually CPU clocks, and that's why the function is named that
+ way. But it doesn't have to be a CPU clock, some other timing source available in a
+ system (e.g. high-resolution timer) can be used instead. The exact timing unit
+ (resolution) of this function is not specified on ``time`` module level, but
+ documentation for a specific port may provide more specific information. This
+ function is intended for very fine benchmarking or very tight real-time loops.
+ Avoid using it in portable code.
+
+ Availability: Not every port implements this function.
+
+
+.. function:: ticks_add(ticks, delta)
+
+ Offset ticks value by a given number, which can be either positive or negative.
+ Given a *ticks* value, this function allows to calculate ticks value *delta*
+ ticks before or after it, following modular-arithmetic definition of tick values
+ (see `ticks_ms()` above). *ticks* parameter must be a direct result of call
+ to `ticks_ms()`, `ticks_us()`, or `ticks_cpu()` functions (or from previous
+ call to `ticks_add()`). However, *delta* can be an arbitrary integer number
+ or numeric expression. `ticks_add()` is useful for calculating deadlines for
+ events/tasks. (Note: you must use `ticks_diff()` function to work with
+ deadlines.)
+
+ Examples::
+
+ # Find out what ticks value there was 100ms ago
+ print(ticks_add(time.ticks_ms(), -100))
+
+ # Calculate deadline for operation and test for it
+ deadline = ticks_add(time.ticks_ms(), 200)
+ while ticks_diff(deadline, time.ticks_ms()) > 0:
+ do_a_little_of_something()
+
+ # Find out TICKS_MAX used by this port
+ print(ticks_add(0, -1))
+
+
+.. function:: ticks_diff(ticks1, ticks2)
+
+ Measure ticks difference between values returned from `ticks_ms()`, `ticks_us()`,
+ or `ticks_cpu()` functions, as a signed value which may wrap around.
+
+ The argument order is the same as for subtraction
+ operator, ``ticks_diff(ticks1, ticks2)`` has the same meaning as ``ticks1 - ticks2``.
+ However, values returned by `ticks_ms()`, etc. functions may wrap around, so
+ directly using subtraction on them will produce incorrect result. That is why
+ `ticks_diff()` is needed, it implements modular (or more specifically, ring)
+ arithmetics to produce correct result even for wrap-around values (as long as they not
+ too distant inbetween, see below). The function returns **signed** value in the range
+ [*-TICKS_PERIOD/2* .. *TICKS_PERIOD/2-1*] (that's a typical range definition for
+ two's-complement signed binary integers). If the result is negative, it means that
+ *ticks1* occurred earlier in time than *ticks2*. Otherwise, it means that
+ *ticks1* occurred after *ticks2*. This holds **only** if *ticks1* and *ticks2*
+ are apart from each other for no more than *TICKS_PERIOD/2-1* ticks. If that does
+ not hold, incorrect result will be returned. Specifically, if two tick values are
+ apart for *TICKS_PERIOD/2-1* ticks, that value will be returned by the function.
+ However, if *TICKS_PERIOD/2* of real-time ticks has passed between them, the
+ function will return *-TICKS_PERIOD/2* instead, i.e. result value will wrap around
+ to the negative range of possible values.
+
+ Informal rationale of the constraints above: Suppose you are locked in a room with no
+ means to monitor passing of time except a standard 12-notch clock. Then if you look at
+ dial-plate now, and don't look again for another 13 hours (e.g., if you fall for a
+ long sleep), then once you finally look again, it may seem to you that only 1 hour
+ has passed. To avoid this mistake, just look at the clock regularly. Your application
+ should do the same. "Too long sleep" metaphor also maps directly to application
+ behaviour: don't let your application run any single task for too long. Run tasks
+ in steps, and do time-keeping inbetween.
+
+ `ticks_diff()` is designed to accommodate various usage patterns, among them:
+
+ * Polling with timeout. In this case, the order of events is known, and you will deal
+ only with positive results of `ticks_diff()`::
+
+ # Wait for GPIO pin to be asserted, but at most 500us
+ start = time.ticks_us()
+ while pin.value() == 0:
+ if time.ticks_diff(time.ticks_us(), start) > 500:
+ raise TimeoutError
+
+ * Scheduling events. In this case, `ticks_diff()` result may be negative
+ if an event is overdue::
+
+ # This code snippet is not optimized
+ now = time.ticks_ms()
+ scheduled_time = task.scheduled_time()
+ if ticks_diff(scheduled_time, now) > 0:
+ print("Too early, let's nap")
+ sleep_ms(ticks_diff(scheduled_time, now))
+ task.run()
+ elif ticks_diff(scheduled_time, now) == 0:
+ print("Right at time!")
+ task.run()
+ elif ticks_diff(scheduled_time, now) < 0:
+ print("Oops, running late, tell task to run faster!")
+ task.run(run_faster=true)
+
+ Note: Do not pass `time()` values to `ticks_diff()`, you should use
+ normal mathematical operations on them. But note that `time()` may (and will)
+ also overflow. This is known as https://en.wikipedia.org/wiki/Year_2038_problem .
+
+
+.. function:: time()
+
+ Returns the number of seconds, as an integer, since the Epoch, assuming that
+ underlying RTC is set and maintained as described above. If an RTC is not set, this
+ function returns number of seconds since a port-specific reference point in time (for
+ embedded boards without a battery-backed RTC, usually since power up or reset). If you
+ want to develop portable MicroPython application, you should not rely on this function
+ to provide higher than second precision. If you need higher precision, absolute
+ timestamps, use `time_ns()`. If relative times are acceptable then use the
+ `ticks_ms()` and `ticks_us()` functions. If you need calendar time, `gmtime()` or
+ `localtime()` without an argument is a better choice.
+
+ .. admonition:: Difference to CPython
+ :class: attention
+
+ In CPython, this function returns number of
+ seconds since Unix epoch, 1970-01-01 00:00 UTC, as a floating-point,
+ usually having microsecond precision. With MicroPython, only Unix port
+ uses the same Epoch, and if floating-point precision allows,
+ returns sub-second precision. Embedded hardware usually doesn't have
+ floating-point precision to represent both long time ranges and subsecond
+ precision, so they use integer value with second precision. Some embedded
+ hardware also lacks battery-powered RTC, so returns number of seconds
+ since last power-up or from other relative, hardware-specific point
+ (e.g. reset).
+
+.. function:: time_ns()
+
+ Similar to `time()` but returns nanoseconds since the Epoch, as an integer (usually
+ a big integer, so will allocate on the heap).
diff --git a/components/language/micropython/docs/library/uasyncio.rst b/components/language/micropython/docs/library/uasyncio.rst
new file mode 100644
index 00000000..a842cc64
--- /dev/null
+++ b/components/language/micropython/docs/library/uasyncio.rst
@@ -0,0 +1,352 @@
+:mod:`uasyncio` --- asynchronous I/O scheduler
+==============================================
+
+.. module:: uasyncio
+ :synopsis: asynchronous I/O scheduler for writing concurrent code
+
+|see_cpython_module|
+`asyncio `_
+
+Example::
+
+ import uasyncio
+
+ async def blink(led, period_ms):
+ while True:
+ led.on()
+ await uasyncio.sleep_ms(5)
+ led.off()
+ await uasyncio.sleep_ms(period_ms)
+
+ async def main(led1, led2):
+ uasyncio.create_task(blink(led1, 700))
+ uasyncio.create_task(blink(led2, 400))
+ await uasyncio.sleep_ms(10_000)
+
+ # Running on a pyboard
+ from pyb import LED
+ uasyncio.run(main(LED(1), LED(2)))
+
+ # Running on a generic board
+ from machine import Pin
+ uasyncio.run(main(Pin(1), Pin(2)))
+
+Core functions
+--------------
+
+.. function:: create_task(coro)
+
+ Create a new task from the given coroutine and schedule it to run.
+
+ Returns the corresponding `Task` object.
+
+.. function:: current_task()
+
+ Return the `Task` object associated with the currently running task.
+
+.. function:: run(coro)
+
+ Create a new task from the given coroutine and run it until it completes.
+
+ Returns the value returned by *coro*.
+
+.. function:: sleep(t)
+
+ Sleep for *t* seconds (can be a float).
+
+ This is a coroutine.
+
+.. function:: sleep_ms(t)
+
+ Sleep for *t* milliseconds.
+
+ This is a coroutine, and a MicroPython extension.
+
+Additional functions
+--------------------
+
+.. function:: wait_for(awaitable, timeout)
+
+ Wait for the *awaitable* to complete, but cancel it if it takes longer
+ than *timeout* seconds. If *awaitable* is not a task then a task will be
+ created from it.
+
+ If a timeout occurs, it cancels the task and raises ``asyncio.TimeoutError``:
+ this should be trapped by the caller. The task receives
+ ``asyncio.CancelledError`` which may be ignored or trapped using ``try...except``
+ or ``try...finally`` to run cleanup code.
+
+ Returns the return value of *awaitable*.
+
+ This is a coroutine.
+
+.. function:: wait_for_ms(awaitable, timeout)
+
+ Similar to `wait_for` but *timeout* is an integer in milliseconds.
+
+ This is a coroutine, and a MicroPython extension.
+
+.. function:: gather(*awaitables, return_exceptions=False)
+
+ Run all *awaitables* concurrently. Any *awaitables* that are not tasks are
+ promoted to tasks.
+
+ Returns a list of return values of all *awaitables*.
+
+ This is a coroutine.
+
+class Task
+----------
+
+.. class:: Task()
+
+ This object wraps a coroutine into a running task. Tasks can be waited on
+ using ``await task``, which will wait for the task to complete and return
+ the return value of the task.
+
+ Tasks should not be created directly, rather use `create_task` to create them.
+
+.. method:: Task.cancel()
+
+ Cancel the task by injecting ``asyncio.CancelledError`` into it. The task may
+ ignore this exception. Cleanup code may be run by trapping it, or via
+ ``try ... finally``.
+
+class Event
+-----------
+
+.. class:: Event()
+
+ Create a new event which can be used to synchronise tasks. Events start
+ in the cleared state.
+
+.. method:: Event.is_set()
+
+ Returns ``True`` if the event is set, ``False`` otherwise.
+
+.. method:: Event.set()
+
+ Set the event. Any tasks waiting on the event will be scheduled to run.
+
+ Note: This must be called from within a task. It is not safe to call this
+ from an IRQ, scheduler callback, or other thread. See `ThreadSafeFlag`.
+
+.. method:: Event.clear()
+
+ Clear the event.
+
+.. method:: Event.wait()
+
+ Wait for the event to be set. If the event is already set then it returns
+ immediately.
+
+ This is a coroutine.
+
+class ThreadSafeFlag
+--------------------
+
+.. class:: ThreadSafeFlag()
+
+ Create a new flag which can be used to synchronise a task with code running
+ outside the asyncio loop, such as other threads, IRQs, or scheduler
+ callbacks. Flags start in the cleared state.
+
+.. method:: ThreadSafeFlag.set()
+
+ Set the flag. If there is a task waiting on the event, it will be scheduled
+ to run.
+
+.. method:: ThreadSafeFlag.wait()
+
+ Wait for the flag to be set. If the flag is already set then it returns
+ immediately. The flag is automatically reset upon return from ``wait``.
+
+ A flag may only be waited on by a single task at a time.
+
+ This is a coroutine.
+
+class Lock
+----------
+
+.. class:: Lock()
+
+ Create a new lock which can be used to coordinate tasks. Locks start in
+ the unlocked state.
+
+ In addition to the methods below, locks can be used in an ``async with`` statement.
+
+.. method:: Lock.locked()
+
+ Returns ``True`` if the lock is locked, otherwise ``False``.
+
+.. method:: Lock.acquire()
+
+ Wait for the lock to be in the unlocked state and then lock it in an atomic
+ way. Only one task can acquire the lock at any one time.
+
+ This is a coroutine.
+
+.. method:: Lock.release()
+
+ Release the lock. If any tasks are waiting on the lock then the next one in the
+ queue is scheduled to run and the lock remains locked. Otherwise, no tasks are
+ waiting an the lock becomes unlocked.
+
+TCP stream connections
+----------------------
+
+.. function:: open_connection(host, port)
+
+ Open a TCP connection to the given *host* and *port*. The *host* address will be
+ resolved using `socket.getaddrinfo`, which is currently a blocking call.
+
+ Returns a pair of streams: a reader and a writer stream.
+ Will raise a socket-specific ``OSError`` if the host could not be resolved or if
+ the connection could not be made.
+
+ This is a coroutine.
+
+.. function:: start_server(callback, host, port, backlog=5)
+
+ Start a TCP server on the given *host* and *port*. The *callback* will be
+ called with incoming, accepted connections, and be passed 2 arguments: reader
+ and writer streams for the connection.
+
+ Returns a `Server` object.
+
+ This is a coroutine.
+
+.. class:: Stream()
+
+ This represents a TCP stream connection. To minimise code this class implements
+ both a reader and a writer, and both ``StreamReader`` and ``StreamWriter`` alias to
+ this class.
+
+.. method:: Stream.get_extra_info(v)
+
+ Get extra information about the stream, given by *v*. The valid values for *v* are:
+ ``peername``.
+
+.. method:: Stream.close()
+
+ Close the stream.
+
+.. method:: Stream.wait_closed()
+
+ Wait for the stream to close.
+
+ This is a coroutine.
+
+.. method:: Stream.read(n)
+
+ Read up to *n* bytes and return them.
+
+ This is a coroutine.
+
+.. method:: Stream.readinto(buf)
+
+ Read up to n bytes into *buf* with n being equal to the length of *buf*.
+
+ Return the number of bytes read into *buf*.
+
+ This is a coroutine, and a MicroPython extension.
+
+.. method:: Stream.readexactly(n)
+
+ Read exactly *n* bytes and return them as a bytes object.
+
+ Raises an ``EOFError`` exception if the stream ends before reading *n* bytes.
+
+ This is a coroutine.
+
+.. method:: Stream.readline()
+
+ Read a line and return it.
+
+ This is a coroutine.
+
+.. method:: Stream.write(buf)
+
+ Accumulated *buf* to the output buffer. The data is only flushed when
+ `Stream.drain` is called. It is recommended to call `Stream.drain` immediately
+ after calling this function.
+
+.. method:: Stream.drain()
+
+ Drain (write) all buffered output data out to the stream.
+
+ This is a coroutine.
+
+.. class:: Server()
+
+ This represents the server class returned from `start_server`. It can be used
+ in an ``async with`` statement to close the server upon exit.
+
+.. method:: Server.close()
+
+ Close the server.
+
+.. method:: Server.wait_closed()
+
+ Wait for the server to close.
+
+ This is a coroutine.
+
+Event Loop
+----------
+
+.. function:: get_event_loop()
+
+ Return the event loop used to schedule and run tasks. See `Loop`.
+
+.. function:: new_event_loop()
+
+ Reset the event loop and return it.
+
+ Note: since MicroPython only has a single event loop this function just
+ resets the loop's state, it does not create a new one.
+
+.. class:: Loop()
+
+ This represents the object which schedules and runs tasks. It cannot be
+ created, use `get_event_loop` instead.
+
+.. method:: Loop.create_task(coro)
+
+ Create a task from the given *coro* and return the new `Task` object.
+
+.. method:: Loop.run_forever()
+
+ Run the event loop until `stop()` is called.
+
+.. method:: Loop.run_until_complete(awaitable)
+
+ Run the given *awaitable* until it completes. If *awaitable* is not a task
+ then it will be promoted to one.
+
+.. method:: Loop.stop()
+
+ Stop the event loop.
+
+.. method:: Loop.close()
+
+ Close the event loop.
+
+.. method:: Loop.set_exception_handler(handler)
+
+ Set the exception handler to call when a Task raises an exception that is not
+ caught. The *handler* should accept two arguments: ``(loop, context)``.
+
+.. method:: Loop.get_exception_handler()
+
+ Get the current exception handler. Returns the handler, or ``None`` if no
+ custom handler is set.
+
+.. method:: Loop.default_exception_handler(context)
+
+ The default exception handler that is called.
+
+.. method:: Loop.call_exception_handler(context)
+
+ Call the current exception handler. The argument *context* is passed through and
+ is a dictionary containing keys: ``'message'``, ``'exception'``, ``'future'``.
diff --git a/components/language/micropython/docs/library/uctypes.rst b/components/language/micropython/docs/library/uctypes.rst
new file mode 100644
index 00000000..803ddacd
--- /dev/null
+++ b/components/language/micropython/docs/library/uctypes.rst
@@ -0,0 +1,325 @@
+:mod:`uctypes` -- access binary data in a structured way
+========================================================
+
+.. module:: uctypes
+ :synopsis: access binary data in a structured way
+
+This module implements "foreign data interface" for MicroPython. The idea
+behind it is similar to CPython's ``ctypes`` modules, but the actual API is
+different, streamlined and optimized for small size. The basic idea of the
+module is to define data structure layout with about the same power as the
+C language allows, and then access it using familiar dot-syntax to reference
+sub-fields.
+
+.. warning::
+
+ ``uctypes`` module allows access to arbitrary memory addresses of the
+ machine (including I/O and control registers). Uncareful usage of it
+ may lead to crashes, data loss, and even hardware malfunction.
+
+.. seealso::
+
+ Module :mod:`struct`
+ Standard Python way to access binary data structures (doesn't scale
+ well to large and complex structures).
+
+Usage examples::
+
+ import uctypes
+
+ # Example 1: Subset of ELF file header
+ # https://wikipedia.org/wiki/Executable_and_Linkable_Format#File_header
+ ELF_HEADER = {
+ "EI_MAG": (0x0 | uctypes.ARRAY, 4 | uctypes.UINT8),
+ "EI_DATA": 0x5 | uctypes.UINT8,
+ "e_machine": 0x12 | uctypes.UINT16,
+ }
+
+ # "f" is an ELF file opened in binary mode
+ buf = f.read(uctypes.sizeof(ELF_HEADER, uctypes.LITTLE_ENDIAN))
+ header = uctypes.struct(uctypes.addressof(buf), ELF_HEADER, uctypes.LITTLE_ENDIAN)
+ assert header.EI_MAG == b"\x7fELF"
+ assert header.EI_DATA == 1, "Oops, wrong endianness. Could retry with uctypes.BIG_ENDIAN."
+ print("machine:", hex(header.e_machine))
+
+
+ # Example 2: In-memory data structure, with pointers
+ COORD = {
+ "x": 0 | uctypes.FLOAT32,
+ "y": 4 | uctypes.FLOAT32,
+ }
+
+ STRUCT1 = {
+ "data1": 0 | uctypes.UINT8,
+ "data2": 4 | uctypes.UINT32,
+ "ptr": (8 | uctypes.PTR, COORD),
+ }
+
+ # Suppose you have address of a structure of type STRUCT1 in "addr"
+ # uctypes.NATIVE is optional (used by default)
+ struct1 = uctypes.struct(addr, STRUCT1, uctypes.NATIVE)
+ print("x:", struct1.ptr[0].x)
+
+
+ # Example 3: Access to CPU registers. Subset of STM32F4xx WWDG block
+ WWDG_LAYOUT = {
+ "WWDG_CR": (0, {
+ # BFUINT32 here means size of the WWDG_CR register
+ "WDGA": 7 << uctypes.BF_POS | 1 << uctypes.BF_LEN | uctypes.BFUINT32,
+ "T": 0 << uctypes.BF_POS | 7 << uctypes.BF_LEN | uctypes.BFUINT32,
+ }),
+ "WWDG_CFR": (4, {
+ "EWI": 9 << uctypes.BF_POS | 1 << uctypes.BF_LEN | uctypes.BFUINT32,
+ "WDGTB": 7 << uctypes.BF_POS | 2 << uctypes.BF_LEN | uctypes.BFUINT32,
+ "W": 0 << uctypes.BF_POS | 7 << uctypes.BF_LEN | uctypes.BFUINT32,
+ }),
+ }
+
+ WWDG = uctypes.struct(0x40002c00, WWDG_LAYOUT)
+
+ WWDG.WWDG_CFR.WDGTB = 0b10
+ WWDG.WWDG_CR.WDGA = 1
+ print("Current counter:", WWDG.WWDG_CR.T)
+
+Defining structure layout
+-------------------------
+
+Structure layout is defined by a "descriptor" - a Python dictionary which
+encodes field names as keys and other properties required to access them as
+associated values::
+
+ {
+ "field1": ,
+ "field2": ,
+ ...
+ }
+
+Currently, ``uctypes`` requires explicit specification of offsets for each
+field. Offset are given in bytes from the structure start.
+
+Following are encoding examples for various field types:
+
+* Scalar types::
+
+ "field_name": offset | uctypes.UINT32
+
+ in other words, the value is a scalar type identifier ORed with a field offset
+ (in bytes) from the start of the structure.
+
+* Recursive structures::
+
+ "sub": (offset, {
+ "b0": 0 | uctypes.UINT8,
+ "b1": 1 | uctypes.UINT8,
+ })
+
+ i.e. value is a 2-tuple, first element of which is an offset, and second is
+ a structure descriptor dictionary (note: offsets in recursive descriptors
+ are relative to the structure it defines). Of course, recursive structures
+ can be specified not just by a literal dictionary, but by referring to a
+ structure descriptor dictionary (defined earlier) by name.
+
+* Arrays of primitive types::
+
+ "arr": (offset | uctypes.ARRAY, size | uctypes.UINT8),
+
+ i.e. value is a 2-tuple, first element of which is ARRAY flag ORed
+ with offset, and second is scalar element type ORed number of elements
+ in the array.
+
+* Arrays of aggregate types::
+
+ "arr2": (offset | uctypes.ARRAY, size, {"b": 0 | uctypes.UINT8}),
+
+ i.e. value is a 3-tuple, first element of which is ARRAY flag ORed
+ with offset, second is a number of elements in the array, and third is
+ a descriptor of element type.
+
+* Pointer to a primitive type::
+
+ "ptr": (offset | uctypes.PTR, uctypes.UINT8),
+
+ i.e. value is a 2-tuple, first element of which is PTR flag ORed
+ with offset, and second is a scalar element type.
+
+* Pointer to an aggregate type::
+
+ "ptr2": (offset | uctypes.PTR, {"b": 0 | uctypes.UINT8}),
+
+ i.e. value is a 2-tuple, first element of which is PTR flag ORed
+ with offset, second is a descriptor of type pointed to.
+
+* Bitfields::
+
+ "bitf0": offset | uctypes.BFUINT16 | lsbit << uctypes.BF_POS | bitsize << uctypes.BF_LEN,
+
+ i.e. value is a type of scalar value containing given bitfield (typenames are
+ similar to scalar types, but prefixes with ``BF``), ORed with offset for
+ scalar value containing the bitfield, and further ORed with values for
+ bit position and bit length of the bitfield within the scalar value, shifted by
+ BF_POS and BF_LEN bits, respectively. A bitfield position is counted
+ from the least significant bit of the scalar (having position of 0), and
+ is the number of right-most bit of a field (in other words, it's a number
+ of bits a scalar needs to be shifted right to extract the bitfield).
+
+ In the example above, first a UINT16 value will be extracted at offset 0
+ (this detail may be important when accessing hardware registers, where
+ particular access size and alignment are required), and then bitfield
+ whose rightmost bit is *lsbit* bit of this UINT16, and length
+ is *bitsize* bits, will be extracted. For example, if *lsbit* is 0 and
+ *bitsize* is 8, then effectively it will access least-significant byte
+ of UINT16.
+
+ Note that bitfield operations are independent of target byte endianness,
+ in particular, example above will access least-significant byte of UINT16
+ in both little- and big-endian structures. But it depends on the least
+ significant bit being numbered 0. Some targets may use different
+ numbering in their native ABI, but ``uctypes`` always uses the normalized
+ numbering described above.
+
+Module contents
+---------------
+
+.. class:: struct(addr, descriptor, layout_type=NATIVE, /)
+
+ Instantiate a "foreign data structure" object based on structure address in
+ memory, descriptor (encoded as a dictionary), and layout type (see below).
+
+.. data:: LITTLE_ENDIAN
+
+ Layout type for a little-endian packed structure. (Packed means that every
+ field occupies exactly as many bytes as defined in the descriptor, i.e.
+ the alignment is 1).
+
+.. data:: BIG_ENDIAN
+
+ Layout type for a big-endian packed structure.
+
+.. data:: NATIVE
+
+ Layout type for a native structure - with data endianness and alignment
+ conforming to the ABI of the system on which MicroPython runs.
+
+.. function:: sizeof(struct, layout_type=NATIVE, /)
+
+ Return size of data structure in bytes. The *struct* argument can be
+ either a structure class or a specific instantiated structure object
+ (or its aggregate field).
+
+.. function:: addressof(obj)
+
+ Return address of an object. Argument should be bytes, bytearray or
+ other object supporting buffer protocol (and address of this buffer
+ is what actually returned).
+
+.. function:: bytes_at(addr, size)
+
+ Capture memory at the given address and size as bytes object. As bytes
+ object is immutable, memory is actually duplicated and copied into
+ bytes object, so if memory contents change later, created object
+ retains original value.
+
+.. function:: bytearray_at(addr, size)
+
+ Capture memory at the given address and size as bytearray object.
+ Unlike bytes_at() function above, memory is captured by reference,
+ so it can be both written too, and you will access current value
+ at the given memory address.
+
+.. data:: UINT8
+ INT8
+ UINT16
+ INT16
+ UINT32
+ INT32
+ UINT64
+ INT64
+
+ Integer types for structure descriptors. Constants for 8, 16, 32,
+ and 64 bit types are provided, both signed and unsigned.
+
+.. data:: FLOAT32
+ FLOAT64
+
+ Floating-point types for structure descriptors.
+
+.. data:: VOID
+
+ ``VOID`` is an alias for ``UINT8``, and is provided to conveniently define
+ C's void pointers: ``(uctypes.PTR, uctypes.VOID)``.
+
+.. data:: PTR
+ ARRAY
+
+ Type constants for pointers and arrays. Note that there is no explicit
+ constant for structures, it's implicit: an aggregate type without ``PTR``
+ or ``ARRAY`` flags is a structure.
+
+Structure descriptors and instantiating structure objects
+---------------------------------------------------------
+
+Given a structure descriptor dictionary and its layout type, you can
+instantiate a specific structure instance at a given memory address
+using :class:`uctypes.struct()` constructor. Memory address usually comes from
+following sources:
+
+* Predefined address, when accessing hardware registers on a baremetal
+ system. Lookup these addresses in datasheet for a particular MCU/SoC.
+* As a return value from a call to some FFI (Foreign Function Interface)
+ function.
+* From `uctypes.addressof()`, when you want to pass arguments to an FFI
+ function, or alternatively, to access some data for I/O (for example,
+ data read from a file or network socket).
+
+Structure objects
+-----------------
+
+Structure objects allow accessing individual fields using standard dot
+notation: ``my_struct.substruct1.field1``. If a field is of scalar type,
+getting it will produce a primitive value (Python integer or float)
+corresponding to the value contained in a field. A scalar field can also
+be assigned to.
+
+If a field is an array, its individual elements can be accessed with
+the standard subscript operator ``[]`` - both read and assigned to.
+
+If a field is a pointer, it can be dereferenced using ``[0]`` syntax
+(corresponding to C ``*`` operator, though ``[0]`` works in C too).
+Subscripting a pointer with other integer values but 0 are also supported,
+with the same semantics as in C.
+
+Summing up, accessing structure fields generally follows the C syntax,
+except for pointer dereference, when you need to use ``[0]`` operator
+instead of ``*``.
+
+Limitations
+-----------
+
+1. Accessing non-scalar fields leads to allocation of intermediate objects
+to represent them. This means that special care should be taken to
+layout a structure which needs to be accessed when memory allocation
+is disabled (e.g. from an interrupt). The recommendations are:
+
+* Avoid accessing nested structures. For example, instead of
+ ``mcu_registers.peripheral_a.register1``, define separate layout
+ descriptors for each peripheral, to be accessed as
+ ``peripheral_a.register1``. Or just cache a particular peripheral:
+ ``peripheral_a = mcu_registers.peripheral_a``. If a register
+ consists of multiple bitfields, you would need to cache references
+ to a particular register: ``reg_a = mcu_registers.peripheral_a.reg_a``.
+* Avoid other non-scalar data, like arrays. For example, instead of
+ ``peripheral_a.register[0]`` use ``peripheral_a.register0``. Again,
+ an alternative is to cache intermediate values, e.g.
+ ``register0 = peripheral_a.register[0]``.
+
+2. Range of offsets supported by the ``uctypes`` module is limited.
+The exact range supported is considered an implementation detail,
+and the general suggestion is to split structure definitions to
+cover from a few kilobytes to a few dozen of kilobytes maximum.
+In most cases, this is a natural situation anyway, e.g. it doesn't make
+sense to define all registers of an MCU (spread over 32-bit address
+space) in one structure, but rather a peripheral block by peripheral
+block. In some extreme cases, you may need to split a structure in
+several parts artificially (e.g. if accessing native data structure
+with multi-megabyte array in the middle, though that would be a very
+synthetic case).
diff --git a/components/language/micropython/docs/library/wipy.rst b/components/language/micropython/docs/library/wipy.rst
new file mode 100644
index 00000000..cdece7b8
--- /dev/null
+++ b/components/language/micropython/docs/library/wipy.rst
@@ -0,0 +1,17 @@
+*************************************
+:mod:`wipy` -- WiPy specific features
+*************************************
+
+.. module:: wipy
+ :synopsis: WiPy specific features
+
+The ``wipy`` module contains functions to control specific features of the
+WiPy, such as the heartbeat LED.
+
+Functions
+---------
+
+.. function:: heartbeat([enable])
+
+ Get or set the state (enabled or disabled) of the heartbeat LED. Accepts and
+ returns boolean values (``True`` or ``False``).
diff --git a/components/language/micropython/docs/library/wm8960.rst b/components/language/micropython/docs/library/wm8960.rst
new file mode 100644
index 00000000..add00363
--- /dev/null
+++ b/components/language/micropython/docs/library/wm8960.rst
@@ -0,0 +1,397 @@
+.. _wm8960:
+
+:mod:`WM8960` -- Driver for the WM8960 codec
+============================================
+
+This driver is used to control a WM8960 codec chip. It is a Python
+translation of the C-Code provided by NXP/Freescale for their i.MX RT series of
+MCUs. Very little has been added, and just a few API related names were changed
+or added to cope with the naming style of MicroPython.
+
+The primary purpose of the driver is initialization and setting operation modes
+of the codec. It does not do the audio data processing for the codec. That is
+the task of a separate driver.
+
+The WM8960 supports an I2C interface, in addition to the audio interface. The
+connection depends on the interface used and the number of devices in the
+system. For the I2C interface, SCL and SDA have to be connected, and of course
+GND and Vcc. The I2C default address is ``0x1A``.
+
+Constructor
+-----------
+
+.. class:: WM8960(i2c, sample_rate, *, bits=16, swap=SWAP_NONE, route=ROUTE_PLAYBACK_RECORD, left_input=INPUT_MIC3, right_input=INPUT_MIC2, sysclk_source=SYSCLK_MCLK, mclk_freq=None, primary=False, adc_sync=SYNC_DAC, protocol=BUS_I2S, i2c_address=WM8960_I2C_ADDR)
+
+ Create a WM8960 driver object, initialize the device with default settings and return the
+ WM8960 object.
+
+ Only the first two arguments are mandatory. All others are optional. The arguments are:
+
+ - *i2c* is the I2C bus object.
+ - *sample_rate* is the audio sample rate. Acceptable values are 8000,
+ 11025, 12000, 16000, 22050, 24000, 32000, 44100, 48000, 96000, 192000
+ and 384000. Note that not every I2S hardware will support all values.
+ - *bits* is the number of bits per audio word. Acceptable value are 16,
+ 20, 24, and 32.
+ - *swap* swaps the left & right channel, if set; see below for options.
+ - *route* Setting the audio path in the codec; see below for options.
+ - *left_input* sets the audio source for the left input channel;
+ see below for options.
+ - *right_input* sets the audio source for the right input channel;
+ see below for options.
+ - *play_source* sets the audio target for the output audio;
+ see below for options.
+ - *sysclk_source* controls whether the internal master clock called
+ "sysclk" is directly taken from the MCLK input or derived from it
+ using an internal PLL. It is usually not required to change this.
+ - *mclk_freq* sets the mclk frequency applied to the MCLK pin of the
+ codec. If not set, default values are used.
+ - *primary* lets the WM8960 act as primary or secondary device. The
+ default setting is ``False``. When set to ``False``,
+ *sample_rate* and *bits* are controlled by the MCU.
+ - *adc_sync* sets which input is used for the ADC sync signal.
+ The default is using the DACLRC pin.
+ - *protocol* sets the communication protocol. The default is I2S.
+ See below for all options.
+ - *i2c_address* sets the I2C address of the WM8960, with default ``0x1A``.
+
+ If *mclk_freq* is not set the following default values are used:
+
+ - sysclk_source == SYSCLK_PLL: 11.2896 MHz for sample rates of 44100,
+ 22050 and 11015 Hz, and 12.288 Mhz for sample rates < 48000, otherwise
+ sample_rate * 256.
+ - sysclk_source == SYSCLK_MCLK: sample_rate * 256.
+
+ If the MCLK signal is applied using, for example,. a separate oscillator,
+ it must be specified for proper operation.
+
+Tables of parameter constants
+-----------------------------
+
+.. table:: **Swap Parameter**
+ :widths: auto
+ :align: left
+
+ ===== ====
+ Value Name
+ ===== ====
+ 0 SWAP_NONE
+ 1 SWAP_INPUT
+ 2 SWAP_OUTPUT
+ ===== ====
+
+.. table:: **Protocol Parameter**
+ :widths: auto
+ :align: left
+
+ ===== ====
+ Value Name
+ ===== ====
+ 2 BUS_I2S
+ 1 BUS_LEFT_JUSTIFIED
+ 0 BUS_RIGHT_JUSTIFIED
+ 3 BUS_PCMA
+ 19 BUS_PCMB
+ ===== ====
+
+.. table:: **Input Source Parameter**
+ :widths: auto
+ :align: left
+
+ ===== ============ ====
+ Value Name Type
+ ===== ============ ====
+ 0 INPUT_CLOSED
+ 1 INPUT_MIC1 Single ended
+ 2 INPUT_MIC2 Differential
+ 3 INPUT_MIC3 Differential
+ 4 INPUT_LINE2
+ 5 INPUT_LINE3
+ ===== ============ ====
+
+.. table:: **Route Parameter**
+ :widths: auto
+ :align: left
+
+ ===== ====
+ Value Name
+ ===== ====
+ 0 ROUTE_BYPASS
+ 1 ROUTE_PLAYBACK
+ 2 ROUTE_PLAYBACK_RECORD
+ 5 ROUTE_RECORD
+ ===== ====
+
+.. table:: **Master Clock Source Parameter**
+ :widths: auto
+ :align: left
+
+ ===== ====
+ Value Name
+ ===== ====
+ 0 SYSCLK_MCLK
+ 1 SYSCLK_PLL
+ ===== ====
+
+.. table:: **Module Names**
+ :widths: auto
+ :align: left
+
+ ===== ====
+ Value Name
+ ===== ====
+ 0 MODULE_ADC
+ 1 MODULE_DAC
+ 2 MODULE_VREF
+ 3 MODULE_HEADPHONE
+ 4 MODULE_MIC_BIAS
+ 5 MODULE_MIC
+ 6 MODULE_LINE_IN
+ 7 MODULE_LINE_OUT
+ 8 MODULE_SPEAKER
+ 9 MODULE_OMIX
+ 10 MODULE_MONO_OUT
+ ===== ====
+
+.. table:: **Play Channel Names**
+ :widths: auto
+ :align: left
+
+ ===== ====
+ Value Name
+ ===== ====
+ 1 PLAY_HEADPHONE_LEFT
+ 2 PLAY_HEADPHONE_RIGHT
+ 4 PLAY_SPEAKER_LEFT
+ 8 PLAY_SPEAKER_RIGHT
+ ===== ====
+
+.. table:: **adc_sync Parameters**
+ :widths: auto
+ :align: left
+
+ ===== ====
+ Value Name
+ ===== ====
+ 0 SYNC_ADC
+ 1 SYNC_DAC
+ ===== ====
+
+
+Methods
+-------
+
+In addition to initialization, the driver provides some useful methods for
+controlling its operation:
+
+.. method:: WM8960.set_left_input(input_source)
+
+ Specify the source for the left input. The input source names are listed above.
+
+.. method:: WM8960.set_right_input(input_source)
+
+ Specify the source for the right input. The input source names are listed above.
+
+.. method:: WM8960.volume(module, volume_l=None, volume_r=None)
+
+ Sets or gets the volume of a certain module.
+
+ If no volume values are supplied, the actual volume tuple is returned.
+
+ If one or two values are supplied, it sets the volume of a certain module.
+ If two values are provided, the first one is used for the left channel,
+ the second for the right channel. If only one value is supplied, it is used
+ for both channels. The value range is normalized to 0.0-100.0 with a
+ logarithmic scale.
+
+ For a list of suitable modules and db/step, see the table below.
+
+.. table:: **Module Names and dB steps**
+ :widths: auto
+ :align: center
+
+ ======= ====
+ dB/Step Name
+ ======= ====
+ 1.28 MODULE_ADC
+ 1.28 MODULE_DAC
+ 0.8 MODULE_HEADPHONE
+ 0.475 MODULE_LINE_IN
+ 0.8 MODULE_SPEAKER
+ ======= ====
+
+.. method:: WM8960.mute(module, mute, soft=True, ramp=wm8960.MUTE_FAST)
+
+ Mute or unmute the output. If *mute* is True, the output is muted, if ``False``
+ it is unmuted.
+
+ If *soft* is set as True, muting will happen as a soft transition. The time for
+ the transition is defined by *ramp*, which is either ``MUTE_FAST`` or ``MUTE_SLOW``.
+
+.. method:: WM8960.set_data_route(route)
+
+ Set the audio data route. For the parameter value/names, see the table above.
+
+.. method:: WM8960.set_module(module, active)
+
+ Enable or disable a module, with *active* being ``False`` or ``True``. For
+ the list of module names, see the table above.
+
+ Note that enabling ``MODULE_MONO_OUT`` is different from the `WM8960.mono`
+ method. The first enables output 3, while the `WM8960.mono` method sends a
+ mono mix to the left and right output.
+
+.. method:: WM8960.enable_module(module)
+
+ Enable a module. For the list of module names, see the table above.
+
+.. method:: WM8960.disable_module(module)
+
+ Disable a module. For the list of module names, see the table above.
+
+.. method:: WM8960.expand_3d(level)
+
+ Enable Stereo 3D exansion. *level* is a number between 0 and 15.
+ A value of 0 disables the expansion.
+
+.. method:: WM8960.mono(active)
+
+ If *active* is ``True``, a Mono mix is sent to the left and right output
+ channel. This is different from enabling the ``MODULE_MONO_MIX``, which
+ enables output 3.
+
+.. method:: WM8960.alc_mode(channel, mode=ALC_MODE)
+
+ Enables or disables ALC mode. Parameters are:
+
+ - *channel* enables and sets the channel for ALC. The parameter values are:
+
+ - ALC_OFF: Switch ALC off
+ - ALS_RIGHT: Use the right input channel
+ - ALC_LEFT: Use the left input channel
+ - ALC_STEREO: Use both input channels.
+
+ - *mode* sets the ALC mode. Input values are:
+
+ - ALC_MODE: act as ALC
+ - ALC_LIMITER: act as limiter.
+
+.. method:: WM8960.alc_gain(target=-12, max_gain=30, min_gain=-17.25, noise_gate=-78)
+
+ Set the target level, highest and lowest gain levels and the noise gate as dB level.
+ Permitted ranges are:
+
+ - *target*: -22.5 to -1.5 dB
+ - *max_gain*: -12 to 30 dB
+ - *min_gain*: -17 to 25 dB
+ - *noise_gate*: -78 to -30 dB
+
+ Excess values are limited to the permitted ranges. A value of -78 or less
+ for *noise_gate* disables the noise gate function.
+
+.. method:: WM8960.alc_time(attack=24, decay=192, hold=0)
+
+ Set the dynamic characteristic of ALC. The times are given as millisecond
+ values. Permitted ranges are:
+
+ - *attack*: 6 to 6140
+ - *decay*: 24 to 24580
+ - *hold*: 0 to 43000
+
+ Excess values are limited within the permitted ranges.
+
+.. method:: WM8960.deemphasis(active)
+
+ Enables or disables a deemphasis filter for playback, with *active* being
+ ``False`` or ``True``. This filter is applied only for sample rates of
+ 32000, 44100 and 48000. For other sample rates, the filter setting
+ is silently ignored.
+
+.. method:: WM8960.deinit()
+
+ Disable all modules.
+
+
+Examples
+--------
+
+Run WM8960 in secondary mode (default)::
+
+ # Micro_python WM8960 Codec driver
+ #
+ # Setting the driver to Slave mode using the default settings
+ #
+ from machine import Pin, I2C
+ import wm8960
+ i2c = I2C(0)
+ wm=wm8960.WM8960(i2c, 32000, left_input=wm8960.INPUT_MIC1)
+ wm.set_volume(wm8960.MODULE_HEADPHONE, 100)
+
+
+Run WM8960 in primary mode::
+
+ # Micro_python WM8960 Codec driver
+ #
+ # Setting the driver to Master mode using specific audio format settings
+ #
+ from machine import Pin, I2C
+ import wm8960
+
+ i2c = I2C(0)
+ wm=wm8960.WM8960(i2c, 44100, primary=True, bits=16)
+
+
+Run WM8960 on a MIMXRT10xx_DEV board in secondary mode (default)::
+
+ # Micro_python WM8960 Codec driver
+ #
+ # Setting the driver to Slave mode using the default settings
+ # swap the input channels such that a MIMXRT Dev board mic, which
+ # is connected to the right input, is assigned to the left audio channel.
+ #
+ from machine import Pin, I2C
+ import wm8960
+ i2c = I2C(0)
+ wm=wm8960.WM8960(i2c, sample_rate=16_000,
+ adc_sync=wm8960.SYNC_DAC,
+ swap=wm8960.SWAP_INPUT,
+ sysclk_source=wm8960.SYSCLK_MCLK)
+
+
+Record with a Sparkfun WM8960 breakout board with Teensy in secondary mode (default)::
+
+ # Micro_python WM8960 Codec driver
+ #
+ # The breakout board uses a fixed 24MHz MCLK. Therefore the internal
+ # PLL must be used as sysclk, which is the master audio clock.
+ # The Sparkfun board has the WS pins for RX and TX connected on the
+ # board. Therefore adc_sync must be set to sync_adc, to configure
+ # it's ADCLRC pin as input.
+ #
+ from machine import Pin, I2C
+ import wm8960
+ i2c = I2C(0)
+ wm=wm8960.WM8960(i2c, sample_rate=16_000,
+ adc_sync=wm8960.SYNC_ADC,
+ sysclk_source=wm8960.SYSCLK_PLL,
+ mclk_freq=24_000_000,
+ left_input=wm8960.INPUT_MIC1,
+ right_input=wm8960.INPUT_CLOSED)
+
+
+Play with a Sparkfun WM8960 breakout board with Teensy in secondary mode (default)::
+
+ # The breakout board uses a fixed 24MHz MCLK. Therefore the internal
+ # PLL must be used as sysclk, which is the master audio clock.
+ # The Sparkfun board has the WS pins for RX and TX connected on the
+ # board. Therefore adc_sync must be set to sync_adc, to configure
+ # it's ADCLRC pin as input.
+
+ from machine import I2C
+ i2c=I2C(0)
+ import wm8960
+ wm=wm8960.WM8960(i2c, sample_rate=44_100,
+ adc_sync=wm8960.SYNC_ADC,
+ sysclk_source=wm8960.SYSCLK_PLL,
+ mclk_freq=24_000_000)
+ wm.set_volume(wm8960.MODULE_HEADPHONE, 100)
diff --git a/components/language/micropython/docs/library/zephyr.DiskAccess.rst b/components/language/micropython/docs/library/zephyr.DiskAccess.rst
new file mode 100644
index 00000000..d19d81a9
--- /dev/null
+++ b/components/language/micropython/docs/library/zephyr.DiskAccess.rst
@@ -0,0 +1,38 @@
+.. currentmodule:: zephyr
+.. _zephyr.DiskAccess:
+
+class DiskAccess -- access to disk storage
+==========================================
+
+Uses `Zephyr Disk Access API `_.
+
+This class allows access to storage devices on the board, such as support for SD card controllers and
+interfacing with SD cards via SPI. Disk devices are automatically detected and initialized on boot using
+Zephyr devicetree data.
+
+The Zephyr disk access class enables the transfer of data between a disk device and an accessible memory buffer given a disk name,
+buffer, starting disk block, and number of sectors to read. MicroPython reads as many blocks as necessary to fill the buffer, so
+the number of sectors to read is found by dividing the buffer length by block size of the disk.
+
+Constructors
+------------
+
+.. class:: DiskAccess(disk_name)
+
+ Gets an object for accessing disk memory of the specific disk.
+ For accessing an SD card on the mimxrt1050_evk, ``disk_name`` would be ``SDHC``. See board documentation and
+ devicetree for usable disk names for your board (ex. RT boards use style USDHC#).
+
+Methods
+-------
+
+.. method:: DiskAccess.readblocks(block_num, buf)
+ DiskAccess.readblocks(block_num, buf, offset)
+.. method:: DiskAccess.writeblocks(block_num, buf)
+ DiskAccess.writeblocks(block_num, buf, offset)
+.. method:: DiskAccess.ioctl(cmd, arg)
+
+ These methods implement the simple and extended
+ :ref:`block protocol ` defined by
+ :class:`uos.AbstractBlockDev`.
+
diff --git a/components/language/micropython/docs/library/zephyr.FlashArea.rst b/components/language/micropython/docs/library/zephyr.FlashArea.rst
new file mode 100644
index 00000000..306347d4
--- /dev/null
+++ b/components/language/micropython/docs/library/zephyr.FlashArea.rst
@@ -0,0 +1,40 @@
+.. currentmodule:: zephyr
+.. _zephyr.FlashArea:
+
+class FlashArea -- access to built-in flash storage
+===================================================
+
+Uses `Zephyr flash map API `_.
+
+This class allows access to device flash partition data.
+Flash area structs consist of a globally unique ID number, the name of the flash device the partition is in,
+the start offset (expressed in relation to the flash memory beginning address per partition),
+and the size of the partition that the device represents. For fixed flash partitions, data from the device
+tree is used; however, fixed flash partitioning is not enforced in MicroPython because MCUBoot is not enabled.
+
+Constructors
+------------
+
+.. class:: FlashArea(id, block_size)
+
+ Gets an object for accessing flash memory at partition specified by ``id`` and with block size of ``block_size``.
+
+ ``id`` values are integers correlating to fixed flash partitions defined in the devicetree.
+ A commonly used partition is the designated flash storage area defined as ``FlashArea.STORAGE`` if
+ ``FLASH_AREA_LABEL_EXISTS(storage)`` returns true at boot.
+ Zephyr devicetree fixed flash partitions are ``boot_partition``, ``slot0_partition``, ``slot1_partition``, and
+ ``scratch_partition``. Because MCUBoot is not enabled by default for MicroPython, these fixed partitions can be accessed by
+ ID integer values 1, 2, 3, and 4, respectively.
+
+Methods
+-------
+
+.. method:: FlashArea.readblocks(block_num, buf)
+ FlashArea.readblocks(block_num, buf, offset)
+.. method:: FlashArea.writeblocks(block_num, buf)
+ FlashArea.writeblocks(block_num, buf, offset)
+.. method:: FlashArea.ioctl(cmd, arg)
+
+ These methods implement the simple and extended
+ :ref:`block protocol ` defined by
+ :class:`uos.AbstractBlockDev`.
diff --git a/components/language/micropython/docs/library/zephyr.rst b/components/language/micropython/docs/library/zephyr.rst
new file mode 100644
index 00000000..da3d14a0
--- /dev/null
+++ b/components/language/micropython/docs/library/zephyr.rst
@@ -0,0 +1,60 @@
+.. currentmodule:: zephyr
+
+:mod:`zephyr` --- functionality specific to the Zephyr port
+===========================================================
+
+.. module:: zephyr
+ :synopsis: functionality specific to Zephyr
+
+The ``zephyr`` module contains functions and classes specific to the Zephyr port.
+
+Functions
+---------
+
+.. function:: is_preempt_thread()
+
+ Returns true if the current thread is a preemptible thread.
+
+ Zephyr preemptible threads are those with non-negative priority values (low priority levels), which therefore,
+ can be supplanted as soon as a higher or equal priority thread becomes ready.
+
+.. function:: current_tid()
+
+ Returns the thread id of the current thread, which is used to reference the thread.
+
+.. function:: thread_analyze()
+
+ Runs the Zephyr debug thread analyzer on the current thread and prints stack size statistics in the format:
+
+ "``thread_name``-20s: STACK: unused ``available_stack_space`` usage ``stack_space_used``
+ / ``stack_size`` (``percent_stack_space_used`` %); CPU: ``cpu_utilization`` %"
+
+ * *CPU utilization is only printed if runtime statistics are configured via the ``CONFIG_THREAD_RUNTIME_STATS`` kconfig*
+
+ This function can only be accessed if ``CONFIG_THREAD_ANALYZER`` is configured for the port in ``zephyr/prj.conf``.
+ For more infomation, see documentation for Zephyr `thread analyzer
+ `_.
+
+.. function:: shell_exec(cmd_in)
+
+ Executes the given command on an UART backend. This function can only be accessed if ``CONFIG_SHELL_BACKEND_SERIAL``
+ is configured for the port in ``zephyr/prj.conf``.
+
+ A list of possible commands can be found in the documentation for Zephyr `shell commands `_.
+
+Classes
+-------
+
+.. toctree::
+ :maxdepth: 1
+
+ zephyr.DiskAccess.rst
+ zephyr.FlashArea.rst
+
+Additional Modules
+------------------
+
+.. toctree::
+ :maxdepth: 1
+
+ zephyr.zsensor.rst
diff --git a/components/language/micropython/docs/library/zephyr.zsensor.rst b/components/language/micropython/docs/library/zephyr.zsensor.rst
new file mode 100644
index 00000000..4eadc926
--- /dev/null
+++ b/components/language/micropython/docs/library/zephyr.zsensor.rst
@@ -0,0 +1,123 @@
+.. currentmodule:: zsensor
+
+:mod:`zsensor` --- Zephyr sensor bindings
+=========================================
+
+.. module:: zsensor
+ :synopsis: zephyr sensor bindings
+
+The ``zsensor`` module contains a class for using sensors with Zephyr.
+
+.. _zsensor.Sensor:
+
+class Sensor --- sensor control for the Zephyr port
+---------------------------------------------------
+
+Use this class to access data from sensors on your board.
+See Zephyr documentation for sensor usage here: `Sensors
+`_.
+
+Sensors are defined in the Zephyr devicetree for each board. The quantities that a given sensor can
+measure are called a sensor channels. Sensors can have multiple channels to represent different axes
+of one property or different properties a sensor can measure. See `Channels`_ below for defined sensor
+channels.
+
+Constructor
+~~~~~~~~~~~
+
+.. class:: Sensor(device_name)
+
+ Device names are defined in the devicetree for your board.
+ For example, the device name for the accelerometer in the FRDM-k64f board is "FXOS8700".
+
+Methods
+~~~~~~~
+
+.. method:: Sensor.measure()
+
+ Obtains a measurement sample from the sensor device using Zephyr sensor_sample_fetch and
+ stores it in an internal driver buffer as a useful value, a pair of (integer part of value,
+ fractional part of value in 1-millionths).
+ Returns none if successful or OSError value if failure.
+
+.. method:: Sensor.get_float(sensor_channel)
+
+ Returns the value of the sensor measurement sample as a float.
+
+.. method:: Sensor.get_micros(sensor_channel)
+
+ Returns the value of the sensor measurement sample in millionths.
+ (Ex. value of ``(1, 500000)`` returns as ``1500000``)
+
+.. method:: Sensor.get_millis(sensor_channel)
+
+ Returns the value of sensor measurement sample in thousandths.
+ (Ex. value of ``(1, 500000)`` returns as ``1500``)
+
+.. method:: Sensor.get_int(sensor_channel)
+
+ Returns only the integer value of the measurement sample.
+ (Ex. value of ``(1, 500000)`` returns as ``1``)
+
+Channels
+~~~~~~~~
+
+.. data:: ACCEL_X
+
+ Acceleration on the X axis, in m/s^2.
+
+.. data:: ACCEL_Y
+
+ Acceleration on the Y axis, in m/s^2.
+
+.. data:: ACCEL_Z
+
+ Acceleration on the Z axis, in m/s^2.
+
+.. data:: GYRO_X
+
+ Angular velocity around the X axis, in radians/s.
+
+.. data:: GYRO_Y
+
+ Angular velocity around the Y axis, in radians/s.
+
+.. data:: GYRO_Z
+
+ Angular velocity around the Z axis, in radians/s.
+
+.. data:: MAGN_X
+
+ Magnetic field on the X axis, in Gauss.
+
+.. data:: MAGN_Y
+
+ Magnetic field on the Y axis, in Gauss.
+
+.. data:: MAGN_Z
+
+ Magnetic field on the Z axis, in Gauss.
+
+.. data:: DIE_TEMP
+
+ Device die temperature in degrees Celsius.
+
+.. data:: PRESS
+
+ Pressure in kilopascal.
+
+.. data:: PROX
+
+ Proximity. Dimensionless. A value of 1 indicates that an object is close.
+
+.. data:: HUMIDITY
+
+ Humidity, in percent.
+
+.. data:: LIGHT
+
+ Illuminance in visible spectrum, in lux.
+
+.. data:: ALTITUDE
+
+ Altitude, in meters.
diff --git a/components/language/micropython/docs/library/zlib.rst b/components/language/micropython/docs/library/zlib.rst
new file mode 100644
index 00000000..96d6c245
--- /dev/null
+++ b/components/language/micropython/docs/library/zlib.rst
@@ -0,0 +1,38 @@
+:mod:`zlib` -- zlib decompression
+=================================
+
+.. module:: zlib
+ :synopsis: zlib decompression
+
+|see_cpython_module| :mod:`python:zlib`.
+
+This module allows to decompress binary data compressed with
+`DEFLATE algorithm `_
+(commonly used in zlib library and gzip archiver). Compression
+is not yet implemented.
+
+Functions
+---------
+
+.. function:: decompress(data, wbits=0, bufsize=0, /)
+
+ Return decompressed *data* as bytes. *wbits* is DEFLATE dictionary window
+ size used during compression (8-15, the dictionary size is power of 2 of
+ that value). Additionally, if value is positive, *data* is assumed to be
+ zlib stream (with zlib header). Otherwise, if it's negative, it's assumed
+ to be raw DEFLATE stream. *bufsize* parameter is for compatibility with
+ CPython and is ignored.
+
+.. class:: DecompIO(stream, wbits=0, /)
+
+ Create a `stream` wrapper which allows transparent decompression of
+ compressed data in another *stream*. This allows to process compressed
+ streams with data larger than available heap size. In addition to
+ values described in :func:`decompress`, *wbits* may take values
+ 24..31 (16 + 8..15), meaning that input stream has gzip header.
+
+ .. admonition:: Difference to CPython
+ :class: attention
+
+ This class is MicroPython extension. It's included on provisional
+ basis and may be changed considerably or removed in later versions.
diff --git a/components/language/micropython/docs/license.rst b/components/language/micropython/docs/license.rst
new file mode 100644
index 00000000..73caa903
--- /dev/null
+++ b/components/language/micropython/docs/license.rst
@@ -0,0 +1,24 @@
+MicroPython license information
+===============================
+
+The MIT License (MIT)
+
+Copyright (c) 2013-2017 Damien P. George, and others
+
+Permission is hereby granted, free of charge, to any person obtaining a copy
+of this software and associated documentation files (the "Software"), to deal
+in the Software without restriction, including without limitation the rights
+to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+copies of the Software, and to permit persons to whom the Software is
+furnished to do so, subject to the following conditions:
+
+The above copyright notice and this permission notice shall be included in
+all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+THE SOFTWARE.
diff --git a/components/language/micropython/docs/make.bat b/components/language/micropython/docs/make.bat
new file mode 100644
index 00000000..2a9e670e
--- /dev/null
+++ b/components/language/micropython/docs/make.bat
@@ -0,0 +1,243 @@
+@ECHO OFF
+
+REM Command file for Sphinx documentation
+
+if "%SPHINXBUILD%" == "" (
+ set SPHINXBUILD=sphinx-build
+)
+set BUILDDIR=build
+set SPHINXOPTS=-W --keep-going
+set ALLSPHINXOPTS=-d %BUILDDIR%/doctrees %SPHINXOPTS% .
+set I18NSPHINXOPTS=%SPHINXOPTS% .
+if NOT "%PAPER%" == "" (
+ set ALLSPHINXOPTS=-D latex_paper_size=%PAPER% %ALLSPHINXOPTS%
+ set I18NSPHINXOPTS=-D latex_paper_size=%PAPER% %I18NSPHINXOPTS%
+)
+
+if "%1" == "" goto help
+
+if "%1" == "help" (
+ :help
+ echo.Please use `make ^` where ^ is one of
+ echo. html to make standalone HTML files
+ echo. dirhtml to make HTML files named index.html in directories
+ echo. singlehtml to make a single large HTML file
+ echo. pickle to make pickle files
+ echo. json to make JSON files
+ echo. htmlhelp to make HTML files and a HTML help project
+ echo. qthelp to make HTML files and a qthelp project
+ echo. devhelp to make HTML files and a Devhelp project
+ echo. epub to make an epub
+ echo. latex to make LaTeX files, you can set PAPER=a4 or PAPER=letter
+ echo. text to make text files
+ echo. man to make manual pages
+ echo. texinfo to make Texinfo files
+ echo. gettext to make PO message catalogs
+ echo. changes to make an overview over all changed/added/deprecated items
+ echo. xml to make Docutils-native XML files
+ echo. pseudoxml to make pseudoxml-XML files for display purposes
+ echo. linkcheck to check all external links for integrity
+ echo. doctest to run all doctests embedded in the documentation if enabled
+ goto end
+)
+
+if "%1" == "clean" (
+ for /d %%i in (%BUILDDIR%\*) do rmdir /q /s %%i
+ del /q /s %BUILDDIR%\*
+ goto end
+)
+
+
+%SPHINXBUILD% 2> nul
+if errorlevel 9009 (
+ echo.
+ echo.The 'sphinx-build' command was not found. Make sure you have Sphinx
+ echo.installed, then set the SPHINXBUILD environment variable to point
+ echo.to the full path of the 'sphinx-build' executable. Alternatively you
+ echo.may add the Sphinx directory to PATH.
+ echo.
+ echo.If you don't have Sphinx installed, grab it from
+ echo.http://sphinx-doc.org/
+ exit /b 1
+)
+
+if "%1" == "html" (
+ %SPHINXBUILD% -b html %ALLSPHINXOPTS% %BUILDDIR%/html
+ if errorlevel 1 exit /b 1
+ echo.
+ echo.Build finished. The HTML pages are in %BUILDDIR%/html.
+ goto end
+)
+
+if "%1" == "dirhtml" (
+ %SPHINXBUILD% -b dirhtml %ALLSPHINXOPTS% %BUILDDIR%/dirhtml
+ if errorlevel 1 exit /b 1
+ echo.
+ echo.Build finished. The HTML pages are in %BUILDDIR%/dirhtml.
+ goto end
+)
+
+if "%1" == "singlehtml" (
+ %SPHINXBUILD% -b singlehtml %ALLSPHINXOPTS% %BUILDDIR%/singlehtml
+ if errorlevel 1 exit /b 1
+ echo.
+ echo.Build finished. The HTML pages are in %BUILDDIR%/singlehtml.
+ goto end
+)
+
+if "%1" == "pickle" (
+ %SPHINXBUILD% -b pickle %ALLSPHINXOPTS% %BUILDDIR%/pickle
+ if errorlevel 1 exit /b 1
+ echo.
+ echo.Build finished; now you can process the pickle files.
+ goto end
+)
+
+if "%1" == "json" (
+ %SPHINXBUILD% -b json %ALLSPHINXOPTS% %BUILDDIR%/json
+ if errorlevel 1 exit /b 1
+ echo.
+ echo.Build finished; now you can process the JSON files.
+ goto end
+)
+
+if "%1" == "htmlhelp" (
+ %SPHINXBUILD% -b htmlhelp %ALLSPHINXOPTS% %BUILDDIR%/htmlhelp
+ if errorlevel 1 exit /b 1
+ echo.
+ echo.Build finished; now you can run HTML Help Workshop with the ^
+.hhp project file in %BUILDDIR%/htmlhelp.
+ goto end
+)
+
+if "%1" == "qthelp" (
+ %SPHINXBUILD% -b qthelp %ALLSPHINXOPTS% %BUILDDIR%/qthelp
+ if errorlevel 1 exit /b 1
+ echo.
+ echo.Build finished; now you can run "qcollectiongenerator" with the ^
+.qhcp project file in %BUILDDIR%/qthelp, like this:
+ echo.^> qcollectiongenerator %BUILDDIR%\qthelp\MicroPython.qhcp
+ echo.To view the help file:
+ echo.^> assistant -collectionFile %BUILDDIR%\qthelp\MicroPython.ghc
+ goto end
+)
+
+if "%1" == "devhelp" (
+ %SPHINXBUILD% -b devhelp %ALLSPHINXOPTS% %BUILDDIR%/devhelp
+ if errorlevel 1 exit /b 1
+ echo.
+ echo.Build finished.
+ goto end
+)
+
+if "%1" == "epub" (
+ %SPHINXBUILD% -b epub %ALLSPHINXOPTS% %BUILDDIR%/epub
+ if errorlevel 1 exit /b 1
+ echo.
+ echo.Build finished. The epub file is in %BUILDDIR%/epub.
+ goto end
+)
+
+if "%1" == "latex" (
+ %SPHINXBUILD% -b latex %ALLSPHINXOPTS% %BUILDDIR%/latex
+ if errorlevel 1 exit /b 1
+ echo.
+ echo.Build finished; the LaTeX files are in %BUILDDIR%/latex.
+ goto end
+)
+
+if "%1" == "latexpdf" (
+ %SPHINXBUILD% -b latex %ALLSPHINXOPTS% %BUILDDIR%/latex
+ cd %BUILDDIR%/latex
+ make all-pdf
+ cd %BUILDDIR%/..
+ echo.
+ echo.Build finished; the PDF files are in %BUILDDIR%/latex.
+ goto end
+)
+
+if "%1" == "latexpdfja" (
+ %SPHINXBUILD% -b latex %ALLSPHINXOPTS% %BUILDDIR%/latex
+ cd %BUILDDIR%/latex
+ make all-pdf-ja
+ cd %BUILDDIR%/..
+ echo.
+ echo.Build finished; the PDF files are in %BUILDDIR%/latex.
+ goto end
+)
+
+if "%1" == "text" (
+ %SPHINXBUILD% -b text %ALLSPHINXOPTS% %BUILDDIR%/text
+ if errorlevel 1 exit /b 1
+ echo.
+ echo.Build finished. The text files are in %BUILDDIR%/text.
+ goto end
+)
+
+if "%1" == "man" (
+ %SPHINXBUILD% -b man %ALLSPHINXOPTS% %BUILDDIR%/man
+ if errorlevel 1 exit /b 1
+ echo.
+ echo.Build finished. The manual pages are in %BUILDDIR%/man.
+ goto end
+)
+
+if "%1" == "texinfo" (
+ %SPHINXBUILD% -b texinfo %ALLSPHINXOPTS% %BUILDDIR%/texinfo
+ if errorlevel 1 exit /b 1
+ echo.
+ echo.Build finished. The Texinfo files are in %BUILDDIR%/texinfo.
+ goto end
+)
+
+if "%1" == "gettext" (
+ %SPHINXBUILD% -b gettext %I18NSPHINXOPTS% %BUILDDIR%/locale
+ if errorlevel 1 exit /b 1
+ echo.
+ echo.Build finished. The message catalogs are in %BUILDDIR%/locale.
+ goto end
+)
+
+if "%1" == "changes" (
+ %SPHINXBUILD% -b changes %ALLSPHINXOPTS% %BUILDDIR%/changes
+ if errorlevel 1 exit /b 1
+ echo.
+ echo.The overview file is in %BUILDDIR%/changes.
+ goto end
+)
+
+if "%1" == "linkcheck" (
+ %SPHINXBUILD% -b linkcheck %ALLSPHINXOPTS% %BUILDDIR%/linkcheck
+ if errorlevel 1 exit /b 1
+ echo.
+ echo.Link check complete; look for any errors in the above output ^
+or in %BUILDDIR%/linkcheck/output.txt.
+ goto end
+)
+
+if "%1" == "doctest" (
+ %SPHINXBUILD% -b doctest %ALLSPHINXOPTS% %BUILDDIR%/doctest
+ if errorlevel 1 exit /b 1
+ echo.
+ echo.Testing of doctests in the sources finished, look at the ^
+results in %BUILDDIR%/doctest/output.txt.
+ goto end
+)
+
+if "%1" == "xml" (
+ %SPHINXBUILD% -b xml %ALLSPHINXOPTS% %BUILDDIR%/xml
+ if errorlevel 1 exit /b 1
+ echo.
+ echo.Build finished. The XML files are in %BUILDDIR%/xml.
+ goto end
+)
+
+if "%1" == "pseudoxml" (
+ %SPHINXBUILD% -b pseudoxml %ALLSPHINXOPTS% %BUILDDIR%/pseudoxml
+ if errorlevel 1 exit /b 1
+ echo.
+ echo.Build finished. The pseudo-XML files are in %BUILDDIR%/pseudoxml.
+ goto end
+)
+
+:end
diff --git a/components/language/micropython/docs/mimxrt/general.rst b/components/language/micropython/docs/mimxrt/general.rst
new file mode 100644
index 00000000..35cf8e50
--- /dev/null
+++ b/components/language/micropython/docs/mimxrt/general.rst
@@ -0,0 +1,94 @@
+.. _mimxrt_general:
+
+General information about the MIMXRT port
+=========================================
+
+The i.MXRT MCU family is a high performance family of devices made by NXP.
+Based on an ARM7 core, they provide many on-chip I/O units for building
+small to medium sized devices.
+
+Multitude of boards
+-------------------
+
+There is a multitude of modules and boards from different sources which carry
+an i.MXRT chip. MicroPython aims to provide a generic port which runs on
+as many boards/modules as possible, but there may be limitations. The
+NXP IMXRT1020-EVK and the Teensy 4.0 and Teensy 4.1 development boards are taken
+as reference for the port (for example, testing is performed on them).
+For any board you are using please make sure you have a data sheet, schematics
+and other reference materials so you can look up any board-specific functions.
+
+The following boards are supported by the port:
+
+- MIMXRT1010-EVK
+- MIMXRT1020-EVK
+- MIMXRT1050-EVK
+- MIMXRT1060-EVK
+- MIMXRT1064-EVK
+- Teensy 4.0
+- Teensy 4.1
+
+Supported MCUs
+--------------
+
++-------------+--------------------+-------------------------+
+| Product | CPU | Memory |
++=============+====================+=========================+
+| i.MX RT1064 | Cortex-M7 @600 MHz | 1 MB SRAM, 4 MB Flash |
++-------------+--------------------+-------------------------+
+| i.MX RT1061 | Cortex-M7 @600 MHz | 1 MB SRAM |
++-------------+--------------------+-------------------------+
+| i.MX RT1062 | Cortex-M7 @600 MHz | 1 MB SRAM |
++-------------+--------------------+-------------------------+
+| i.MX RT1050 | Cortex-M7 @600 MHz | 512 kB SRAM |
++-------------+--------------------+-------------------------+
+| i.MX RT1020 | Cortex-M7 @500 MHz | 256 kB SRAM |
++-------------+--------------------+-------------------------+
+| i.MX RT1015 | Cortex-M7 @500 MHz | 128 kB SRAM |
++-------------+--------------------+-------------------------+
+| i.MX RT1010 | Cortex-M7 @500 MHz | 128 kB SRAM |
++-------------+--------------------+-------------------------+
+
+Note: Most of the controllers do not have internal flash memory. Therefore
+their flash capacity is dependent on an external flash chip.
+
+To make a generic MIMXRT port and support as many boards as possible the
+following design and implementation decision were made:
+
+* GPIO pin numbering is based on the board numbering as well as on the
+ MCU numbering. Please have the manual/pin diagram of your board at hand
+ to find correspondence between your board pins and actual i.MXRT pins.
+* All MCU pins are supported by MicroPython but not all are usable on any given board.
+
+Technical specifications and SoC datasheets
+-------------------------------------------
+
+The data sheets and other reference material for i.MXRT chip are available
+from the vendor site: https://www.nxp.com/products/processors-and-microcontrollers/arm-microcontrollers/i-mx-rt-crossover-mcus:IMX-RT-SERIES .
+They are the primary reference for the chip technical specifications, capabilities,
+operating modes, internal functioning, etc.
+
+For your convenience, a few technical specifications are provided below:
+
+* Architecture: ARM Cortex M7
+* CPU frequency: up to 600MHz
+* Total RAM available: up to 1 MByte (see table)
+* BootROM: 96KB
+* External FlashROM: code and data, via SPI Flash; usual size 2 - 16 MB
+ Some boards provide additional external RAM and SPI flash.
+* GPIO: up to 124 (GPIOs are multiplexed with other functions, including
+ external FlashROM, UART, etc.)
+* UART: 4 or 8 RX/TX UART. Hardware handshaking is supported by the MCU,
+ but the boards used for testing do not expose the signals.
+* SPI: 2 or 4 low power SPI interfaces (software implementation available on every pin)
+* I2C: 2 or 4 low power I2C interfaces (software implementation available on every pin)
+* I2S: 1 to 3 I2S interfaces
+* ADC: one or two 12-bit SAR ADC converters
+* Ethernet controller (except i.MX RT1010/-1015)
+* Programming: using BootROM bootloader from USB - due to external FlashROM
+ and always-available BootROM bootloader, the MIMXRT is not brickable
+
+The lower numbers for UART, SPI and I2C apply to the i.MXRT 101x MCU.
+
+For more information see the i.MXRT data sheets or reference manuals.
+NXP provides software support through it's SDK packages.
diff --git a/components/language/micropython/docs/mimxrt/img/teensy_4.1.jpg b/components/language/micropython/docs/mimxrt/img/teensy_4.1.jpg
new file mode 100644
index 00000000..0a09f68e
Binary files /dev/null and b/components/language/micropython/docs/mimxrt/img/teensy_4.1.jpg differ
diff --git a/components/language/micropython/docs/mimxrt/pinout.rst b/components/language/micropython/docs/mimxrt/pinout.rst
new file mode 100644
index 00000000..b82c153f
--- /dev/null
+++ b/components/language/micropython/docs/mimxrt/pinout.rst
@@ -0,0 +1,380 @@
+.. _mimxrt_pinout:
+
+Pinout for the i.MXRT machine modules
+=====================================
+
+.. _mimxrt_uart_pinout:
+
+|
+
+UART pin assignment
+-------------------
+
+The pin assignment of UARTs to pins is fixed.
+The UARTs are numbered 0..8. The rx/tx pins are assigned according to the
+tables below:
+
+================ =========== =========== =========== ===========
+Board / Pin UART0 UART1 UART2 UART3
+================ =========== =========== =========== ===========
+Teensy 4.0 - 0/1 7/8 14/15
+Teensy 4.1 - 0/1 7/8 14/15
+MIMXRT1010-EVK Debug USB D0/D1 D7/D6 -
+MIMXRT1015-EVK Debug USB D0/D1 D7/A1 -
+MIMXRT1020-EVK Debug USB D0/D1 D9/D6 D10/D13
+MIMXRT1050-EVK Debug USB D0/D1 D7/D6 D8/D9
+MIMXRT1050-EVKB Debug USB D0/D1 D7/D6 D8/D9
+MIMXRT1060-EVK Debug USB D0/D1 D7/D6 D8/D9
+MIMXRT1064-EVK Debug USB D0/D1 D7/D6 D8/D9
+MIMXRT1170-EVK Debug USB D0/D1 D12/D11 D10/D13
+Olimex RT1010Py - RxD/TxD D5/D6 -
+Seeed ARCH MIX - J3_19/J3_20 J4_16/J4_17 J4_06/J4_07
+================ =========== =========== =========== ===========
+
+|
+
+================ =========== =========== ======= ======= =====
+Board / Pin UART4 UART5 UART6 UART7 UART8
+================ =========== =========== ======= ======= =====
+Teensy 4.0 16/17 21/20 25/24 28/29 -
+Teensy 4.1 16/17 21/20 25/24 28/29 34/35
+MIMXRT1010-EVK - - - - -
+MIMXRT1015-EVK - - - - -
+MIMXRT1020-EVK D15/D14 A1/A0 - - -
+MIMXRT1050-EVK A1/A0 - - - -
+MIMXRT1050-EVKB A1/A0 - - - -
+MIMXRT1060-EVK A1/A0 - - - -
+MIMXRT1064-EVK A1/A0 - - - -
+MIMXRT1170-EVK D15/D14 D25/D26 D33/D34 D35/D36 -
+Olimex RT1010Py - - - - -
+Seeed ARCH MIX J4_10/J4_11 J5_08/J5_12 - - -
+================ =========== =========== ======= ======= =====
+
+.. _mimxrt_pwm_pinout:
+
+|
+|
+
+PWM pin assignment
+------------------
+
+Pins are specified in the same way as for the Pin class. The following tables show
+the assignment of the board Pins to PWM modules:
+
+=========== ========== ========== ====== ============== ======
+Pin/ MIMXRT 1010 1015 1020 1050/1060/1064 1170
+=========== ========== ========== ====== ============== ======
+D0 - Q1/1 F1/1/B - -
+D1 - Q1/0 F1/1/A - -
+D2 F1/3/B F1/3/A - F1/3/B -
+D3 F1/3/A F1/0/A F2/3/B F4/0/A F1/2/A
+D4 F1/3/A (*) Q1/2 Q2/1 F2/3/A Q4/2
+D5 F1/0/B (*) F1/0/B F2/3/A F1/3/A F1/2/B
+D6 - F1/2/B F2/0/A Q3/2 F1/0/A
+D7 - - F1/0/A Q3/3 -
+D8 F1/0/A F1/1/B F1/0/B F1/1/X Q4/3
+D9 F1/1/B (*) F1/2/A F2/0/B F1/0/X F1/0/B
+D10 F1/3/B - F2/2/B F1/0/B (*) F2/2/B
+D11 F1/2/A - F2/1/A F1/1/A (*) -
+D12 F1/2/B - F2/1/B F1/1/B (*) -
+D13 F1/3/A - F2/2/A F1/0/A (*) F2/2/A
+D14 F1/0/B - - F2/3/B -
+D15 F1/0/A - - F2/3/A -
+A0 - - F1/2/A - -
+A1 F1/3/X F1/3/B F1/2/B - -
+A2 F1/2/X F1/3/A F1/3/A - -
+A3 - F1/2/A F1/3/B - -
+A4 - - - Q3/1 -
+A5 - - - Q3/0 -
+D31 - - - - F1/2/B
+D32 - - - - F1/2/A
+D33 - - - - F1/1/B
+D34 - - - - F1/1/A
+D35 - - - - F1/0/B
+D36 - - - - F1/0/A
+=========== ========== ========== ====== ============== ======
+
+Pins denoted with (*) are by default not wired at the board.
+
+==== ========== ==== ==========
+Pin Teensy 4.0 Pin Teensy 4.1
+==== ========== ==== ==========
+0 F1/1/X 0 F1/1/X
+1 F1/0/X 1 F1/0/X
+2 F4/2/A 2 F4/2/A
+3 F4/2/B 3 F4/2/B
+4 F2/0/A 4 F2/0/A
+5 F2/1/A 5 F2/1/A
+6 F2/2/A 6 F2/2/A
+7 F1/3/B 7 F1/3/B
+8 F1/3/A 8 F1/3/A
+9 F2/2/B 9 F2/2/B
+10 Q1/0 10 Q1/0
+11 Q1/2 11 Q1/2
+12 Q1/1 12 Q1/1
+13 Q2/0 13 Q2/0
+14 Q3/2 14 Q3/2
+15 Q3/3 15 Q3/3
+18 Q3/1 18 Q3/1
+19 Q3/0 19 Q3/0
+22 F4/0/A 22 F4/0/A
+23 F4/1/A 23 F4/1/A
+24 F1/2/X 24 F1/2/X
+25 F1/3/X 25 F1/3/X
+28 F3/1/B 28 F3/1/B
+29 F3/1/A 29 F3/1/A
+33 F2/0/B 33 F2/0/B
+- - 36 F2/3/A
+- - 37 F2/3/B
+DAT1 F1/1/B 42 F1/1/B
+DAT0 F1/1/A 43 F1/1/A
+CLK F1/0/B 44 F1/0/B
+CMD F1/0/A 45 F1/0/A
+DAT2 F1/2/A 46 F1/2/A
+DAT3 F1/2/B 47 F1/2/B
+- - 48 F1/0/B
+- - 49 F1/2/A
+- - 50 F1/2/B
+- - 51 F3/3/B
+- - 52 F1/1/B
+- - 53 F1/1/A
+- - 54 F3/0/A
+==== ========== ==== ==========
+
+|
+
+========= ==============
+Pin Seeed ARCH MIX
+========= ==============
+J3_04 Q4/3
+J3_10 Q1/3
+J3_12 Q2/3
+J3_13 Q3/3
+J3_16 Q3/0
+J3_17 Q3/1
+J3_19 F1/3/X
+J3_20 F1/2/X
+J4_08 F4/0/A
+J4_09 F4/1/A
+J4_16 Q3/2
+J4_17 Q3/3
+J5_32 Q1/0
+J5_28 Q1/1
+J5_29 Q1/2
+J5_30 Q2/0
+J5_04 Q2/1
+J5_05 Q2/3
+J5_06 F2/0/A
+J5_07 F2/0/B
+J5_08 F2/1/A
+J5_12 F2/1/B
+J5_13 F2/2/A
+J5_14 F2/2/B
+J5_23 F1/3/A
+J5_24 F1/3/B
+J5_25 F2/3/A
+J5_26 F2/3/B
+J5_42 Q3/0
+J5_43 Q3/1
+J5_50 F1/0/X
+LED_RED F2/3/A
+LED_GREEN F1/3/A
+LED_BLUE F1/3/B
+========= ==============
+
+|
+
+========= ===============
+Pin Olimex RT1010PY
+========= ===============
+D0 -
+D1 F1/0/B
+D2 F1/0/A
+D3 F1/1/B
+D4 F1/1/A
+D5 F1/2/B
+D6 F1/2/A
+D7 F1/3/B
+D8 F1/3/A
+D9 -
+D10 F1/0/B
+D11 F1/0/A
+D12 F1/1/B
+D13 F1/1/A
+D14 -
+A0 -
+A1 F1/2/B
+A2 F1/2/A
+A3 F1/3/B
+A4 F1/3/A
+SDI F1/3/X
+SDO F1/2/X
+CS0 F1/1/X
+SCK F1/0/X
+========= ===============
+
+Legend:
+
+* Qm/n: QTMR module m, channel n
+* Fm/n/l: FLEXPWM module m, submodule n, channel l. The pulse at a X channel
+ is always aligned to the period start.
+
+Pins without a PWM signal are not listed. A signal may be available at more
+than one Pin. FlexPWM pins may also be pure CPU pin, not assigned to a board
+signal. In that case the PWM output is disabled. The PWM channel of a submodule
+0 may still be used as synchronization source for other channels of the same
+module, unless used by another peripheral.
+
+Submodule 0 pins for i.MX RT1011:
+
+================== =======
+Pin Channel
+================== =======
+Pin.cpu.GPIO_01 B
+Pin.cpu.GPIO_02 A
+Pin.cpu.GPIO_AD_12 X
+Pin.cpu.GPIO_SD_01 B
+Pin.cpu.GPIO_SD_02 A
+================== =======
+
+Submodule 0 pins for i.MX RT1021:
+
+===================== ==================
+Pin Module & Channel
+===================== ==================
+Pin.cpu.GPIO_AD_B1_06 FLEXPWM1 Channel A
+Pin.cpu.GPIO_AD_B1_07 FLEXPWM1 Channel B
+Pin.cpu.GPIO_EMC_26 FLEXPWM1 Channel A
+Pin.cpu.GPIO_EMC_27 FLEXPWM1 Channel B
+Pin.cpu.GPIO_AD_B0_14 FLEXPWM2 Channel A
+Pin.cpu.GPIO_AD_B0_15 FLEXPWM2 Channel B
+Pin.cpu.GPIO_EMC_10 FLEXPWM2 Channel X
+Pin.cpu.GPIO_EMC_38 FLEXPWM2 Channel A
+Pin.cpu.GPIO_EMC_39 FLEXPWM2 Channel B
+===================== ==================
+
+Submodule 0 pins for i.MX RT1052, i.MX RT1062 and i.MX RT1064:
+
+===================== ==================
+Pin Module & Channel
+===================== ==================
+Pin.cpu.GPIO_AD_B0_02 FLEXPWM1 Channel X
+Pin.cpu.GPIO_EMC_23 FLEXPWM1 Channel A
+Pin.cpu.GPIO_EMC_24 FLEXPWM1 Channel B
+Pin.cpu.GPIO_SD_B0_00 FLEXPWM1 Channel A
+Pin.cpu.GPIO_SD_B0_01 FLEXPWM1 Channel B
+Pin.cpu.GPIO_B0_06 FLEXPWM2 Channel A
+Pin.cpu.GPIO_B0_07 FLEXPWM2 Channel B
+Pin.cpu.GPIO_EMC_06 FLEXPWM2 Channel A
+Pin.cpu.GPIO_EMC_07 FLEXPWM2 Channel B
+Pin.cpu.GPIO_EMC_29 FLEXPWM3 Channel A
+Pin.cpu.GPIO_EMC_30 FLEXPWM3 Channel B
+Pin.cpu.GPIO_AD_B1_08 FLEXPWM4 Channel A
+Pin.cpu.GPIO_EMC_00 FLEXPWM4 Channel A
+Pin.cpu.GPIO_EMC_01 FLEXPWM4 Channel B
+===================== ==================
+
+Submodule 0 pins for i.MX RT1176
+
+====================== ======================
+Pin Module & Channel
+====================== ======================
+Pin.cpu.GPIO_EMC_B1_00 FLEXPWM4 Channel A (*)
+Pin.cpu.GPIO_EMC_B1_01 FLEXPWM4 Channel B (*)
+Pin.cpu.GPIO_EMC_B1_06 FLEXPWM2 Channel A (*)
+Pin.cpu.GPIO_EMC_B1_07 FLEXPWM2 Channel B (*)
+Pin.cpu.GPIO_EMC_B1_23 FLEXPWM1 Channel A (*)
+Pin.cpu.GPIO_EMC_B1_24 FLEXPWM1 Channel B (*)
+Pin.cpu.GPIO_EMC_B1_29 FLEXPWM3 Channel A (*)
+Pin.cpu.GPIO_EMC_B1_30 FLEXPWM3 Channel B (*)
+Pin.cpu.GPIO_AD_00 FLEXPWM1 Channel A
+Pin.cpu.GPIO_AD_01 FLEXPWM1 Channel B
+Pin.cpu.GPIO_AD_24 FLEXPWM2 Channel A
+Pin.cpu.GPIO_AD_25 FLEXPWM2 Channel B
+====================== ======================
+
+.. _mimxrt_spi_pinout:
+
+|
+|
+
+Hardware SPI pin assignment
+---------------------------
+
+The SPI signals have fixed assignments to GPIO pins.
+It depends on the board design, which SPI's signals are exposed to the user, as
+detailed in the table below. The signal order in the table is: CS0, CS1, MOSI, MISO, CLK.
+
+================= ========================= ======================= ===============
+Board / Pin SPI0 SPI1 SPI2
+================= ========================= ======================= ===============
+Teensy 4.0 10/-/11/12/13 0/-/26/1/27 -
+Teensy 4.1 10/37/11/12/13 0/-/26/1/27 -/29/50/54/49
+MIXMXRT1010-EVK D10/D7/D11/D12/D13 - -
+MIXMXRT1015-EVK D10/-/D11/D12/D13 - -
+MIXMXRT1020-EVK D10/-/D11/D12/D13 A3/D0/A5/A4/A0 -
+MIXMXRT1050-EVK D10/-/D11/D12/D13 (*) - -
+MIXMXRT1050-EVKB D10/-/D11/D12/D13 (*) - -
+MIXMXRT1060-EVK D10/-/D11/D12/D13 (*) - -
+MIXMXRT1064-EVK D10/-/D11/D12/D13 (*) - -
+MIXMXRT1170-EVK D10/-/D11/D12/D13 D28/-/D25/D24/D26 -/-/D14/D15/D24
+Olimex RT1010Py - CS0/-/SDO/SDI/SCK SDCARD with CS1
+Seeed ARCH MIX J4_12/-/J4_14/J4_13/J4_15 J3_09/J3_05/J3_08_J3_11
+================= ========================= ======================= ===============
+
+Pins denoted with (*) are by default not wired at the board.
+
+.. _mimxrt_i2c_pinout:
+
+|
+|
+
+Hardware I2C pin assignment
+---------------------------
+
+The I2C signals have fixed assignments to GPIO pins.
+It depends on the board design, which I2C's signals are exposed to the user, as
+detailed in the table below. The signal order in the table is: SDA, SCL.
+
+================= =========== =========== =========== ======= =======
+Board / Pin I2C 0 I2C 1 I2C 2 I2C 3 I2C 4
+================= =========== =========== =========== ======= =======
+Teensy 4.0 18/19 17/16 25/24 - -
+Teensy 4.1 18/19 17/16 25/24 - -
+MIXMXRT1010-EVK D14/D15 D0/D1 - - -
+MIXMXRT1015-EVK D14/D15 - - - -
+MIXMXRT1020-EVK D14/D15 A4/A5 D0/D1 - -
+MIXMXRT1050-EVK A4/A5 D1/D0 - - -
+MIXMXRT1050-EVKB A4/A5 D1/D0 - - -
+MIXMXRT1060-EVK A4/A5 D1/D0 - - -
+MIXMXRT1064-EVK A4/A5 D1/D0 - - -
+MIXMXRT1170-EVK D14/D15 D1/D0 A4/A5 D26/D25 D19/D18
+Olimex RT1010Py - SDA1/SCL1 SDA2/SCL2 - -
+Seeed ARCH MIX J3_17/J3_16 J4_06/J4_07 J5_05/J5_04 - -
+================= =========== =========== =========== ======= =======
+
+.. _mimxrt_i2s_pinout:
+
+|
+|
+
+Hardware I2S pin assignment
+---------------------------
+
+Pin assignments for a few MIMXRT boards:
+
+=============== == ===== ======== ======= ======= ======== ======= =======
+Board ID MCK SCK_TX WS_TX SD_TX SCK_RX WS_RX SD_RX
+=============== == ===== ======== ======= ======= ======== ======= =======
+Teensy 4.0 1 23 26 27 7 21 20 8
+Teensy 4.0 2 33 4 3 2 - - 5
+Teensy 4.1 1 23 26 27 7 21 20 8
+Teensy 4.1 2 33 4 3 2 - - 5
+Seeed Arch MIX 1 J4_09 J4_14 J4_15 J14_13 J4_11 J4_10 J4_10
+Olimex RT1010Py 1 D8 D6 D7 D4 D1 D2 D3
+Olimex RT1010Py 3 - D10 D9 D11 - - -
+MIMXRT_DEV 1 "MCK" "SCK_TX" "WS_TX" "SD_TX" "SCK_RX" "WS_RX" "SD_RX"
+=============== == ===== ======== ======= ======= ======== ======= =======
+
+Symbolic pin names are provided for the MIMXRT_10xx_DEV boards.
+These are provided for the other boards as well.
\ No newline at end of file
diff --git a/components/language/micropython/docs/mimxrt/quickref.rst b/components/language/micropython/docs/mimxrt/quickref.rst
new file mode 100644
index 00000000..0a14c632
--- /dev/null
+++ b/components/language/micropython/docs/mimxrt/quickref.rst
@@ -0,0 +1,546 @@
+.. _mimxrt_quickref:
+
+Quick reference for the i.MXRT family
+=====================================
+
+.. image:: img/teensy_4.1.jpg
+ :alt: Teensy 4.1 board
+ :width: 640px
+
+The Teensy 4.1 board.
+
+Below is a quick reference for i.MXRT-based boards. If it is your first time
+working with this board it may be useful to get an overview of the microcontroller:
+
+.. toctree::
+ :maxdepth: 1
+
+ general.rst
+ tutorial/intro.rst
+ pinout.rst
+
+
+Installing MicroPython
+----------------------
+
+See the corresponding section of tutorial: :ref:`mimxrt_intro`. It also includes
+a troubleshooting subsection.
+
+General board control
+---------------------
+
+The MicroPython REPL is on the USB port, configured in VCP mode.
+Tab-completion is useful to find out what methods an object has.
+Paste mode (ctrl-E) is useful to paste a large slab of Python code into
+the REPL.
+
+The :mod:`machine` module::
+
+ import machine
+
+ machine.freq() # get the current frequency of the CPU
+
+Delay and timing
+----------------
+
+Use the :mod:`time ` module::
+
+ import time
+
+ time.sleep(1) # sleep for 1 second
+ time.sleep_ms(500) # sleep for 500 milliseconds
+ time.sleep_us(10) # sleep for 10 microseconds
+ start = time.ticks_ms() # get millisecond counter
+ delta = time.ticks_diff(time.ticks_ms(), start) # compute time difference
+
+Timers
+------
+
+The i.MXRT port has three hardware timers. Use the :ref:`machine.Timer ` class
+with a timer ID from 0 to 2 (inclusive)::
+
+ from machine import Timer
+
+ tim0 = Timer(0)
+ tim0.init(period=5000, mode=Timer.ONE_SHOT, callback=lambda t:print(0))
+
+ tim1 = Timer(1)
+ tim1.init(period=2000, mode=Timer.PERIODIC, callback=lambda t:print(1))
+
+The period is in milliseconds.
+
+Virtual timers are not currently supported on this port.
+
+.. _mimxrt_Pins_and_GPIO:
+
+Pins and GPIO
+-------------
+
+Use the :ref:`machine.Pin ` class::
+
+ from machine import Pin
+
+ p0 = Pin('D0', Pin.OUT) # create output pin on GPIO0
+ p0.on() # set pin to "on" (high) level
+ p0.off() # set pin to "off" (low) level
+ p0.value(1) # set pin to on/high
+
+ p2 = Pin('D2', Pin.IN) # create input pin on GPIO2
+ print(p2.value()) # get value, 0 or 1
+
+ p4 = Pin('D4', Pin.IN, Pin.PULL_UP) # enable internal pull-up resistor
+ p5 = Pin('D5', Pin.OUT, value=1) # set pin high on creation
+
+ p6 = Pin(pin.cpu.GPIO_B1_15, Pin.OUT) # Use the cpu pin name.
+
+Available Pins follow the ranges and labelling of the respective board, like:
+
+- 0-33 for Teensy 4.0,
+- 0-21 for the MIMXRT10xx-EVK board, or 'D0-Dxx', or 'A0-Ann',
+- 0-14 for the Olimex RT1010Py board, or 'D0'-'Dxx' and 'A0'-'Ann'
+- 'J3_xx', 'J4_xx', 'J5_xx' for the Seeed ARCH MIX board,
+
+or the pin names of the Pin.board or Pin.cpu classes.
+
+Notes:
+
+* The MIMXRT1xxx-EVK boards may have other on-board devices connected to these
+ pins, limiting it's use for input or output.
+* At the MIMXRT1010_EVK, pins D4, D5 and D9 of the Arduino connector are by
+ default not connected to the MCU. For details refer to the schematics.
+* At the MIMXRT1170_EVK board, the inner rows of the Arduino connectors are assigned as follows:
+ - D16 - D23: J9, odd pin numbers; D17 is by default not connected.
+ - D24 - D27: J26, odd pin numbers; J63-J66 have to be closed to enable these pins.
+ - D29 - D36: J25, odd pin numbers; D29 and D30 are by default not connected.
+
+There's a higher-level abstraction :ref:`machine.Signal `
+which can be used to invert a pin. Useful for illuminating active-low LEDs
+using ``on()`` or ``value(1)``.
+
+UART (serial bus)
+-----------------
+
+See :ref:`machine.UART `. ::
+
+ from machine import UART
+
+ uart1 = UART(1, baudrate=115200)
+ uart1.write('hello') # write 5 bytes
+ uart1.read(5) # read up to 5 bytes
+
+The i.MXRT has up to eight hardware UARTs, but not every board exposes all
+TX and RX pins for users. For the assignment of Pins to UART signals,
+refer to the :ref:`UART pinout `.
+
+PWM (pulse width modulation)
+----------------------------
+
+The i.MXRT has up to four dedicated PWM modules with four FLEXPWM submodules each
+and up to four QTMR modules with four channels, which can be used to generate
+a PWM signal or signal pair.
+
+The PWM functions are provided by the :ref:`machine.PWM ` class.
+It supports all basic methods listed for that class and a few additional methods for
+handling signal groups. ::
+
+ # Samples for Teensy
+ #
+
+ from machine import Pin, PWM
+
+ pwm2 = PWM(Pin(2)) # create PWM object from a pin
+ pwm2.freq() # get current frequency
+ pwm2.freq(1000) # set frequency
+ pwm2.duty_u16() # get current duty cycle, range 0-65535
+ pwm2.duty_u16(200) # set duty cycle, range 0-65535
+ pwm2.deinit() # turn off PWM on the pin
+ # create a complementary signal pair on Pin 2 and 3
+ pwm2 = PWM((2, 3), freq=2000, duty_ns=20000)
+
+ # Create a group of four synchronized signals.
+ # Start with Pin(4) at submodule 0, which creates the sync pulse.
+ pwm4 = PWM(Pin(4), freq=1000, align=PWM.HEAD)
+ # Pins 5, 6, and 9 are pins at the same module
+ pwm5 = PWM(Pin(5), freq=1000, duty_u16=10000, align=PWM.HEAD, sync=True)
+ pwm6 = PWM(Pin(6), freq=1000, duty_u16=20000, align=PWM.HEAD, sync=True)
+ pwm9 = PWM(Pin(9), freq=1000, duty_u16=30000, align=PWM.HEAD, sync=True)
+
+ pwm3 # show the PWM objects properties
+
+
+PWM Constructor
+```````````````
+
+.. class:: PWM(dest, freq, duty_u16, duty_ns, *, center, align, invert, sync, xor, deadtime)
+ :noindex:
+
+ Construct and return a new PWM object using the following parameters:
+
+ - *dest* is the entity on which the PWM is output, which is usually a
+ :ref:`machine.Pin ` object, but a port may allow other values,
+ like integers or strings, which designate a Pin in the machine.PIN class.
+ *dest* is either a single object or a two element object tuple.
+ If the object tuple is specified, the two pins act in complementary
+ mode. These two pins must be the A/B channels of the same submodule.
+
+ PWM objects are either provided by a FLEXPWM module or a QTMR module.
+ The i.MXRT devices have either two or four FLEXPWM and QTMR modules.
+ Each FLEXPWM module has four submodules with three channels, each,
+ called A, B and X. Each QTMR module has four channels.
+ Each FLEXPWM submodule or QTMR channel may be set to different parameters.
+ Not every channel is routed to a board pin. Details are listed below.
+
+ Setting *freq* affects the three channels of the same FLEXPWM submodule.
+ Only one of *duty_u16* and *duty_ns* should be specified at a time.
+
+ Keyword arguments:
+
+ - *freq* should be an integer which sets the frequency in Hz for the
+ PWM cycle. The valid frequency range is 15 Hz resp. 18Hz resp. 24Hz up to > 1 MHz.
+ - *duty_u16* sets the duty cycle as a ratio ``duty_u16 / 65536``.
+ The duty cycle of a X channel can only be changed, if the A and B channel
+ of the respective submodule is not used. Otherwise the duty_16 value of the
+ X channel is 32768 (50%).
+ - *duty_ns* sets the pulse width in nanoseconds. The limitation for X channels
+ apply as well.
+ - *center*\=value. An integer sets the center of the pulse within the pulse period.
+ The range is 0-65535. The resulting pulse will last from center - duty_u16/2 to
+ center + duty_u16/2.
+ - *align*\=value. Shortcuts for the pulse center setting, causing the pulse either at
+ the center of the frame (value=0), the leading edge at the begin (value=1) or the
+ trailing edge at the end of a pulse period (value=2).
+ - *invert*\=True|False channel_mask. Setting a bit in the mask inverts the respective channel.
+ Bit 0 inverts the first specified channel, bit 2 the second. The default is 0.
+ - *sync*\=True|False. If a channel of a module's submodule 0 is already active, other
+ submodules of the same module can be forced to be synchronous to submodule 0. Their
+ pulse period start then at at same clock cycle. The default is False.
+ - *xor*\=0|1|2. If set to 1 or 2, the channel will output the XOR'd signal from channels
+ A or B. If set to 1 on channel A or B, both A and B will show the same signal. If set
+ to 2, A and B will show alternating signals. For details and an illustration, please
+ refer to the MCU's reference manual, chapter "Double Switching PWMs".
+ - *deadtime*\=time_ns. This setting affects complementary channels and defines a deadtime
+ between an edge of a first channel and the edge of the next channel, in which both
+ channels are set to low. That allows connected H-bridges to switch off one side
+ of a push-pull driver before switching on the other side.
+
+PWM Methods
+```````````
+
+The methods are identical to the generic :ref:`machine.PWM ` class,
+with additional keyword arguments to the init() method, matchings those of the constructor.
+
+Each FLEX submodule or QTMR module may run at different frequencies. The PWM signal
+is created by dividing the pwm_clk signal by an integral factor, according to the formula::
+
+ f = pwm_clk / (2**n * m)
+
+with n being in the range of 0..7, and m in the range of 2..65536. pmw_clk is 125Mhz
+for MIMXRT1010/1015/1020, 150 MHz for MIMXRT1050/1060/1064 and 160MHz for MIMXRT1170.
+The lowest frequency is pwm_clk/2**23 (15, 18, 20Hz). The highest frequency with
+U16 resolution is pwm_clk/2**16 (1907, 2288, 2441 Hz), the highest frequency
+with 1 percent resolution is pwm_clk/100 (1.25, 1.5, 1.6 MHz). The highest achievable
+frequency is pwm_clk/3 for the A/B channels, and pwm_clk/2 for the X channels and QTMR
+signal.
+
+PWM Pin Assignment
+``````````````````
+
+Pins are specified in the same way as for the Pin class. For the assignment of Pins
+to PWM signals, refer to the :ref:`PWM pinout `.
+
+ADC (analog to digital conversion)
+----------------------------------
+
+On the i.MXRT ADC functionality is available on Pins labeled 'Ann'.
+
+Use the :ref:`machine.ADC ` class::
+
+ from machine import ADC
+
+ adc = ADC(Pin(32)) # create ADC object on ADC pin
+ adc.read_u16() # read value, 0-65536 across voltage range 0.0v - 3.3v
+
+The resolution of the ADC is 12 bit with 10 to 11 bit accuracy, irrespective of the
+value returned by read_u16(). If you need a higher resolution or better accuracy, use
+an external ADC.
+
+Software SPI bus
+----------------
+
+Software SPI (using bit-banging) works on all pins, and is accessed via the
+:ref:`machine.SoftSPI ` class. ::
+
+ from machine import Pin, SoftSPI
+
+ # construct a SoftSPI bus on the given pins
+ # polarity is the idle state of SCK
+ # phase=0 means sample on the first edge of SCK, phase=1 means the second
+ spi = SoftSPI(baudrate=100000, polarity=1, phase=0, sck=Pin(0), mosi=Pin(2), miso=Pin(4))
+
+ spi.init(baudrate=200000) # set the baudrate
+
+ spi.read(10) # read 10 bytes on MISO
+ spi.read(10, 0xff) # read 10 bytes while outputting 0xff on MOSI
+
+ buf = bytearray(50) # create a buffer
+ spi.readinto(buf) # read into the given buffer (reads 50 bytes in this case)
+ spi.readinto(buf, 0xff) # read into the given buffer and output 0xff on MOSI
+
+ spi.write(b'12345') # write 5 bytes on MOSI
+
+ buf = bytearray(4) # create a buffer
+ spi.write_readinto(b'1234', buf) # write to MOSI and read from MISO into the buffer
+ spi.write_readinto(buf, buf) # write buf to MOSI and read MISO back into buf
+
+The highest supported baud rate is 500000.
+
+Hardware SPI bus
+----------------
+
+There are up to four hardware SPI channels that allow faster transmission
+rates (up to 30Mhz). Hardware SPI is accessed via the
+:ref:`machine.SPI ` class and has the same methods as software SPI above::
+
+ from machine import SPI
+
+ spi = SPI(0, 10000000)
+ spi.write('Hello World')
+
+For the assignment of Pins to SPI signals, refer to
+:ref:`Hardware SPI pinout `.
+
+Notes:
+
+1. Even if the highest reliable baud rate at the moment is about 30 Mhz,
+ setting a baud rate will not always result in exactly that
+ frequency, especially at high baud rates.
+
+2. Sending at higher baud rate is possible. In the tests receiving
+ worked up to 60 MHz, sending up to 90 MHz.
+
+Software I2C bus
+----------------
+
+Software I2C (using bit-banging) works on all output-capable pins, and is
+accessed via the :ref:`machine.SoftI2C ` class::
+
+ from machine import Pin, SoftI2C
+
+ i2c = SoftI2C(scl=Pin(5), sda=Pin(4), freq=100000)
+
+ i2c.scan() # scan for devices
+
+ i2c.readfrom(0x3a, 4) # read 4 bytes from device with address 0x3a
+ i2c.writeto(0x3a, '12') # write '12' to device with address 0x3a
+
+ buf = bytearray(10) # create a buffer with 10 bytes
+ i2c.writeto(0x3a, buf) # write the given buffer to the slave
+
+The highest supported freq is 400000.
+
+Hardware I2C bus
+----------------
+
+There are up to four hardware I2C channels that allow faster transmission rates
+and support the full I2C protocol. The I2C signals have fixed assignments to GPIO pins.
+For the assignment of Pins to I2C signals, refer to :ref:`Hardware I2C pinout