├── tests ├── io │ ├── data │ │ ├── file2 │ │ └── file1 │ ├── resource_stream.py.exp │ ├── file_iter.py │ ├── file_long_read.py │ ├── file_long_read2.py │ ├── file_long_read3.py │ ├── argv.py │ ├── file_stdio.py │ └── file_readinto_len.py.exp ├── import │ ├── pkg │ │ ├── __init__.py │ │ └── mod.py │ ├── pkg6 │ │ ├── x │ │ │ ├── y.py │ │ │ └── __init__.py │ │ └── __init__.py │ ├── pkg8 │ │ └── mod.py │ ├── module_getattr.py.exp │ ├── pkg2 │ │ ├── mod2.py │ │ ├── mod1.py │ │ └── __init__.py │ ├── gen_context2.py │ ├── import_long_dyn.py │ ├── pkg3 │ │ ├── __init__.py │ │ ├── subpkg1 │ │ │ ├── __init__.py │ │ │ └── mod1.py │ │ ├── mod1.py │ │ └── mod2.py │ ├── pkg7 │ │ ├── __init__.py │ │ ├── mod1.py │ │ ├── mod2.py │ │ └── subpkg1 │ │ │ ├── __init__.py │ │ │ └── subpkg2 │ │ │ └── __init__.py │ ├── import1a.py │ ├── import3a.py │ ├── import_override.py.exp │ ├── import_file.py │ ├── import_long_dyn2.py │ ├── import_pkg8.py │ ├── import1b.py │ ├── import_pkg6.py │ ├── import_pkg4.py │ ├── rel_import_inv.py │ ├── import_pkg3.py │ ├── import2a.py │ ├── import_pkg7.py │ ├── import_pkg5.py │ ├── import_pkg7.py.exp │ └── gen_context.py ├── cpydiff │ ├── modules │ │ ├── __init__.py │ │ ├── subpkg │ │ │ └── foo.py │ │ └── foo.py │ ├── modules2 │ │ └── subpkg │ │ │ └── bar.py │ ├── modules3 │ │ ├── __init__.py │ │ └── foo.py │ ├── types_float_rounding.py │ ├── types_str_formatsubscr.py │ ├── core_fstring_raw.py │ ├── types_str_subscrstep.py │ ├── types_tuple_subscrstep.py │ ├── syntax_unicode_nameesc.py │ ├── types_str_endswith.py │ ├── types_str_rsplitnone.py │ ├── modules_array_containment.py │ └── types_bytearray_sliceassign.py ├── feature_check │ ├── const.py.exp │ ├── slice.py.exp │ ├── async_check.py.exp │ ├── bytearray.py.exp │ ├── byteorder.py.exp │ ├── complex.py.exp │ ├── coverage.py.exp │ ├── reverse_ops.py.exp │ ├── set_check.py.exp │ ├── uio_module.py.exp │ ├── float.py.exp │ ├── fstring.py.exp │ ├── native_check.py.exp │ ├── const.py │ ├── int_big.py.exp │ ├── set_check.py │ ├── repl_emacs_check.py │ ├── fstring.py │ ├── slice.py │ ├── complex.py │ ├── bytearray.py │ ├── coverage.py │ ├── uio_module.py │ ├── byteorder.py │ ├── async_check.py │ ├── int_big.py │ ├── native_check.py │ ├── repl_emacs_check.py.exp │ ├── repl_words_move_check.py.exp │ ├── reverse_ops.py │ └── repl_words_move_check.py ├── micropython │ ├── kbd_intr.py.exp │ ├── heapalloc_str.py.exp │ ├── decorator.py.exp │ ├── heap_locked.py.exp │ ├── heapalloc_bytesio2.py.exp │ ├── stack_use.py.exp │ ├── viper_import.py.exp │ ├── viper_misc_intbig.py.exp │ ├── import_mpy_native_gc.py.exp │ ├── native_closure.py.exp │ ├── native_const.py.exp │ ├── viper_const.py.exp │ ├── heapalloc_exc_raise.py.exp │ ├── memstats.py.exp │ ├── viper_globals.py.exp │ ├── heapalloc_super.py.exp │ ├── native_gen.py.exp │ ├── opt_level.py.exp │ ├── decorator_error.py.exp │ ├── heapalloc_int_from_bytes.py.exp │ ├── heapalloc_yield_from.py.exp │ ├── viper_subscr.py.exp │ ├── heapalloc_fail_tuple.py.exp │ ├── schedule.py.exp │ ├── viper_const_intbig.py.exp │ ├── viper_misc2.py.exp │ ├── native_const_intbig.py.exp │ ├── native_for.py.exp │ ├── viper_cond.py.exp │ ├── const.py.exp │ ├── viper_ptr8_load.py.exp │ ├── heap_lock.py.exp │ ├── heapalloc_fail_set.py.exp │ ├── viper_subscr_multi.py.exp │ ├── heapalloc_fail_dict.py.exp │ ├── viper_ptr16_load.py.exp │ ├── const2.py.exp │ ├── heapalloc_inst_call.py.exp │ ├── viper_args.py.exp │ ├── import_mpy_native_x64.py.exp │ ├── native_misc.py.exp │ ├── native_try.py.exp │ ├── native_try_deep.py.exp │ ├── viper_try.py.exp │ ├── viper_types.py.exp │ ├── emg_exc.py.exp │ ├── heapalloc_bytesio.py.exp │ ├── const_intbig.py.exp │ ├── heapalloc_fail_memoryview.py.exp │ ├── extreme_exc.py.exp │ ├── heapalloc.py.exp │ ├── viper_ptr32_load.py.exp │ ├── viper_binop_comp_uint.py.exp │ ├── heapalloc_fail_list.py.exp │ ├── viper_binop_comp_imm.py.exp │ ├── heapalloc_traceback.py.exp │ ├── viper_binop_multi_comp.py.exp │ ├── opt_level_lineno.py.exp │ ├── viper_addr.py.exp │ ├── viper_ptr16_store.py.exp │ ├── decorator.py │ ├── viper_ptr8_store.py.exp │ ├── heapalloc_exc_compressed_emg_exc.py.exp │ ├── const_error.py.exp │ ├── viper_binop_arith_uint.py.exp │ ├── native_const_intbig.py │ ├── viper_const_intbig.py │ ├── heapalloc_exc_compressed.py.exp │ ├── viper_ptr32_store.py.exp │ ├── import_mpy_invalid.py.exp │ ├── native_with.py.exp │ ├── viper_misc.py.exp │ ├── viper_with.py.exp │ ├── viper_binop_comp.py.exp │ ├── stack_use.py │ ├── viper_binop_comp_imm.py │ └── viper_misc_intbig.py ├── pyb │ ├── switch.py.exp │ ├── accel.py.exp │ ├── dac.py.exp │ ├── modstm.py.exp │ ├── irq.py.exp │ ├── extint.py.exp │ ├── led.py.exp │ ├── pyb1.py.exp │ ├── i2c_accel.py.exp │ ├── i2c.py.exp │ ├── pyb_f411.py.exp │ ├── timer.py.exp │ ├── adc.py.exp │ ├── i2c_error.py.exp │ ├── servo.py.exp │ ├── can2.py.exp │ ├── pyb_f405.py.exp │ ├── timer_callback.py.exp │ ├── switch.py │ ├── pyb_f411.py │ ├── pin.py.exp │ └── spi.py.exp ├── extmod │ ├── ticks_diff.py.exp │ ├── utimeq1.py.exp │ ├── uctypes_sizeof_native.py.exp │ ├── uhashlib_final.py.exp │ ├── utimeq_stable.py.exp │ ├── ujson_dumps_extra.py.exp │ ├── ure_sub_unmatched.py.exp │ ├── uasyncio_current_task.py.exp │ ├── utime_time_ns.py.exp │ ├── vfs_lfs_superblock.py.exp │ ├── time_ms_us.py.exp │ ├── uasyncio_await_return.py.exp │ ├── ure_stack_overflow.py.exp │ ├── ujson_loads_bytes.py.exp │ ├── ure_split_notimpl.py.exp │ ├── machine_signal.py.exp │ ├── ubinascii_micropython.py.exp │ ├── uctypes_native_float.py.exp │ ├── uctypes_sizeof_float.py.exp │ ├── uctypes_byteat.py.exp │ ├── uctypes_sizeof_layout.py.exp │ ├── urandom_basic.py.exp │ ├── uasyncio_cancel_self.py.exp │ ├── framebuf_palette.py.exp │ ├── vfs_fat_finaliser.py.exp │ ├── vfs_fat_mtime.py.exp │ ├── machine_timer.py.exp │ ├── uctypes_array_assign_native_le_intbig.py.exp │ ├── ure_split_empty.py.exp │ ├── vfs_fat_oldproto.py.exp │ ├── uasyncio_basic2.py.exp │ ├── uctypes_sizeof.py.exp │ ├── uctypes_ptr_native_le.py.exp │ ├── uctypes_sizeof_od.py.exp │ ├── uasyncio_new_event_loop.py.exp │ ├── uctypes_bytearray.py.exp │ ├── uctypes_error.py.exp │ ├── ure_limit.py.exp │ ├── uasyncio_loop_stop.py.exp │ ├── uctypes_ptr_le.py.exp │ ├── uasyncio_basic.py.exp │ ├── uctypes_print.py.exp │ ├── btree_error.py.exp │ ├── uctypes_array_assign_le.py.exp │ ├── uasyncio_heaplock.py.exp │ ├── uasyncio_micropython.py.exp │ ├── machine1.py.exp │ ├── ucryptolib_aes128_ecb_enc.py.exp │ ├── machine_pinbase.py.exp │ ├── uasyncio_cancel_fair2.py.exp │ ├── uasyncio_exception.py.exp │ ├── machine_pulse.py.exp │ ├── ussl_keycert.py.exp │ ├── uasyncio_wait_task.py.exp │ ├── uasyncio_cancel_wait_on_finished.py.exp │ ├── ussl_basic.py.exp │ ├── uzlib_decompio_gz.py.exp │ ├── vfs_fat_ramdisklarge.py.exp │ ├── uctypes_array_assign_native_le.py.exp │ ├── vfs_fat_fileio1.py.exp │ ├── vfs_lfs_mtime.py.exp │ ├── framebuf_subclass.py.exp │ ├── utime_res.py.exp │ ├── uasyncio_set_exception_handler.py.exp │ ├── uasyncio_event_fair.py.exp │ ├── ujson_dumps_extra.py │ ├── uasyncio_lock_cancel.py.exp │ ├── uzlib_decompio.py.exp │ ├── uasyncio_fair.py.exp │ ├── uctypes_le.py.exp │ ├── uctypes_le_float.py.exp │ └── uctypes_native_le.py.exp ├── cmdline │ ├── cmd_optimise.py.exp │ ├── repl_basic.py │ ├── cmd_verbose.py │ ├── repl_micropyinspect │ ├── cmd_optimise.py │ ├── repl_inspect.py │ ├── repl_micropyinspect.py │ ├── repl_basic.py.exp │ ├── repl_inspect.py.exp │ ├── repl_autocomplete.py │ ├── repl_emacs_keys.py │ └── repl_micropyinspect.py.exp ├── inlineasm │ ├── asmblbx.py.exp │ ├── asmfpaddsub.py.exp │ ├── asmfpldrstr.py.exp │ ├── asmfpmuldiv.py.exp │ ├── asmfpsqrt.py.exp │ ├── asmpushpop.py.exp │ ├── asmconst.py.exp │ ├── asmfpcmp.py.exp │ ├── asmit.py.exp │ ├── asmspecialregs.py.exp │ ├── asmbcc.py.exp │ ├── asmargs.py.exp │ ├── asmbitops.py.exp │ ├── asmdiv.py.exp │ ├── asmshift.py.exp │ ├── asmrettype.py.exp │ ├── asmsum.py.exp │ ├── asmpushpop.py │ ├── asmconst.py │ └── asmspecialregs.py ├── multi_bluetooth │ ├── perf_l2cap.py.exp │ └── perf_gatt_notify.py.exp ├── unicode │ ├── data │ │ ├── utf-8_1.txt │ │ └── utf-8_2.txt │ ├── unicode_ord.py │ ├── unicode_iter.py │ ├── unicode_str_modulo.py │ ├── file1.py │ ├── unicode_chr.py │ ├── unicode_str_format.py │ ├── unicode_index.py │ ├── unicode_pos.py │ └── unicode_slice.py ├── wipy │ ├── reset │ │ └── reset.py.exp │ ├── modwipy.py.exp │ ├── sd.py.exp │ ├── wdt.py.exp │ ├── wlan │ │ ├── machine.py.exp │ │ └── server.py.exp │ ├── skipped │ │ └── rtc_irq.py.exp │ └── pin_irq.py.exp ├── basics │ ├── module2.py.exp │ ├── subclass_native_call.py.exp │ ├── array_micropython.py.exp │ ├── bytes_compare2.py │ ├── string_endswith_upy.py.exp │ ├── string_startswith_upy.py.exp │ ├── try_except_break.py.exp │ ├── class_emptybases.py │ ├── io_bytesio_ext2.py.exp │ ├── set_union.py │ ├── class_ordereddict.py.exp │ ├── set_comprehension.py │ ├── async_def.py.exp │ ├── async_syntaxerror.py.exp │ ├── python36.py.exp │ ├── bytearray_intbig.py │ ├── memoryerror.py.exp │ ├── op_error_literal.py.exp │ ├── parser.py.exp │ ├── annotate_var.py.exp │ ├── bytes_compare3.py.exp │ ├── set_iter_of_iter.py │ ├── fun1.py │ ├── set_clear.py │ ├── set_discard.py │ ├── struct_micropython.py.exp │ ├── lambda1.py │ ├── set_iter.py │ ├── generator2.py │ ├── is_isnot.py │ ├── list_clear.py │ ├── bytes_format_modulo.py.exp │ ├── dict_get.py │ ├── exception_chain.py.exp │ ├── fun_str.py │ ├── list_sum.py │ ├── builtin_bin_intbig.py │ ├── io_buffered_writer.py.exp │ ├── io_write_ext.py.exp │ ├── is_isnot_literal.py.exp │ ├── 0prelim.py │ ├── compare_multi.py │ ├── list_reverse.py │ ├── dict_clear.py │ ├── fun_annotations.py │ ├── generator_pep479.py.exp │ ├── bytes_construct_bytearray.py │ ├── dict_fixed.py.exp │ ├── async_for.py.exp │ ├── dict_iterator.py │ ├── set_copy.py │ ├── tuple_slice.py │ ├── builtin_abs.py │ ├── object1.py │ ├── tuple_count.py │ ├── assign_expr_syntaxerror.py.exp │ ├── try_finally_continue.py.exp │ ├── builtin_hex_intbig.py │ ├── builtin_oct_intbig.py │ ├── dict_copy.py │ ├── errno1.py.exp │ ├── list_copy.py │ ├── set_specialmeth.py │ ├── int_big_pow.py │ ├── int_big_unary.py │ ├── for_return.py │ ├── list_count.py │ ├── set_update.py │ ├── bytes_gen.py │ ├── string_cr_conversion.py │ ├── string_upperlow.py │ ├── andor.py │ ├── assign1.py │ ├── async_await2.py.exp │ ├── bytes_construct_intbig.py │ ├── int2.py │ ├── string_fstring_debug.py.exp │ ├── builtin_hash_gen.py │ ├── bytes_add_bytearray.py │ ├── builtin_pow.py │ ├── builtin_round.py │ ├── dict_specialmeth.py │ ├── fun2.py │ ├── module2.py │ ├── assign_expr.py.exp │ ├── fun3.py │ ├── ifexpr.py │ ├── string_crlf_conversion.py │ ├── bytes_compare_bytearray.py │ ├── list_insert.py │ ├── string_endswith_upy.py │ ├── string_startswith_upy.py │ ├── bytearray_decode.py │ ├── builtin_hex.py │ ├── builtin_oct.py │ ├── bytes_add.py │ ├── class_misc.py │ ├── int_big_cmp.py │ ├── set_containment.py │ ├── slice_intbig.py │ ├── try1.py │ ├── builtin_zip.py │ ├── closure_namedarg.py │ ├── set_isdisjoint.py │ ├── subclass_native_iter.py │ ├── builtin_chr.py │ ├── for2.py │ ├── builtin_filter.py │ ├── iter_of_iter.py │ ├── async_with.py.exp │ ├── builtin_map.py │ ├── dict_fromkeys.py │ ├── int_divzero.py │ ├── set_intersection.py │ ├── subclass_native4.py │ ├── builtin_ellipsis.py │ ├── class_inplace_op2.py.exp │ ├── deque2.py.exp │ ├── exception_chain.py │ ├── io_stringio_with.py │ ├── return1.py │ ├── set_symmetric_difference.py │ ├── string_repr.py │ ├── class_super_aslocal.py │ ├── set_isfooset.py │ ├── subclass_native_str.py │ ├── closure_defargs.py │ ├── int_big_rshift.py │ ├── string_escape.py │ ├── builtin_bin.py │ ├── builtin_len1.py │ ├── int_divmod_intbig.py │ ├── list_remove.py │ ├── python34.py.exp │ ├── async_with_break.py.exp │ ├── builtin_slice.py │ ├── closure_manyvars.py │ ├── async_with_return.py.exp │ ├── class_use_other.py │ ├── frozenset_copy.py │ ├── int_divmod.py │ ├── async_await.py.exp │ ├── break.py │ ├── builtin_sum.py │ ├── class_instance_override.py │ └── subclass_native5.py ├── jni │ ├── object.py.exp │ ├── system_out.py.exp │ ├── list.py.exp │ └── system_out.py ├── net_hosted │ ├── accept_nonblock.py.exp │ ├── accept_timeout.py.exp │ ├── connect_nonblock.py.exp │ ├── connect_poll.py.exp │ ├── ssl_getpeercert.py.exp │ └── uasyncio_start_server.py.exp ├── thread │ ├── stress_schedule.py.exp │ ├── thread_heap_lock.py.exp │ └── thread_exc2.py.exp ├── qemu-arm │ ├── native_test.py.exp │ └── native_test.py ├── stress │ ├── recursive_data.py.exp │ ├── recursive_iternext.py.exp │ ├── recursion.py │ ├── dict_create.py │ ├── dict_copy.py │ └── list_sort.py ├── float │ ├── string_format_modulo3.py.exp │ ├── python36.py.exp │ ├── list_index.py │ ├── int_power.py │ ├── true_value.py │ ├── builtin_float_round_intbig.py │ ├── string_format_modulo3.py │ ├── complex1_intbig.py │ ├── lexer.py │ ├── int_divzero.py │ ├── complex_special_methods.py │ └── complex_reverse_op.py ├── pybnative │ └── while.py.exp ├── misc │ ├── sys_atexit.py.exp │ └── non_compliant_lexer.py.exp ├── net_inet │ ├── tls_num_errors.py.exp │ ├── uasyncio_cancel_stream.py.exp │ ├── uasyncio_open_connection.py.exp │ └── test_tls_sites.py.exp ├── unix │ ├── ffi_callback.py.exp │ └── ffi_float2.py.exp ├── esp32 │ ├── check_err_str.py.exp │ └── esp32_idf_heap_info.py.exp ├── multi_net │ ├── ssl_data.py.exp │ ├── uasyncio_tcp_client_rst.py.exp │ ├── uasyncio_tcp_readexactly.py.exp │ ├── uasyncio_tcp_close_write.py.exp │ ├── uasyncio_tcp_server_client.py.exp │ └── uasyncio_tcp_readinto.py.exp └── internal_bench │ ├── loop_count-1-range.py │ ├── loop_count-4-while_down_gt.py │ ├── loop_count-5-while_down_ne.py │ ├── loop_count-2-range_iter.py │ ├── loop_count-3-while_up.py │ ├── var-1-constant.py │ ├── bytealloc-1-bytes_n.py │ ├── bytealloc-2-repeat.py │ ├── var-4-arg.py │ ├── bench.py │ ├── func_builtin-1-enum_pos.py │ ├── var-3-local.py │ ├── loop_count-5.1-while_down_ne_localvar.py │ ├── var-2-global.py │ ├── func_builtin-2-enum_kw.py │ ├── func_args-1.1-pos_1.py │ ├── from_iter-1-list_bound.py │ ├── from_iter-3-tuple_bound.py │ ├── from_iter-5-bytes_bound.py │ ├── func_args-3.1-kw_1.py │ ├── from_iter-7-bytearray_bound.py │ ├── func_args-1.2-pos_3.py │ ├── var-5-class-attr.py │ ├── func_args-3.2-kw_3.py │ ├── from_iter-2-list_unbound.py │ ├── from_iter-4-tuple_unbound.py │ ├── from_iter-6-bytes_unbound.py │ └── func_args-2-pos_default_2_of_3.py ├── ports ├── nrf │ ├── boards │ │ ├── deploy.md │ │ ├── microbit │ │ │ ├── custom_nrf51822_s110_microbit.ld │ │ │ └── modules │ │ │ │ └── iters.h │ │ ├── wt51822_s4at │ │ │ └── pins.csv │ │ ├── pca10000 │ │ │ └── pins.csv │ │ ├── s132_6.1.1.ld │ │ ├── s140_6.1.1.ld │ │ ├── nrf9160_1M_256k_secure.ld │ │ ├── evk_nina_b3 │ │ │ └── mpconfigboard.mk │ │ ├── pca10031 │ │ │ └── pins.csv │ │ ├── pca10090 │ │ │ └── mpconfigboard.mk │ │ └── actinius_icarus │ │ │ └── mpconfigboard.mk │ ├── modules │ │ └── manifest.py │ ├── .gitignore │ └── freeze │ │ └── test.py ├── samd │ ├── boards │ │ ├── deploy.md │ │ ├── ADAFRUIT_TRINKET_M0 │ │ │ ├── mpconfigboard.h │ │ │ └── mpconfigboard.mk │ │ ├── SAMD21_XPLAINED_PRO │ │ │ ├── mpconfigboard.h │ │ │ └── mpconfigboard.mk │ │ ├── ADAFRUIT_FEATHER_M0_EXPRESS │ │ │ ├── mpconfigboard.h │ │ │ └── mpconfigboard.mk │ │ ├── ADAFRUIT_ITSYBITSY_M4_EXPRESS │ │ │ └── mpconfigboard.mk │ │ └── MINISAM_M4 │ │ │ └── mpconfigboard.mk │ ├── qstrdefsport.h │ └── README.md ├── esp8266 │ ├── user_config.h │ └── boards │ │ ├── GENERIC_512K │ │ ├── _boot.py │ │ ├── mpconfigboard.mk │ │ ├── board.md │ │ └── mpconfigboard.h │ │ ├── GENERIC_1M │ │ └── mpconfigboard.mk │ │ ├── deploy.md │ │ └── GENERIC │ │ └── mpconfigboard.mk ├── bare-arm │ └── mphalport.h ├── mimxrt │ ├── lwip_inc │ │ └── arch │ │ │ └── sys_arch.h │ ├── qstrdefsport.h │ ├── hal │ │ ├── pin_mux.h │ │ └── peripherals.h │ └── boards │ │ ├── MIMXRT1060_EVK │ │ └── board.md │ │ ├── MIMXRT1064_EVK │ │ └── board.md │ │ └── manifest.py ├── stm32 │ ├── lwip_inc │ │ └── arch │ │ │ └── sys_arch.h │ └── boards │ │ ├── PYBD_SF3 │ │ ├── bdev.c │ │ ├── board_init.c │ │ ├── stm32f7xx_hal_conf.h │ │ └── board.md │ │ ├── PYBD_SF6 │ │ ├── bdev.c │ │ ├── board_init.c │ │ ├── stm32f7xx_hal_conf.h │ │ └── board.md │ │ ├── NUCLEO_H743ZI2 │ │ ├── board_init.c │ │ ├── mpconfigboard.mk │ │ └── stm32h7xx_hal_conf.h │ │ ├── PYBD_SF2 │ │ ├── manifest.py │ │ └── board.md │ │ ├── ESPRUINO_PICO │ │ └── deploy.md │ │ ├── LIMIFROG │ │ └── mpconfigboard.mk │ │ ├── LEGO_HUB_NO6 │ │ └── hub_display.h │ │ ├── CERB40 │ │ └── mpconfigboard.mk │ │ ├── HYDRABUS │ │ └── mpconfigboard.mk │ │ ├── NUCLEO_L452RE │ │ └── mpconfigboard.mk │ │ ├── NUCLEO_L476RG │ │ └── mpconfigboard.mk │ │ ├── PYBV3 │ │ └── mpconfigboard.mk │ │ ├── PYBV4 │ │ └── mpconfigboard.mk │ │ ├── STM32F439 │ │ └── mpconfigboard.mk │ │ ├── STM32L476DISC │ │ └── mpconfigboard.mk │ │ ├── VCC_GND_F407VE │ │ ├── board_init.c │ │ └── mpconfigboard.mk │ │ ├── VCC_GND_F407ZG │ │ └── board_init.c │ │ ├── NUCLEO_F411RE │ │ └── mpconfigboard.mk │ │ ├── NUCLEO_F446RE │ │ └── mpconfigboard.mk │ │ ├── NUCLEO_F722ZE │ │ └── mpconfigboard.mk │ │ ├── OLIMEX_H407 │ │ └── mpconfigboard.mk │ │ ├── PYBLITEV10 │ │ └── mpconfigboard.mk │ │ ├── STM32F411DISC │ │ └── mpconfigboard.mk │ │ ├── STM32F429DISC │ │ └── mpconfigboard.mk │ │ ├── STM32F4DISC │ │ └── mpconfigboard.mk │ │ ├── STM32L496GDISC │ │ └── mpconfigboard.mk │ │ ├── NETDUINO_PLUS_2 │ │ └── mpconfigboard.mk │ │ ├── NUCLEO_F401RE │ │ └── mpconfigboard.mk │ │ ├── NUCLEO_F412ZG │ │ └── mpconfigboard.mk │ │ ├── NUCLEO_F413ZH │ │ └── mpconfigboard.mk │ │ └── NUCLEO_H743ZI │ │ └── board_init.c ├── unix │ ├── variants │ │ ├── coverage │ │ │ ├── frzmpy │ │ │ │ ├── frzmpy1.py │ │ │ │ ├── frzmpy2.py │ │ │ │ ├── frzqstr.py │ │ │ │ ├── frzmpy_pkg1 │ │ │ │ │ └── __init__.py │ │ │ │ └── frzmpy_pkg2 │ │ │ │ │ └── mod.py │ │ │ ├── frzstr │ │ │ │ ├── frzstr1.py │ │ │ │ ├── frzstr_pkg1 │ │ │ │ │ └── __init__.py │ │ │ │ └── frzstr_pkg2 │ │ │ │ │ └── mod.py │ │ │ └── manifest.py │ │ ├── dev │ │ │ └── manifest.py │ │ ├── standard │ │ │ └── mpconfigvariant.mk │ │ ├── manifest.py │ │ ├── nanbox │ │ │ └── mpconfigvariant.mk │ │ └── fast │ │ │ └── mpconfigvariant.mk │ ├── .gitignore │ └── input.h ├── minimal │ ├── qstrdefsport.h │ ├── frozentest.mpy │ ├── mphalport.h │ └── frozentest.py ├── powerpc │ ├── qstrdefsport.h │ ├── frozentest.mpy │ └── frozentest.py ├── rp2 │ ├── boards │ │ ├── PICO │ │ │ ├── mpconfigboard.cmake │ │ │ └── mpconfigboard.h │ │ ├── PIMORONI_TINY2040 │ │ │ └── mpconfigboard.cmake │ │ ├── ADAFRUIT_QTPY_RP2040 │ │ │ └── mpconfigboard.cmake │ │ ├── PIMORONI_PICOLIPO_4MB │ │ │ └── mpconfigboard.cmake │ │ ├── SPARKFUN_PROMICRO │ │ │ └── mpconfigboard.cmake │ │ ├── SPARKFUN_THINGPLUS │ │ │ └── mpconfigboard.cmake │ │ ├── ADAFRUIT_FEATHER_RP2040 │ │ │ └── mpconfigboard.cmake │ │ ├── PIMORONI_PICOLIPO_16MB │ │ │ └── mpconfigboard.cmake │ │ ├── ADAFRUIT_ITSYBITSY_RP2040 │ │ │ └── mpconfigboard.cmake │ │ └── manifest.py │ └── qstrdefsport.h ├── teensy │ ├── qstrdefsport.h │ ├── core │ │ └── Arduino.h │ ├── memzip_files │ │ └── main.py │ └── lexermemzip.h ├── javascript │ ├── qstrdefsport.h │ └── node_run.sh ├── pic16bit │ └── qstrdefsport.h ├── qemu-arm │ ├── qstrdefsport.h │ ├── uart.h │ └── mphalport.h ├── zephyr │ └── boards │ │ ├── mimxrt685_evk_cm33.conf │ │ ├── 96b_carbon.conf │ │ ├── rv32m1_vega_ri5cy.conf │ │ ├── reel_board.conf │ │ ├── disco_l475_iot1.conf │ │ ├── frdm_kw41z.conf │ │ ├── nucleo_wb55rg.conf │ │ ├── nucleo_h743zi.conf │ │ ├── qemu_x86.conf │ │ └── qemu_cortex_m3.conf ├── xt804 │ ├── .gitignore │ ├── boards │ │ └── W806 │ │ │ ├── manifest.py │ │ │ └── picture.jpg │ ├── src │ │ ├── todo │ │ │ └── modesp.h │ │ ├── mpy_handle_error.h │ │ ├── repl_uart0.h │ │ ├── utf8_map.h │ │ └── hal_uart0_core.h │ └── modules │ │ └── apa106.py ├── esp32 │ ├── memory.h │ ├── boards │ │ ├── UM_TINYS2 │ │ │ ├── manifest.py │ │ │ ├── board.md │ │ │ └── sdkconfig.board │ │ ├── M5STACK_ATOM │ │ │ ├── manifest.py │ │ │ ├── mpconfigboard.h │ │ │ └── sdkconfig.board │ │ ├── UM_TINYPICO │ │ │ ├── manifest.py │ │ │ ├── sdkconfig.board │ │ │ └── board.md │ │ ├── LOLIN_S2_MINI │ │ │ ├── manifest.py │ │ │ └── sdkconfig.board │ │ ├── UM_FEATHERS2NEO │ │ │ ├── manifest.py │ │ │ ├── board.md │ │ │ └── sdkconfig.board │ │ ├── GENERIC │ │ │ ├── mpconfigboard.h │ │ │ ├── board.md │ │ │ └── mpconfigboard.cmake │ │ ├── GENERIC_OTA │ │ │ ├── mpconfigboard.h │ │ │ └── sdkconfig.board │ │ ├── SIL_WESP32 │ │ │ └── mpconfigboard.h │ │ ├── GENERIC_SPIRAM │ │ │ └── mpconfigboard.h │ │ ├── GENERIC_D2WD │ │ │ ├── mpconfigboard.h │ │ │ └── sdkconfig.board │ │ ├── sdkconfig.usb │ │ ├── UM_FEATHERS2 │ │ │ ├── board.md │ │ │ └── manifest.py │ │ ├── LOLIN_S2_PICO │ │ │ ├── manifest.py │ │ │ └── sdkconfig.board │ │ ├── sdkconfig.spiram │ │ └── sdkconfig.240mhz │ ├── modesp.h │ └── modules │ │ ├── flashbdev.py │ │ └── apa106.py ├── cc3200 │ ├── bootmgr │ │ └── relocator │ │ │ └── relocator.bin │ └── boards │ │ └── WIPY │ │ └── deploy.md └── windows │ └── .gitignore ├── examples ├── natmod │ ├── .gitignore │ ├── features2 │ │ ├── prod.h │ │ └── prod.c │ └── btree │ │ └── btree_py.py ├── embedding │ ├── mpconfigport.h │ └── Makefile ├── SDdatalogger │ └── cardreader.py ├── hwapi │ ├── hwconfig_z_frdm_k64f.py │ ├── hwconfig_esp8266_esp12.py │ └── button_led.py ├── micropython.py └── usercmodule │ └── cppexample │ └── examplemodule.h ├── extmod ├── nimble │ ├── bsp │ │ └── bsp.h │ └── hal │ │ └── hal_gpio.h ├── axtls-include │ └── version.h └── webrepl │ └── manifest.py ├── mpy-cross ├── .gitignore ├── qstrdefsport.h └── mphalport.h ├── .github └── FUNDING.yml ├── tools ├── .gitattributes ├── mpremote │ ├── mpremote │ │ └── __init__.py │ ├── mpremote.py │ └── pyproject.toml └── .gitignore ├── logo ├── logo.jpg ├── 1bit-logo.png ├── trans-logo.png ├── vector-logo-2.png ├── vector-logo-3.png ├── upython-with-micro.jpg ├── upython-with-micro.png └── micropythonpowered-art.png ├── drivers ├── neopixel │ └── manifest.py ├── cyw43 │ └── libcyw43.a ├── cc3100 │ └── inc │ │ └── netapp.h ├── README.md ├── cc3000 │ └── inc │ │ ├── inet_pton.h │ │ └── inet_ntop.h ├── wiznet5k │ └── README.md └── dht │ └── dht.h ├── docs ├── static │ ├── favicon.ico │ └── customstyle.css ├── esp32 │ └── img │ │ └── esp32.jpg ├── develop │ └── img │ │ ├── bitmap.png │ │ ├── linprob.png │ │ └── collision.png ├── rp2 │ ├── img │ │ └── pico_pinout.png │ └── tutorial │ │ └── intro.rst ├── pyboard │ └── tutorial │ │ └── img │ │ ├── skin_amp_1.jpg │ │ ├── skin_amp_2.jpg │ │ ├── skin_lcd_1.jpg │ │ ├── skin_lcd_2.jpg │ │ ├── pyboard_servo.jpg │ │ ├── pyboard_usb_micro.jpg │ │ └── fading_leds_breadboard_fritzing.png └── esp8266 │ └── img │ └── adafruit_products_pinoutstop.jpg ├── lib ├── libm_dbl │ ├── ldexp.c │ ├── lgamma.c │ ├── log10.c │ └── __signbit.c ├── mbedtls_errors │ └── do-test.sh ├── uzlib │ └── tinf.h └── README.md └── shared ├── README.md └── libc └── abort_.c /tests/io/data/file2: -------------------------------------------------------------------------------- 1 | 1234 -------------------------------------------------------------------------------- /ports/nrf/boards/deploy.md: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /ports/samd/boards/deploy.md: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /tests/import/pkg/__init__.py: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /tests/cpydiff/modules/__init__.py: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /tests/feature_check/const.py.exp: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /tests/feature_check/slice.py.exp: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /tests/micropython/kbd_intr.py.exp: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /tests/pyb/switch.py.exp: -------------------------------------------------------------------------------- 1 | False 2 | -------------------------------------------------------------------------------- /examples/natmod/.gitignore: -------------------------------------------------------------------------------- 1 | *.mpy 2 | -------------------------------------------------------------------------------- /extmod/nimble/bsp/bsp.h: -------------------------------------------------------------------------------- 1 | // empty 2 | -------------------------------------------------------------------------------- /mpy-cross/.gitignore: -------------------------------------------------------------------------------- 1 | mpy-cross 2 | -------------------------------------------------------------------------------- /tests/cpydiff/modules/subpkg/foo.py: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /tests/cpydiff/modules2/subpkg/bar.py: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /tests/extmod/ticks_diff.py.exp: -------------------------------------------------------------------------------- 1 | OK 2 | -------------------------------------------------------------------------------- /tests/extmod/utimeq1.py.exp: -------------------------------------------------------------------------------- 1 | OK 2 | -------------------------------------------------------------------------------- /tests/feature_check/async_check.py.exp: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /tests/feature_check/bytearray.py.exp: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /tests/feature_check/byteorder.py.exp: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /tests/feature_check/complex.py.exp: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /tests/feature_check/coverage.py.exp: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /tests/feature_check/reverse_ops.py.exp: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /tests/feature_check/set_check.py.exp: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /tests/feature_check/uio_module.py.exp: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /tests/micropython/heapalloc_str.py.exp: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /tests/pyb/accel.py.exp: -------------------------------------------------------------------------------- 1 | 2 | -------------------------------------------------------------------------------- /.github/FUNDING.yml: -------------------------------------------------------------------------------- 1 | github: micropython 2 | -------------------------------------------------------------------------------- /extmod/nimble/hal/hal_gpio.h: -------------------------------------------------------------------------------- 1 | // empty 2 | -------------------------------------------------------------------------------- /ports/esp8266/user_config.h: -------------------------------------------------------------------------------- 1 | // empty 2 | -------------------------------------------------------------------------------- /tests/cmdline/cmd_optimise.py.exp: -------------------------------------------------------------------------------- 1 | False 2 | -------------------------------------------------------------------------------- /tests/extmod/uctypes_sizeof_native.py.exp: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /tests/extmod/uhashlib_final.py.exp: -------------------------------------------------------------------------------- 1 | done 2 | -------------------------------------------------------------------------------- /tests/extmod/utimeq_stable.py.exp: -------------------------------------------------------------------------------- 1 | OK 2 | -------------------------------------------------------------------------------- /tests/feature_check/float.py.exp: -------------------------------------------------------------------------------- 1 | 64 2 | -------------------------------------------------------------------------------- /tests/feature_check/fstring.py.exp: -------------------------------------------------------------------------------- 1 | a=1 2 | -------------------------------------------------------------------------------- /tests/feature_check/native_check.py.exp: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /tests/import/pkg6/x/y.py: -------------------------------------------------------------------------------- 1 | print("y") 2 | -------------------------------------------------------------------------------- /tests/import/pkg8/mod.py: -------------------------------------------------------------------------------- 1 | print("foo") 2 | -------------------------------------------------------------------------------- /tests/inlineasm/asmblbx.py.exp: -------------------------------------------------------------------------------- 1 | 1 2 | 2 3 | -------------------------------------------------------------------------------- /tests/inlineasm/asmfpaddsub.py.exp: -------------------------------------------------------------------------------- 1 | 90 2 | -------------------------------------------------------------------------------- /tests/inlineasm/asmfpldrstr.py.exp: -------------------------------------------------------------------------------- 1 | 6.0 2 | -------------------------------------------------------------------------------- /tests/inlineasm/asmfpmuldiv.py.exp: -------------------------------------------------------------------------------- 1 | 20 2 | -------------------------------------------------------------------------------- /tests/inlineasm/asmfpsqrt.py.exp: -------------------------------------------------------------------------------- 1 | -160 2 | -------------------------------------------------------------------------------- /tests/inlineasm/asmpushpop.py.exp: -------------------------------------------------------------------------------- 1 | 1 2 | -------------------------------------------------------------------------------- /tests/multi_bluetooth/perf_l2cap.py.exp: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /tests/pyb/dac.py.exp: -------------------------------------------------------------------------------- 1 | DAC(1, bits=8) 2 | -------------------------------------------------------------------------------- /tests/pyb/modstm.py.exp: -------------------------------------------------------------------------------- 1 | 0x8000 2 | 0x0 3 | -------------------------------------------------------------------------------- /tests/unicode/data/utf-8_1.txt: -------------------------------------------------------------------------------- 1 | Привет 2 | -------------------------------------------------------------------------------- /tests/wipy/reset/reset.py.exp: -------------------------------------------------------------------------------- 1 | 2 | -------------------------------------------------------------------------------- /tools/.gitattributes: -------------------------------------------------------------------------------- 1 | *.tar.gz binary 2 | -------------------------------------------------------------------------------- /ports/bare-arm/mphalport.h: -------------------------------------------------------------------------------- 1 | // empty file 2 | -------------------------------------------------------------------------------- /tests/basics/module2.py.exp: -------------------------------------------------------------------------------- 1 | AttributeError 2 | -------------------------------------------------------------------------------- /tests/basics/subclass_native_call.py.exp: -------------------------------------------------------------------------------- 1 | 42 2 | -------------------------------------------------------------------------------- /tests/extmod/ujson_dumps_extra.py.exp: -------------------------------------------------------------------------------- 1 | "1234" 2 | -------------------------------------------------------------------------------- /tests/extmod/ure_sub_unmatched.py.exp: -------------------------------------------------------------------------------- 1 | 1-a2 2 | -------------------------------------------------------------------------------- /tests/import/module_getattr.py.exp: -------------------------------------------------------------------------------- 1 | False 2 | -------------------------------------------------------------------------------- /tests/import/pkg2/mod2.py: -------------------------------------------------------------------------------- 1 | print("in mod2") 2 | -------------------------------------------------------------------------------- /tests/inlineasm/asmconst.py.exp: -------------------------------------------------------------------------------- 1 | 0xfffffff 2 | -------------------------------------------------------------------------------- /tests/jni/object.py.exp: -------------------------------------------------------------------------------- 1 | 42 2 | 42 3 | 42 4 | -------------------------------------------------------------------------------- /tests/jni/system_out.py.exp: -------------------------------------------------------------------------------- 1 | Hello, Java! 2 | -------------------------------------------------------------------------------- /tests/micropython/decorator.py.exp: -------------------------------------------------------------------------------- 1 | bytecode 2 | -------------------------------------------------------------------------------- /tests/micropython/heap_locked.py.exp: -------------------------------------------------------------------------------- 1 | 1 2 | 0 3 | -------------------------------------------------------------------------------- /tests/multi_bluetooth/perf_gatt_notify.py.exp: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /tests/net_hosted/accept_nonblock.py.exp: -------------------------------------------------------------------------------- 1 | True 2 | -------------------------------------------------------------------------------- /tests/net_hosted/accept_timeout.py.exp: -------------------------------------------------------------------------------- 1 | True 2 | -------------------------------------------------------------------------------- /tests/pyb/irq.py.exp: -------------------------------------------------------------------------------- 1 | True 2 | True False 3 | -------------------------------------------------------------------------------- /tests/thread/stress_schedule.py.exp: -------------------------------------------------------------------------------- 1 | PASS 2 | -------------------------------------------------------------------------------- /tools/mpremote/mpremote/__init__.py: -------------------------------------------------------------------------------- 1 | # empty 2 | -------------------------------------------------------------------------------- /ports/mimxrt/lwip_inc/arch/sys_arch.h: -------------------------------------------------------------------------------- 1 | // empty 2 | -------------------------------------------------------------------------------- /ports/stm32/lwip_inc/arch/sys_arch.h: -------------------------------------------------------------------------------- 1 | // empty 2 | -------------------------------------------------------------------------------- /tests/basics/array_micropython.py.exp: -------------------------------------------------------------------------------- 1 | 1 2 | 1 3 | -------------------------------------------------------------------------------- /tests/basics/bytes_compare2.py: -------------------------------------------------------------------------------- 1 | print(b"1" == 1) 2 | -------------------------------------------------------------------------------- /tests/basics/string_endswith_upy.py.exp: -------------------------------------------------------------------------------- 1 | TypeError 2 | -------------------------------------------------------------------------------- /tests/cpydiff/modules/foo.py: -------------------------------------------------------------------------------- 1 | print("foo") 2 | xxx 3 | -------------------------------------------------------------------------------- /tests/extmod/uasyncio_current_task.py.exp: -------------------------------------------------------------------------------- 1 | True 2 | -------------------------------------------------------------------------------- /tests/extmod/utime_time_ns.py.exp: -------------------------------------------------------------------------------- 1 | True 2 | True 3 | -------------------------------------------------------------------------------- /tests/extmod/vfs_lfs_superblock.py.exp: -------------------------------------------------------------------------------- 1 | [] 2 | [] 3 | -------------------------------------------------------------------------------- /tests/import/pkg2/mod1.py: -------------------------------------------------------------------------------- 1 | from pkg2 import mod2 2 | -------------------------------------------------------------------------------- /tests/inlineasm/asmfpcmp.py.exp: -------------------------------------------------------------------------------- 1 | 2 2 | 6 3 | 8 4 | -------------------------------------------------------------------------------- /tests/inlineasm/asmit.py.exp: -------------------------------------------------------------------------------- 1 | 100 1 2 | 100 200 3 | -------------------------------------------------------------------------------- /tests/inlineasm/asmspecialregs.py.exp: -------------------------------------------------------------------------------- 1 | 0 2 | 0 3 | -------------------------------------------------------------------------------- /tests/io/resource_stream.py.exp: -------------------------------------------------------------------------------- 1 | 1234 2 | 1234 3 | -------------------------------------------------------------------------------- /tests/micropython/heapalloc_bytesio2.py.exp: -------------------------------------------------------------------------------- 1 | True 2 | -------------------------------------------------------------------------------- /tests/micropython/stack_use.py.exp: -------------------------------------------------------------------------------- 1 | 2 | -------------------------------------------------------------------------------- /tests/micropython/viper_import.py.exp: -------------------------------------------------------------------------------- 1 | 1 2 | 2 3 | -------------------------------------------------------------------------------- /tests/micropython/viper_misc_intbig.py.exp: -------------------------------------------------------------------------------- 1 | True 2 | -------------------------------------------------------------------------------- /tests/net_hosted/connect_nonblock.py.exp: -------------------------------------------------------------------------------- 1 | True 2 | -------------------------------------------------------------------------------- /tests/pyb/extint.py.exp: -------------------------------------------------------------------------------- 1 | 4 2 | line: 4 3 | line: 4 4 | -------------------------------------------------------------------------------- /tests/pyb/led.py.exp: -------------------------------------------------------------------------------- 1 | LED(1) 2 | LED(2) 3 | LED(3) 4 | -------------------------------------------------------------------------------- /tests/pyb/pyb1.py.exp: -------------------------------------------------------------------------------- 1 | 3 2 | 3 3 | True 4 | 12 5 | -------------------------------------------------------------------------------- /tests/qemu-arm/native_test.py.exp: -------------------------------------------------------------------------------- 1 | 2 2 | 3 3 | 4 4 | -------------------------------------------------------------------------------- /tests/stress/recursive_data.py.exp: -------------------------------------------------------------------------------- 1 | RuntimeError 2 | -------------------------------------------------------------------------------- /tests/thread/thread_heap_lock.py.exp: -------------------------------------------------------------------------------- 1 | [1, 2, 3] 2 | -------------------------------------------------------------------------------- /tests/unicode/data/utf-8_2.txt: -------------------------------------------------------------------------------- 1 | aαbβcγdδ 2 | ぁ🙐 3 | -------------------------------------------------------------------------------- /tests/basics/string_startswith_upy.py.exp: -------------------------------------------------------------------------------- 1 | TypeError 2 | -------------------------------------------------------------------------------- /tests/basics/try_except_break.py.exp: -------------------------------------------------------------------------------- 1 | 1 2 | 2 3 | 4 4 | -------------------------------------------------------------------------------- /tests/cpydiff/modules3/__init__.py: -------------------------------------------------------------------------------- 1 | __all__ = ["foo"] 2 | -------------------------------------------------------------------------------- /tests/extmod/time_ms_us.py.exp: -------------------------------------------------------------------------------- 1 | True 2 | True 3 | True 4 | -------------------------------------------------------------------------------- /tests/extmod/uasyncio_await_return.py.exp: -------------------------------------------------------------------------------- 1 | 42 2 | 42 3 | -------------------------------------------------------------------------------- /tests/extmod/ure_stack_overflow.py.exp: -------------------------------------------------------------------------------- 1 | RuntimeError 2 | -------------------------------------------------------------------------------- /tests/feature_check/const.py: -------------------------------------------------------------------------------- 1 | x = const(1) 2 | print(x) 3 | -------------------------------------------------------------------------------- /tests/float/string_format_modulo3.py.exp: -------------------------------------------------------------------------------- 1 | -10 2 | 100 3 | -------------------------------------------------------------------------------- /tests/import/pkg/mod.py: -------------------------------------------------------------------------------- 1 | def foo(): 2 | return 42 3 | -------------------------------------------------------------------------------- /tests/import/pkg2/__init__.py: -------------------------------------------------------------------------------- 1 | from pkg2 import mod1 2 | -------------------------------------------------------------------------------- /tests/inlineasm/asmbcc.py.exp: -------------------------------------------------------------------------------- 1 | 0 2 | 10 3 | 20 4 | 30 5 | -------------------------------------------------------------------------------- /tests/io/data/file1: -------------------------------------------------------------------------------- 1 | longer line1 2 | line2 3 | line3 4 | -------------------------------------------------------------------------------- /tests/micropython/import_mpy_native_gc.py.exp: -------------------------------------------------------------------------------- 1 | 3628800 2 | -------------------------------------------------------------------------------- /tests/micropython/native_closure.py.exp: -------------------------------------------------------------------------------- 1 | 1 2 | 2 3 | 9 4 | -------------------------------------------------------------------------------- /tests/micropython/native_const.py.exp: -------------------------------------------------------------------------------- 1 | b'bytes' 2 | 123 3 | -------------------------------------------------------------------------------- /tests/micropython/viper_const.py.exp: -------------------------------------------------------------------------------- 1 | b'bytes' 2 | 123 3 | -------------------------------------------------------------------------------- /tests/pyb/i2c_accel.py.exp: -------------------------------------------------------------------------------- 1 | [76] 2 | True 3 | b'\x01' 4 | -------------------------------------------------------------------------------- /mpy-cross/qstrdefsport.h: -------------------------------------------------------------------------------- 1 | // qstrs specific to this port 2 | -------------------------------------------------------------------------------- /tests/basics/class_emptybases.py: -------------------------------------------------------------------------------- 1 | class A(): 2 | pass 3 | -------------------------------------------------------------------------------- /tests/basics/io_bytesio_ext2.py.exp: -------------------------------------------------------------------------------- 1 | True 2 | -------------------------------------------------------------------------------- /tests/basics/set_union.py: -------------------------------------------------------------------------------- 1 | print(sorted({1}.union({2}))) 2 | -------------------------------------------------------------------------------- /tests/extmod/ujson_loads_bytes.py.exp: -------------------------------------------------------------------------------- 1 | [1, 2] 2 | [None] 3 | -------------------------------------------------------------------------------- /tests/extmod/ure_split_notimpl.py.exp: -------------------------------------------------------------------------------- 1 | NotImplementedError 2 | -------------------------------------------------------------------------------- /tests/import/gen_context2.py: -------------------------------------------------------------------------------- 1 | def call(g): 2 | next(g) 3 | -------------------------------------------------------------------------------- /tests/inlineasm/asmargs.py.exp: -------------------------------------------------------------------------------- 1 | 1 2 | 2 3 | 3 4 | 6 5 | 10 6 | -------------------------------------------------------------------------------- /tests/micropython/heapalloc_exc_raise.py.exp: -------------------------------------------------------------------------------- 1 | error 2 | ok 3 | -------------------------------------------------------------------------------- /tests/micropython/memstats.py.exp: -------------------------------------------------------------------------------- 1 | True 2 | True 3 | True 4 | -------------------------------------------------------------------------------- /tests/micropython/viper_globals.py.exp: -------------------------------------------------------------------------------- 1 | NameError 2 | 123 3 | -------------------------------------------------------------------------------- /tests/net_hosted/connect_poll.py.exp: -------------------------------------------------------------------------------- 1 | 1 20 2 | 1 3 | 1 4 4 | -------------------------------------------------------------------------------- /ports/unix/variants/coverage/frzmpy/frzmpy1.py: -------------------------------------------------------------------------------- 1 | print('frzmpy1') 2 | -------------------------------------------------------------------------------- /ports/unix/variants/coverage/frzstr/frzstr1.py: -------------------------------------------------------------------------------- 1 | print('frzstr1') 2 | -------------------------------------------------------------------------------- /tests/basics/class_ordereddict.py.exp: -------------------------------------------------------------------------------- 1 | ['a', 'b', 'c', 'd', 'e'] 2 | -------------------------------------------------------------------------------- /tests/basics/set_comprehension.py: -------------------------------------------------------------------------------- 1 | print({a for a in range(5)}) 2 | -------------------------------------------------------------------------------- /tests/extmod/machine_signal.py.exp: -------------------------------------------------------------------------------- 1 | 0 0 2 | 1 1 3 | 1 0 4 | 0 1 5 | -------------------------------------------------------------------------------- /tests/extmod/ubinascii_micropython.py.exp: -------------------------------------------------------------------------------- 1 | b'31:32:33' 2 | b'' 3 | -------------------------------------------------------------------------------- /tests/extmod/uctypes_native_float.py.exp: -------------------------------------------------------------------------------- 1 | 12.3400 2 | 12.3400 3 | -------------------------------------------------------------------------------- /tests/extmod/uctypes_sizeof_float.py.exp: -------------------------------------------------------------------------------- 1 | 4 2 | 8 3 | 8 4 | 16 5 | -------------------------------------------------------------------------------- /tests/import/import_long_dyn.py: -------------------------------------------------------------------------------- 1 | from import_long_dyn2 import * 2 | -------------------------------------------------------------------------------- /tests/import/pkg3/__init__.py: -------------------------------------------------------------------------------- 1 | print("pkg __name__:", __name__) 2 | -------------------------------------------------------------------------------- /tests/import/pkg7/__init__.py: -------------------------------------------------------------------------------- 1 | print("pkg __name__:", __name__) 2 | -------------------------------------------------------------------------------- /tests/import/pkg7/mod1.py: -------------------------------------------------------------------------------- 1 | print("mod1") 2 | foo = "mod1.foo" 3 | -------------------------------------------------------------------------------- /tests/import/pkg7/mod2.py: -------------------------------------------------------------------------------- 1 | print("mod2") 2 | bar = "mod2.bar" 3 | -------------------------------------------------------------------------------- /tests/micropython/heapalloc_super.py.exp: -------------------------------------------------------------------------------- 1 | B foo 2 | A foo 3 | 42 4 | -------------------------------------------------------------------------------- /tests/micropython/native_gen.py.exp: -------------------------------------------------------------------------------- 1 | 3 2 | 4 3 | 5 4 | [0, 1, 2] 5 | -------------------------------------------------------------------------------- /tests/micropython/opt_level.py.exp: -------------------------------------------------------------------------------- 1 | 0 2 | 1 3 | True 4 | False 5 | -------------------------------------------------------------------------------- /tests/net_hosted/ssl_getpeercert.py.exp: -------------------------------------------------------------------------------- 1 | True 2 | -------------------------------------------------------------------------------- /tests/pybnative/while.py.exp: -------------------------------------------------------------------------------- 1 | 0 2 | 1 3 | 0 4 | 1 5 | 2 6 | 3 7 | -------------------------------------------------------------------------------- /tests/wipy/modwipy.py.exp: -------------------------------------------------------------------------------- 1 | True 2 | True 3 | True 4 | Exception 5 | -------------------------------------------------------------------------------- /examples/embedding/mpconfigport.h: -------------------------------------------------------------------------------- 1 | #include "mpconfigport_minimal.h" 2 | -------------------------------------------------------------------------------- /examples/natmod/features2/prod.h: -------------------------------------------------------------------------------- 1 | float prod_array(int n, float *ar); 2 | -------------------------------------------------------------------------------- /ports/stm32/boards/PYBD_SF3/bdev.c: -------------------------------------------------------------------------------- 1 | #include "boards/PYBD_SF2/bdev.c" 2 | -------------------------------------------------------------------------------- /ports/stm32/boards/PYBD_SF6/bdev.c: -------------------------------------------------------------------------------- 1 | #include "boards/PYBD_SF2/bdev.c" 2 | -------------------------------------------------------------------------------- /tests/basics/async_def.py.exp: -------------------------------------------------------------------------------- 1 | decorator 2 | foo 3 | StopIteration 4 | -------------------------------------------------------------------------------- /tests/basics/async_syntaxerror.py.exp: -------------------------------------------------------------------------------- 1 | SyntaxError 2 | SyntaxError 3 | -------------------------------------------------------------------------------- /tests/basics/python36.py.exp: -------------------------------------------------------------------------------- 1 | 100000 2 | 165 3 | 65535 4 | 123 5 | 83 6 | -------------------------------------------------------------------------------- /tests/cpydiff/modules3/foo.py: -------------------------------------------------------------------------------- 1 | def hello(): 2 | print("hello") 3 | -------------------------------------------------------------------------------- /tests/extmod/uctypes_byteat.py.exp: -------------------------------------------------------------------------------- 1 | b'0123' 2 | bytearray(b'0123') 3 | -------------------------------------------------------------------------------- /tests/extmod/uctypes_sizeof_layout.py.exp: -------------------------------------------------------------------------------- 1 | True 2 | True 3 | TypeError 4 | -------------------------------------------------------------------------------- /tests/extmod/urandom_basic.py.exp: -------------------------------------------------------------------------------- 1 | True 2 | True 3 | 0 4 | ValueError 5 | -------------------------------------------------------------------------------- /tests/import/import1a.py: -------------------------------------------------------------------------------- 1 | import import1b 2 | 3 | print(import1b.var) 4 | -------------------------------------------------------------------------------- /tests/import/import3a.py: -------------------------------------------------------------------------------- 1 | from import1b import * 2 | 3 | print(var) 4 | -------------------------------------------------------------------------------- /tests/import/import_override.py.exp: -------------------------------------------------------------------------------- 1 | import import1b None 0 2 | 456 3 | -------------------------------------------------------------------------------- /tests/import/pkg6/__init__.py: -------------------------------------------------------------------------------- 1 | from .x import * 2 | 3 | print("init") 4 | -------------------------------------------------------------------------------- /tests/import/pkg6/x/__init__.py: -------------------------------------------------------------------------------- 1 | from .y import * 2 | 3 | print("x") 4 | -------------------------------------------------------------------------------- /tests/inlineasm/asmbitops.py.exp: -------------------------------------------------------------------------------- 1 | 24 2 | 16 3 | 0xf000000 4 | 0x10000 5 | -------------------------------------------------------------------------------- /tests/jni/list.py.exp: -------------------------------------------------------------------------------- 1 | [] 2 | [one, two] 3 | [one, two] 4 | one two 5 | -------------------------------------------------------------------------------- /tests/micropython/decorator_error.py.exp: -------------------------------------------------------------------------------- 1 | SyntaxError 2 | SyntaxError 3 | -------------------------------------------------------------------------------- /tests/micropython/heapalloc_int_from_bytes.py.exp: -------------------------------------------------------------------------------- 1 | 49 2 | 12849 3 | 50 4 | -------------------------------------------------------------------------------- /tests/micropython/heapalloc_yield_from.py.exp: -------------------------------------------------------------------------------- 1 | 0 2 | 1 3 | 0 4 | 1 5 | -------------------------------------------------------------------------------- /tests/micropython/viper_subscr.py.exp: -------------------------------------------------------------------------------- 1 | [1, 2, 3] 2 | 1 3 | 2 4 | 3 5 | -------------------------------------------------------------------------------- /tests/misc/sys_atexit.py.exp: -------------------------------------------------------------------------------- 1 | done before exit 2 | done at exit: ok 3 | -------------------------------------------------------------------------------- /tests/net_inet/tls_num_errors.py.exp: -------------------------------------------------------------------------------- 1 | heap is locked 2 | wrap: True 3 | -------------------------------------------------------------------------------- /tests/pyb/i2c.py.exp: -------------------------------------------------------------------------------- 1 | ValueError -1 2 | ValueError 0 3 | I2C 1 4 | [] 5 | -------------------------------------------------------------------------------- /tests/pyb/pyb_f411.py.exp: -------------------------------------------------------------------------------- 1 | (96000000, 96000000, 24000000, 48000000) 2 | -------------------------------------------------------------------------------- /tests/pyb/timer.py.exp: -------------------------------------------------------------------------------- 1 | 100 2 | 200 3 | 300 4 | 400 5 | 100 6 | 0.001 7 | -------------------------------------------------------------------------------- /extmod/axtls-include/version.h: -------------------------------------------------------------------------------- 1 | #define AXTLS_VERSION "(no version)" 2 | -------------------------------------------------------------------------------- /ports/nrf/boards/microbit/custom_nrf51822_s110_microbit.ld: -------------------------------------------------------------------------------- 1 | _fs_size = 12K; 2 | -------------------------------------------------------------------------------- /ports/unix/.gitignore: -------------------------------------------------------------------------------- 1 | micropython 2 | micropython-* 3 | *.py 4 | *.gcov 5 | -------------------------------------------------------------------------------- /ports/unix/variants/coverage/frzmpy/frzmpy2.py: -------------------------------------------------------------------------------- 1 | raise ZeroDivisionError 2 | -------------------------------------------------------------------------------- /tests/basics/bytearray_intbig.py: -------------------------------------------------------------------------------- 1 | print(bytearray(2**65 - (2**65 - 1))) 2 | -------------------------------------------------------------------------------- /tests/basics/memoryerror.py.exp: -------------------------------------------------------------------------------- 1 | MemoryError 2 | 1000 0 999 3 | MemoryError 4 | -------------------------------------------------------------------------------- /tests/basics/op_error_literal.py.exp: -------------------------------------------------------------------------------- 1 | TypeError 2 | TypeError 3 | TypeError 4 | -------------------------------------------------------------------------------- /tests/basics/parser.py.exp: -------------------------------------------------------------------------------- 1 | SyntaxError 2 | SyntaxError 3 | SyntaxError 4 | -------------------------------------------------------------------------------- /tests/cmdline/repl_basic.py: -------------------------------------------------------------------------------- 1 | # basic REPL tests 2 | print(1) 3 |  4 | 2 5 | -------------------------------------------------------------------------------- /tests/extmod/uasyncio_cancel_self.py.exp: -------------------------------------------------------------------------------- 1 | task start 2 | can't cancel self 3 | -------------------------------------------------------------------------------- /tests/import/pkg3/subpkg1/__init__.py: -------------------------------------------------------------------------------- 1 | print("subpkg1 __name__:", __name__) 2 | -------------------------------------------------------------------------------- /tests/import/pkg7/subpkg1/__init__.py: -------------------------------------------------------------------------------- 1 | print("pkg __name__:", __name__) 2 | -------------------------------------------------------------------------------- /tests/micropython/heapalloc_fail_tuple.py.exp: -------------------------------------------------------------------------------- 1 | MemoryError: tuple create 2 | -------------------------------------------------------------------------------- /tests/micropython/schedule.py.exp: -------------------------------------------------------------------------------- 1 | 1 2 | outer 3 | inner 4 | RuntimeError 5 | -------------------------------------------------------------------------------- /tests/micropython/viper_const_intbig.py.exp: -------------------------------------------------------------------------------- 1 | 123456789012345678901234567890 2 | -------------------------------------------------------------------------------- /tests/micropython/viper_misc2.py.exp: -------------------------------------------------------------------------------- 1 | bytearray(b'\xa4\x8aH\xee\xce\xec') 2 | -------------------------------------------------------------------------------- /logo/logo.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/gengyong/micropython/HEAD/logo/logo.jpg -------------------------------------------------------------------------------- /ports/mimxrt/qstrdefsport.h: -------------------------------------------------------------------------------- 1 | // qstrs specific to this port 2 | // *FORMAT-OFF* 3 | -------------------------------------------------------------------------------- /ports/minimal/qstrdefsport.h: -------------------------------------------------------------------------------- 1 | // qstrs specific to this port 2 | // *FORMAT-OFF* 3 | -------------------------------------------------------------------------------- /ports/nrf/modules/manifest.py: -------------------------------------------------------------------------------- 1 | freeze("$(PORT_DIR)/modules/scripts", "_mkfs.py") 2 | -------------------------------------------------------------------------------- /ports/powerpc/qstrdefsport.h: -------------------------------------------------------------------------------- 1 | // qstrs specific to this port 2 | // *FORMAT-OFF* 3 | -------------------------------------------------------------------------------- /ports/rp2/boards/PICO/mpconfigboard.cmake: -------------------------------------------------------------------------------- 1 | # cmake file for Raspberry Pi Pico 2 | -------------------------------------------------------------------------------- /ports/samd/qstrdefsport.h: -------------------------------------------------------------------------------- 1 | // qstrs specific to this port 2 | // *FORMAT-OFF* 3 | -------------------------------------------------------------------------------- /ports/teensy/qstrdefsport.h: -------------------------------------------------------------------------------- 1 | // qstrs specific to this port 2 | // *FORMAT-OFF* 3 | -------------------------------------------------------------------------------- /tests/basics/annotate_var.py.exp: -------------------------------------------------------------------------------- 1 | False 2 | 1 3 | (1, 2) 4 | NameError 5 | 1 6 | -------------------------------------------------------------------------------- /tests/basics/bytes_compare3.py.exp: -------------------------------------------------------------------------------- 1 | ######## 2 | False 3 | ######## 4 | False 5 | -------------------------------------------------------------------------------- /tests/basics/set_iter_of_iter.py: -------------------------------------------------------------------------------- 1 | i = iter(iter({1, 2, 3})) 2 | print(sorted(i)) 3 | -------------------------------------------------------------------------------- /tests/extmod/framebuf_palette.py.exp: -------------------------------------------------------------------------------- 1 | True 2 | True 3 | True 4 | True 5 | True 6 | -------------------------------------------------------------------------------- /tests/extmod/vfs_fat_finaliser.py.exp: -------------------------------------------------------------------------------- 1 | MemoryError 2 | x0 3 | x1 4 | x2 5 | x3 6 | -------------------------------------------------------------------------------- /tests/extmod/vfs_fat_mtime.py.exp: -------------------------------------------------------------------------------- 1 | test 2 | True True 3 | True 4 | -------------------------------------------------------------------------------- /tests/float/python36.py.exp: -------------------------------------------------------------------------------- 1 | 1000.18 2 | 1e+12 3 | 123.0 4 | 123.4 5 | 1e+13 6 | -------------------------------------------------------------------------------- /tests/import/import_file.py: -------------------------------------------------------------------------------- 1 | import import1b 2 | 3 | print(import1b.__file__) 4 | -------------------------------------------------------------------------------- /tests/import/import_long_dyn2.py: -------------------------------------------------------------------------------- 1 | globals()["long_long_very_long_long_name"] = 1 2 | -------------------------------------------------------------------------------- /tests/import/pkg7/subpkg1/subpkg2/__init__.py: -------------------------------------------------------------------------------- 1 | print("pkg __name__:", __name__) 2 | -------------------------------------------------------------------------------- /tests/inlineasm/asmdiv.py.exp: -------------------------------------------------------------------------------- 1 | 411 2 | -411 3 | -411 4 | 411 5 | 411 6 | 2 7 | 1 8 | -------------------------------------------------------------------------------- /tests/micropython/native_const_intbig.py.exp: -------------------------------------------------------------------------------- 1 | 123456789012345678901234567890 2 | -------------------------------------------------------------------------------- /tests/micropython/native_for.py.exp: -------------------------------------------------------------------------------- 1 | 0 2 | 1 3 | 2 4 | 3 5 | 0 6 | 1 7 | 2 8 | 3 9 | -------------------------------------------------------------------------------- /tests/micropython/viper_cond.py.exp: -------------------------------------------------------------------------------- 1 | not x False 2 | x True 3 | y 1 4 | z 65536 5 | -------------------------------------------------------------------------------- /ports/javascript/qstrdefsport.h: -------------------------------------------------------------------------------- 1 | // qstrs specific to this port 2 | // *FORMAT-OFF* 3 | -------------------------------------------------------------------------------- /ports/mimxrt/hal/pin_mux.h: -------------------------------------------------------------------------------- 1 | // Empty file, necessary for compilation with NXP MCU SDK 2 | -------------------------------------------------------------------------------- /ports/pic16bit/qstrdefsport.h: -------------------------------------------------------------------------------- 1 | // qstrs specific to this port 2 | // *FORMAT-OFF* 3 | -------------------------------------------------------------------------------- /ports/qemu-arm/qstrdefsport.h: -------------------------------------------------------------------------------- 1 | // qstrs specific to this port 2 | // *FORMAT-OFF* 3 | -------------------------------------------------------------------------------- /ports/stm32/boards/PYBD_SF3/board_init.c: -------------------------------------------------------------------------------- 1 | #include "boards/PYBD_SF2/board_init.c" 2 | -------------------------------------------------------------------------------- /ports/stm32/boards/PYBD_SF6/board_init.c: -------------------------------------------------------------------------------- 1 | #include "boards/PYBD_SF2/board_init.c" 2 | -------------------------------------------------------------------------------- /ports/zephyr/boards/mimxrt685_evk_cm33.conf: -------------------------------------------------------------------------------- 1 | # Hardware features 2 | CONFIG_SPI=y 3 | -------------------------------------------------------------------------------- /tests/basics/fun1.py: -------------------------------------------------------------------------------- 1 | # calling a function 2 | 3 | def f(): 4 | print(1) 5 | f() 6 | -------------------------------------------------------------------------------- /tests/basics/set_clear.py: -------------------------------------------------------------------------------- 1 | s = {1, 2, 3, 4} 2 | print(s.clear()) 3 | print(list(s)) 4 | -------------------------------------------------------------------------------- /tests/basics/set_discard.py: -------------------------------------------------------------------------------- 1 | s = {1, 2} 2 | print(s.discard(1)) 3 | print(list(s)) 4 | -------------------------------------------------------------------------------- /tests/basics/struct_micropython.py.exp: -------------------------------------------------------------------------------- 1 | True 2 | b'\x01\x00\x00\x00\x00\x00\x00\x00' 3 | -------------------------------------------------------------------------------- /tests/cmdline/cmd_verbose.py: -------------------------------------------------------------------------------- 1 | # cmdline: -v -v 2 | # test verbose output 3 | print(1) 4 | -------------------------------------------------------------------------------- /tests/extmod/machine_timer.py.exp: -------------------------------------------------------------------------------- 1 | one-shot 2 | periodic 3 | periodic 4 | periodic 5 | -------------------------------------------------------------------------------- /tests/extmod/uctypes_array_assign_native_le_intbig.py.exp: -------------------------------------------------------------------------------- 1 | 0x11223344 2 | 0x11223344 3 | -------------------------------------------------------------------------------- /tests/extmod/ure_split_empty.py.exp: -------------------------------------------------------------------------------- 1 | ['a b c foobar'] 2 | ['foo'] 3 | ['axbc'] 4 | -------------------------------------------------------------------------------- /tests/extmod/vfs_fat_oldproto.py.exp: -------------------------------------------------------------------------------- 1 | [('file.txt', 32768, 0, 6)] 2 | hello! 3 | [] 4 | -------------------------------------------------------------------------------- /tests/feature_check/int_big.py.exp: -------------------------------------------------------------------------------- 1 | 1000000000000000000000000000000000000000000000 2 | -------------------------------------------------------------------------------- /tests/import/import_pkg8.py: -------------------------------------------------------------------------------- 1 | # import with no __init__.py files 2 | import pkg8.mod 3 | -------------------------------------------------------------------------------- /tests/import/pkg3/mod1.py: -------------------------------------------------------------------------------- 1 | print("mod1 __name__:", __name__) 2 | from . import mod2 3 | -------------------------------------------------------------------------------- /tests/io/file_iter.py: -------------------------------------------------------------------------------- 1 | f = open("io/data/file1") 2 | for l in f: 3 | print(l) 4 | -------------------------------------------------------------------------------- /tests/micropython/const.py.exp: -------------------------------------------------------------------------------- 1 | 123 580 2 | 123 580 3 | 12 46 4 | 1 2 5 | True False 6 | -------------------------------------------------------------------------------- /logo/1bit-logo.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/gengyong/micropython/HEAD/logo/1bit-logo.png -------------------------------------------------------------------------------- /mpy-cross/mphalport.h: -------------------------------------------------------------------------------- 1 | // prevent including extmod/virtpin.h 2 | #define mp_hal_pin_obj_t 3 | -------------------------------------------------------------------------------- /ports/javascript/node_run.sh: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | node $(dirname $0)/build/micropython.js "$@" 3 | -------------------------------------------------------------------------------- /ports/mimxrt/hal/peripherals.h: -------------------------------------------------------------------------------- 1 | // Empty file, necessary for compilation with NXP MCU SDK 2 | -------------------------------------------------------------------------------- /ports/nrf/.gitignore: -------------------------------------------------------------------------------- 1 | # Nordic files 2 | ##################### 3 | drivers/bluetooth/s1*/ 4 | -------------------------------------------------------------------------------- /ports/rp2/qstrdefsport.h: -------------------------------------------------------------------------------- 1 | // qstrs specific to this port 2 | // *FORMAT-OFF* 3 | Q(/lib) 4 | -------------------------------------------------------------------------------- /ports/xt804/.gitignore: -------------------------------------------------------------------------------- 1 | # local debug folder 2 | temp 3 | 4 | # sdk folder 5 | sdk 6 | 7 | -------------------------------------------------------------------------------- /ports/zephyr/boards/96b_carbon.conf: -------------------------------------------------------------------------------- 1 | # TODO: Enable networking 2 | CONFIG_NETWORKING=y 3 | -------------------------------------------------------------------------------- /tests/basics/lambda1.py: -------------------------------------------------------------------------------- 1 | # lambda 2 | 3 | f = lambda x, y: x + 3 * y 4 | print(f(3, 5)) 5 | -------------------------------------------------------------------------------- /tests/basics/set_iter.py: -------------------------------------------------------------------------------- 1 | s = {1, 2, 3, 4} 2 | l = list(s) 3 | l.sort() 4 | print(l) 5 | 6 | -------------------------------------------------------------------------------- /tests/cmdline/repl_micropyinspect: -------------------------------------------------------------------------------- 1 | import uos 2 | 3 | uos.putenv('MICROPYINSPECT', '1') 4 | -------------------------------------------------------------------------------- /tests/extmod/uasyncio_basic2.py.exp: -------------------------------------------------------------------------------- 1 | main start 2 | forever start 3 | main done 4 | 42 5 | -------------------------------------------------------------------------------- /tests/extmod/uctypes_sizeof.py.exp: -------------------------------------------------------------------------------- 1 | 2 2 | 2 3 | 4 4 | TypeError 5 | 6 6 | 1 7 | TypeError 8 | -------------------------------------------------------------------------------- /tests/import/import1b.py: -------------------------------------------------------------------------------- 1 | var = 123 2 | 3 | 4 | def throw(): 5 | raise ValueError 6 | -------------------------------------------------------------------------------- /tests/import/import_pkg6.py: -------------------------------------------------------------------------------- 1 | # This tests relative imports as used in pkg6 2 | import pkg6 3 | -------------------------------------------------------------------------------- /tests/inlineasm/asmshift.py.exp: -------------------------------------------------------------------------------- 1 | 0x246 2 | 0x800000 3 | 0x91 4 | 0x1 5 | 0x91 6 | -0x1 7 | -------------------------------------------------------------------------------- /tests/micropython/viper_ptr8_load.py.exp: -------------------------------------------------------------------------------- 1 | bytearray(b'1234') 2 | 49 50 3 | 202 4 | 202 5 | -------------------------------------------------------------------------------- /tests/pyb/adc.py.exp: -------------------------------------------------------------------------------- 1 | 3 | 50 4 | 25 5 | 30 6 | -------------------------------------------------------------------------------- /tests/pyb/i2c_error.py.exp: -------------------------------------------------------------------------------- 1 | OSError(5,) 2 | OSError(5,) 3 | OSError(5,) 4 | OSError(5,) 5 | -------------------------------------------------------------------------------- /tests/pyb/servo.py.exp: -------------------------------------------------------------------------------- 1 | 2 | 1500 3 | (630, 2410, 1490, 2460, 2190) 4 | -------------------------------------------------------------------------------- /tests/wipy/sd.py.exp: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | Exception 5 | Exception 6 | Exception 7 | -------------------------------------------------------------------------------- /drivers/neopixel/manifest.py: -------------------------------------------------------------------------------- 1 | freeze( 2 | ".", 3 | "neopixel.py", 4 | opt=3, 5 | ) 6 | -------------------------------------------------------------------------------- /logo/trans-logo.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/gengyong/micropython/HEAD/logo/trans-logo.png -------------------------------------------------------------------------------- /ports/rp2/boards/PIMORONI_TINY2040/mpconfigboard.cmake: -------------------------------------------------------------------------------- 1 | # cmake file for Pimoroni Tiny 2040 2 | -------------------------------------------------------------------------------- /ports/stm32/boards/NUCLEO_H743ZI2/board_init.c: -------------------------------------------------------------------------------- 1 | #include "boards/NUCLEO_H743ZI/board_init.c" 2 | -------------------------------------------------------------------------------- /ports/unix/variants/coverage/manifest.py: -------------------------------------------------------------------------------- 1 | freeze_as_str("frzstr") 2 | freeze_as_mpy("frzmpy") 3 | -------------------------------------------------------------------------------- /tests/basics/generator2.py: -------------------------------------------------------------------------------- 1 | gen = (i for i in range(10)) 2 | for i in gen: 3 | print(i) 4 | -------------------------------------------------------------------------------- /tests/basics/is_isnot.py: -------------------------------------------------------------------------------- 1 | print([1, 2] is [1, 2]) 2 | a = [1, 2] 3 | b = a 4 | print(b is a) 5 | -------------------------------------------------------------------------------- /tests/basics/list_clear.py: -------------------------------------------------------------------------------- 1 | # tests list.clear 2 | x = [1, 2, 3, 4] 3 | x.clear() 4 | print(x) 5 | -------------------------------------------------------------------------------- /tests/extmod/uctypes_ptr_native_le.py.exp: -------------------------------------------------------------------------------- 1 | 48 2 | 49 3 | 0x3130 4 | 48 49 5 | 48 49 6 | 0x3130 7 | -------------------------------------------------------------------------------- /tests/extmod/uctypes_sizeof_od.py.exp: -------------------------------------------------------------------------------- 1 | 2 2 | 2 3 | 4 4 | TypeError 5 | 6 6 | 1 7 | TypeError 8 | -------------------------------------------------------------------------------- /tests/feature_check/set_check.py: -------------------------------------------------------------------------------- 1 | # check if set literal syntax is supported 2 | print({1}) 3 | -------------------------------------------------------------------------------- /tests/io/file_long_read.py: -------------------------------------------------------------------------------- 1 | f = open("io/data/file1") 2 | b = f.read(100) 3 | print(len(b)) 4 | -------------------------------------------------------------------------------- /tests/micropython/heap_lock.py.exp: -------------------------------------------------------------------------------- 1 | MemoryError 2 | MemoryError 3 | 1 4 | MemoryError 5 | [] 6 | -------------------------------------------------------------------------------- /tests/micropython/heapalloc_fail_set.py.exp: -------------------------------------------------------------------------------- 1 | MemoryError: set create 2 | MemoryError: set copy 3 | -------------------------------------------------------------------------------- /tests/micropython/viper_subscr_multi.py.exp: -------------------------------------------------------------------------------- 1 | bytearray(b'\x03\x02') 2 | bytearray(b'\x03\x02') 3 | -------------------------------------------------------------------------------- /tests/pyb/can2.py.exp: -------------------------------------------------------------------------------- 1 | (1, True, 0, b'') 2 | (2, True, 1, b'') 3 | (3, True, 2, b'') 4 | False 5 | -------------------------------------------------------------------------------- /docs/static/favicon.ico: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/gengyong/micropython/HEAD/docs/static/favicon.ico -------------------------------------------------------------------------------- /extmod/webrepl/manifest.py: -------------------------------------------------------------------------------- 1 | freeze(".", ("webrepl.py", "webrepl_setup.py", "websocket_helper.py")) 2 | -------------------------------------------------------------------------------- /logo/vector-logo-2.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/gengyong/micropython/HEAD/logo/vector-logo-2.png -------------------------------------------------------------------------------- /logo/vector-logo-3.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/gengyong/micropython/HEAD/logo/vector-logo-3.png -------------------------------------------------------------------------------- /ports/esp32/memory.h: -------------------------------------------------------------------------------- 1 | // this is needed for lib/crypto-algorithms/sha256.c 2 | #include 3 | -------------------------------------------------------------------------------- /ports/qemu-arm/uart.h: -------------------------------------------------------------------------------- 1 | void uart_init(void); 2 | void uart_tx_strn(const char *buf, size_t len); 3 | -------------------------------------------------------------------------------- /ports/rp2/boards/ADAFRUIT_QTPY_RP2040/mpconfigboard.cmake: -------------------------------------------------------------------------------- 1 | # cmake file for Adafruit QT Py RP2040 2 | -------------------------------------------------------------------------------- /ports/rp2/boards/PIMORONI_PICOLIPO_4MB/mpconfigboard.cmake: -------------------------------------------------------------------------------- 1 | # cmake file for Pimoroni Pico LiPo 4MB 2 | -------------------------------------------------------------------------------- /ports/rp2/boards/SPARKFUN_PROMICRO/mpconfigboard.cmake: -------------------------------------------------------------------------------- 1 | # cmake file for SparkFun Pro Micro RP2040 2 | -------------------------------------------------------------------------------- /ports/rp2/boards/SPARKFUN_THINGPLUS/mpconfigboard.cmake: -------------------------------------------------------------------------------- 1 | # cmake file for SparkFun Thing Plus RP2040 2 | -------------------------------------------------------------------------------- /ports/stm32/boards/NUCLEO_H743ZI2/mpconfigboard.mk: -------------------------------------------------------------------------------- 1 | include boards/NUCLEO_H743ZI/mpconfigboard.mk 2 | -------------------------------------------------------------------------------- /ports/stm32/boards/PYBD_SF3/stm32f7xx_hal_conf.h: -------------------------------------------------------------------------------- 1 | #include "boards/PYBD_SF2/stm32f7xx_hal_conf.h" 2 | -------------------------------------------------------------------------------- /ports/stm32/boards/PYBD_SF6/stm32f7xx_hal_conf.h: -------------------------------------------------------------------------------- 1 | #include "boards/PYBD_SF2/stm32f7xx_hal_conf.h" 2 | -------------------------------------------------------------------------------- /tests/basics/bytes_format_modulo.py.exp: -------------------------------------------------------------------------------- 1 | b'%' 2 | b'=1=' 3 | b'=1=2=' 4 | b'=str=' 5 | b"=b'str'=" 6 | -------------------------------------------------------------------------------- /tests/basics/dict_get.py: -------------------------------------------------------------------------------- 1 | for d in {}, {42:2}: 2 | print(d.get(42)) 3 | print(d.get(42,2)) 4 | -------------------------------------------------------------------------------- /tests/basics/exception_chain.py.exp: -------------------------------------------------------------------------------- 1 | Warning: exception chaining not supported 2 | Caught Exception 3 | -------------------------------------------------------------------------------- /tests/basics/fun_str.py: -------------------------------------------------------------------------------- 1 | # test str of function 2 | 3 | def f(): 4 | pass 5 | print(str(f)[:8]) 6 | -------------------------------------------------------------------------------- /tests/basics/list_sum.py: -------------------------------------------------------------------------------- 1 | # list addition 2 | a = [1,2,3] 3 | b = [4,5,6] 4 | c = a + b 5 | print(c) 6 | -------------------------------------------------------------------------------- /tests/extmod/uasyncio_new_event_loop.py.exp: -------------------------------------------------------------------------------- 1 | start 2 | task 0 3 | stop 4 | start 5 | task 0 6 | stop 7 | -------------------------------------------------------------------------------- /tests/extmod/uctypes_bytearray.py.exp: -------------------------------------------------------------------------------- 1 | bytearray(b'01') 2 | 3 | bytearray(b'0123') 4 | -------------------------------------------------------------------------------- /tests/extmod/uctypes_error.py.exp: -------------------------------------------------------------------------------- 1 | TypeError 2 | TypeError 3 | TypeError 4 | TypeError 5 | TypeError 6 | -------------------------------------------------------------------------------- /tests/extmod/ure_limit.py.exp: -------------------------------------------------------------------------------- 1 | Error 2 | Error 3 | Error 4 | Error 5 | Error 6 | Error 7 | Error 8 | -------------------------------------------------------------------------------- /tests/feature_check/repl_emacs_check.py: -------------------------------------------------------------------------------- 1 | # Check for emacs keys in REPL 2 | t = +11 3 | t == 2 4 | -------------------------------------------------------------------------------- /tests/micropython/heapalloc_fail_dict.py.exp: -------------------------------------------------------------------------------- 1 | MemoryError: create dict 2 | MemoryError: dict.items 3 | -------------------------------------------------------------------------------- /tests/micropython/viper_ptr16_load.py.exp: -------------------------------------------------------------------------------- 1 | bytearray(b'1234') 2 | 12849 13363 3 | 26212 4 | 26212 5 | -------------------------------------------------------------------------------- /tests/unicode/unicode_ord.py: -------------------------------------------------------------------------------- 1 | # test builtin ord with unicode characters 2 | 3 | print(ord("α")) 4 | -------------------------------------------------------------------------------- /tests/unix/ffi_callback.py.exp: -------------------------------------------------------------------------------- 1 | org string: bytearray(b'foobar') 2 | qsort'ed: bytearray(b'abfoor') 3 | -------------------------------------------------------------------------------- /docs/esp32/img/esp32.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/gengyong/micropython/HEAD/docs/esp32/img/esp32.jpg -------------------------------------------------------------------------------- /drivers/cyw43/libcyw43.a: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/gengyong/micropython/HEAD/drivers/cyw43/libcyw43.a -------------------------------------------------------------------------------- /ports/esp32/boards/UM_TINYS2/manifest.py: -------------------------------------------------------------------------------- 1 | include("$(PORT_DIR)/boards/manifest.py") 2 | freeze("modules") 3 | -------------------------------------------------------------------------------- /ports/nrf/freeze/test.py: -------------------------------------------------------------------------------- 1 | import sys 2 | 3 | 4 | def hello(): 5 | print("Hello %s!" % sys.platform) 6 | -------------------------------------------------------------------------------- /ports/rp2/boards/ADAFRUIT_FEATHER_RP2040/mpconfigboard.cmake: -------------------------------------------------------------------------------- 1 | # cmake file for Adafruit Feather RP2040 2 | -------------------------------------------------------------------------------- /ports/rp2/boards/PIMORONI_PICOLIPO_16MB/mpconfigboard.cmake: -------------------------------------------------------------------------------- 1 | # cmake file for Pimoroni Pico LiPo 16MB 2 | -------------------------------------------------------------------------------- /ports/zephyr/boards/rv32m1_vega_ri5cy.conf: -------------------------------------------------------------------------------- 1 | # Flash drivers 2 | CONFIG_FLASH=y 3 | CONFIG_FLASH_MAP=y 4 | -------------------------------------------------------------------------------- /tests/basics/builtin_bin_intbig.py: -------------------------------------------------------------------------------- 1 | # test builtin bin function 2 | 3 | print(bin(12345678901234567890)) 4 | -------------------------------------------------------------------------------- /tests/extmod/uasyncio_loop_stop.py.exp: -------------------------------------------------------------------------------- 1 | run 0 2 | start 3 | sleep 4 | run 1 5 | run 2 6 | task 7 | end 8 | -------------------------------------------------------------------------------- /tests/extmod/uctypes_ptr_le.py.exp: -------------------------------------------------------------------------------- 1 | True 2 | True 3 | 48 4 | 49 5 | 0x3130 6 | 48 49 7 | 48 49 8 | 0x3130 9 | -------------------------------------------------------------------------------- /tests/import/pkg3/subpkg1/mod1.py: -------------------------------------------------------------------------------- 1 | print("subpkg1.mod1 __name__:", __name__) 2 | from ..mod2 import foo 3 | -------------------------------------------------------------------------------- /tests/io/file_long_read2.py: -------------------------------------------------------------------------------- 1 | f = open("io/data/bigfile1") 2 | b = f.read() 3 | print(len(b)) 4 | print(b) 5 | -------------------------------------------------------------------------------- /tests/micropython/const2.py.exp: -------------------------------------------------------------------------------- 1 | 2 | function X 1 3 | class X 1 4 | method X 2 4 4 5 | -------------------------------------------------------------------------------- /tests/micropython/heapalloc_inst_call.py.exp: -------------------------------------------------------------------------------- 1 | __call__ 2 | __call__ 1 3 | __call__ 1 2 4 | __call__ 1 2 3 5 | -------------------------------------------------------------------------------- /tests/micropython/viper_args.py.exp: -------------------------------------------------------------------------------- 1 | 0 2 | 1 3 | 1 2 4 | 1 2 3 5 | 1 2 3 4 6 | 1 2 3 4 5 7 | 1 2 3 4 5 6 8 | -------------------------------------------------------------------------------- /tests/net_inet/uasyncio_cancel_stream.py.exp: -------------------------------------------------------------------------------- 1 | start 2 | cancelling 3 | waiting 4 | cancelled 5 | done 6 | -------------------------------------------------------------------------------- /tests/pyb/pyb_f405.py.exp: -------------------------------------------------------------------------------- 1 | (168000000, 168000000, 42000000, 84000000) 2 | 3 | OSError(5,) 4 | -------------------------------------------------------------------------------- /tests/stress/recursive_iternext.py.exp: -------------------------------------------------------------------------------- 1 | RuntimeError 2 | RuntimeError 3 | RuntimeError 4 | RuntimeError 5 | -------------------------------------------------------------------------------- /tests/unicode/unicode_iter.py: -------------------------------------------------------------------------------- 1 | for c in "Hello": 2 | print(c) 3 | for c in "Привет": 4 | print(c) 5 | -------------------------------------------------------------------------------- /tests/unix/ffi_float2.py.exp: -------------------------------------------------------------------------------- 1 | 1.772454 2 | 1.000000 3 | 1.000000 4 | 0.886227 5 | 6.000000 6 | 6.000000 7 | -------------------------------------------------------------------------------- /tests/wipy/wdt.py.exp: -------------------------------------------------------------------------------- 1 | Exception 2 | Exception 3 | Exception 4 | 5 | Exception 6 | 7 | 8 | -------------------------------------------------------------------------------- /docs/develop/img/bitmap.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/gengyong/micropython/HEAD/docs/develop/img/bitmap.png -------------------------------------------------------------------------------- /docs/develop/img/linprob.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/gengyong/micropython/HEAD/docs/develop/img/linprob.png -------------------------------------------------------------------------------- /docs/rp2/img/pico_pinout.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/gengyong/micropython/HEAD/docs/rp2/img/pico_pinout.png -------------------------------------------------------------------------------- /drivers/cc3100/inc/netapp.h: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/gengyong/micropython/HEAD/drivers/cc3100/inc/netapp.h -------------------------------------------------------------------------------- /logo/upython-with-micro.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/gengyong/micropython/HEAD/logo/upython-with-micro.jpg -------------------------------------------------------------------------------- /logo/upython-with-micro.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/gengyong/micropython/HEAD/logo/upython-with-micro.png -------------------------------------------------------------------------------- /ports/esp32/boards/M5STACK_ATOM/manifest.py: -------------------------------------------------------------------------------- 1 | include("$(PORT_DIR)/boards/manifest.py") 2 | freeze("modules") 3 | -------------------------------------------------------------------------------- /ports/esp32/boards/UM_TINYPICO/manifest.py: -------------------------------------------------------------------------------- 1 | include("$(PORT_DIR)/boards/manifest.py") 2 | freeze("modules") 3 | -------------------------------------------------------------------------------- /ports/minimal/frozentest.mpy: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/gengyong/micropython/HEAD/ports/minimal/frozentest.mpy -------------------------------------------------------------------------------- /ports/nrf/boards/wt51822_s4at/pins.csv: -------------------------------------------------------------------------------- 1 | P1,P1 2 | P2,P2 3 | P3,P3 4 | P4,P4 5 | P9,P9 6 | P10,P10 7 | P13,P13 8 | -------------------------------------------------------------------------------- /ports/powerpc/frozentest.mpy: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/gengyong/micropython/HEAD/ports/powerpc/frozentest.mpy -------------------------------------------------------------------------------- /ports/rp2/boards/ADAFRUIT_ITSYBITSY_RP2040/mpconfigboard.cmake: -------------------------------------------------------------------------------- 1 | # cmake file for Adafruit ItsyBitsy RP2040 2 | -------------------------------------------------------------------------------- /ports/stm32/boards/NUCLEO_H743ZI2/stm32h7xx_hal_conf.h: -------------------------------------------------------------------------------- 1 | #include "boards/NUCLEO_H743ZI/stm32h7xx_hal_conf.h" 2 | -------------------------------------------------------------------------------- /ports/teensy/core/Arduino.h: -------------------------------------------------------------------------------- 1 | //#include "WProgram.h" 2 | #include "core_pins.h" 3 | #include "pins_arduino.h" 4 | -------------------------------------------------------------------------------- /ports/xt804/boards/W806/manifest.py: -------------------------------------------------------------------------------- 1 | 2 | include("$(PORT_DIR)/boards/manifest.py") 3 | 4 | freeze("modules") 5 | -------------------------------------------------------------------------------- /tests/basics/io_buffered_writer.py.exp: -------------------------------------------------------------------------------- 1 | b'' 2 | b'foobarfo' 3 | b'foobarfoobar' 4 | b'foobarfoobar' 5 | b'foo' 6 | -------------------------------------------------------------------------------- /tests/basics/io_write_ext.py.exp: -------------------------------------------------------------------------------- 1 | b'fo' 2 | b'fofoo' 3 | b'fofoooob' 4 | b'fofooooboobar' 5 | b'fofooooboobar' 6 | -------------------------------------------------------------------------------- /tests/basics/is_isnot_literal.py.exp: -------------------------------------------------------------------------------- 1 | True 2 | False 3 | False 4 | True 5 | True 6 | False 7 | False 8 | True 9 | -------------------------------------------------------------------------------- /tests/cmdline/cmd_optimise.py: -------------------------------------------------------------------------------- 1 | # cmdline: -O 2 | # test optimisation output 3 | print(__debug__) 4 | assert 0 5 | -------------------------------------------------------------------------------- /tests/extmod/uasyncio_basic.py.exp: -------------------------------------------------------------------------------- 1 | start 2 | after sleep 3 | short 4 | long 5 | negative 6 | took 20 40 0 7 | -------------------------------------------------------------------------------- /tests/micropython/import_mpy_native_x64.py.exp: -------------------------------------------------------------------------------- 1 | mod0 ValueError incompatible .mpy arch 2 | mod1 OK 3 | mod2 OK 4 | -------------------------------------------------------------------------------- /tests/micropython/native_misc.py.exp: -------------------------------------------------------------------------------- 1 | 1 [] 2 2 | 1 [] 3 3 | 3 4 | 6 5 | True 6 | False 7 | 1 2 3 5 8 | 1 2 3 4 9 | -------------------------------------------------------------------------------- /tests/micropython/native_try.py.exp: -------------------------------------------------------------------------------- 1 | finally 2 | NameError 3 | finally 4 | NameError 5 | 100 6 | 200 7 | 300 8 | -------------------------------------------------------------------------------- /tests/micropython/native_try_deep.py.exp: -------------------------------------------------------------------------------- 1 | 8 2 | 7 3 | 6 4 | 5 5 | 4 6 | 3 7 | 2 8 | 1 9 | ValueError 10 | -------------------------------------------------------------------------------- /tests/micropython/viper_try.py.exp: -------------------------------------------------------------------------------- 1 | finally 2 | NameError 3 | finally 4 | NameError 5 | 100 6 | 200 7 | 300 8 | -------------------------------------------------------------------------------- /tests/micropython/viper_types.py.exp: -------------------------------------------------------------------------------- 1 | False 2 | True 3 | False 4 | True 5 | False 6 | True 7 | False 8 | True 9 | -------------------------------------------------------------------------------- /docs/develop/img/collision.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/gengyong/micropython/HEAD/docs/develop/img/collision.png -------------------------------------------------------------------------------- /logo/micropythonpowered-art.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/gengyong/micropython/HEAD/logo/micropythonpowered-art.png -------------------------------------------------------------------------------- /ports/esp32/boards/LOLIN_S2_MINI/manifest.py: -------------------------------------------------------------------------------- 1 | include("$(PORT_DIR)/boards/manifest.py") 2 | freeze("./modules") 3 | -------------------------------------------------------------------------------- /ports/esp32/boards/UM_FEATHERS2NEO/manifest.py: -------------------------------------------------------------------------------- 1 | include("$(PORT_DIR)/boards/manifest.py") 2 | freeze("modules") 3 | -------------------------------------------------------------------------------- /ports/esp32/modesp.h: -------------------------------------------------------------------------------- 1 | void esp_neopixel_write(uint8_t pin, uint8_t *pixels, uint32_t numBytes, uint8_t timing); 2 | -------------------------------------------------------------------------------- /ports/esp8266/boards/GENERIC_512K/_boot.py: -------------------------------------------------------------------------------- 1 | import gc 2 | 3 | gc.threshold((gc.mem_free() + gc.mem_alloc()) // 4) 4 | -------------------------------------------------------------------------------- /tests/basics/0prelim.py: -------------------------------------------------------------------------------- 1 | # all tests need print to work! make sure it does work 2 | 3 | print(1) 4 | print('abc') 5 | -------------------------------------------------------------------------------- /tests/basics/compare_multi.py: -------------------------------------------------------------------------------- 1 | print(1 < 2 < 3) 2 | print(1 < 2 < 3 < 4) 3 | print(1 > 2 < 3) 4 | print(1 < 2 > 3) 5 | -------------------------------------------------------------------------------- /tests/basics/list_reverse.py: -------------------------------------------------------------------------------- 1 | a = [] 2 | for i in range(100): 3 | a.append(i) 4 | a.reverse() 5 | print(a) 6 | -------------------------------------------------------------------------------- /tests/esp32/check_err_str.py.exp: -------------------------------------------------------------------------------- 1 | [Errno 2] ENOENT 2 | (-5379, 'ESP_ERR_OTA_VALIDATE_FAILED') 3 | exc: 4 | -5379 5 | -------------------------------------------------------------------------------- /tests/extmod/uctypes_print.py.exp: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | -------------------------------------------------------------------------------- /tests/feature_check/fstring.py: -------------------------------------------------------------------------------- 1 | # check whether f-strings (PEP-498) are supported 2 | a = 1 3 | print(f"a={a}") 4 | -------------------------------------------------------------------------------- /tests/feature_check/slice.py: -------------------------------------------------------------------------------- 1 | try: 2 | slice 3 | print("slice") 4 | except NameError: 5 | print("no") 6 | -------------------------------------------------------------------------------- /tests/io/file_long_read3.py: -------------------------------------------------------------------------------- 1 | f = open("io/data/bigfile1", "rb") 2 | b = f.read(512) 3 | print(len(b)) 4 | print(b) 5 | -------------------------------------------------------------------------------- /tests/micropython/emg_exc.py.exp: -------------------------------------------------------------------------------- 1 | Traceback (most recent call last): 2 | , line 22, in f 3 | ValueError: 1 4 | 5 | -------------------------------------------------------------------------------- /tests/micropython/heapalloc_bytesio.py.exp: -------------------------------------------------------------------------------- 1 | b'1234123412341234123412341234123412341234123412341234123412341234' 2 | -------------------------------------------------------------------------------- /tests/net_hosted/uasyncio_start_server.py.exp: -------------------------------------------------------------------------------- 1 | create server1 2 | create server2 3 | OSError 4 | sleep 5 | done 6 | -------------------------------------------------------------------------------- /tests/wipy/wlan/machine.py.exp: -------------------------------------------------------------------------------- 1 | 2 | True 3 | True 4 | Active 5 | True 6 | True 7 | Exception 8 | -------------------------------------------------------------------------------- /lib/libm_dbl/ldexp.c: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | double ldexp(double x, int n) 4 | { 5 | return scalbn(x, n); 6 | } 7 | -------------------------------------------------------------------------------- /ports/xt804/src/todo/modesp.h: -------------------------------------------------------------------------------- 1 | void esp_neopixel_write(uint8_t pin, uint8_t *pixels, uint32_t numBytes, uint8_t timing); 2 | -------------------------------------------------------------------------------- /tests/basics/dict_clear.py: -------------------------------------------------------------------------------- 1 | d = {1: 2, 3: 4} 2 | print(len(d)) 3 | d.clear() 4 | print(d) 5 | d[2] = 42 6 | print(d) 7 | -------------------------------------------------------------------------------- /tests/basics/fun_annotations.py: -------------------------------------------------------------------------------- 1 | def foo(x: int, y: list) -> dict: 2 | return {x: y} 3 | 4 | print(foo(1, [2, 3])) 5 | -------------------------------------------------------------------------------- /tests/basics/generator_pep479.py.exp: -------------------------------------------------------------------------------- 1 | 1 2 | RuntimeError 3 | StopIteration 4 | 1 5 | RuntimeError 6 | 0 7 | RuntimeError 8 | -------------------------------------------------------------------------------- /tests/cmdline/repl_inspect.py: -------------------------------------------------------------------------------- 1 | # cmdline: -i -c print("test") 2 | # -c option combined with -i option results in REPL 3 | -------------------------------------------------------------------------------- /tests/extmod/btree_error.py.exp: -------------------------------------------------------------------------------- 1 | OSError True 2 | read 24 3 | OSError(1000,) 4 | read 24 5 | ioctl 2 6 | OSError(1001,) 7 | -------------------------------------------------------------------------------- /tests/extmod/uctypes_array_assign_le.py.exp: -------------------------------------------------------------------------------- 1 | 0x11 2 | 0x2233 3 | 0x4455 4 | 0x66778899 5 | True 6 | 0xaabbccdd 7 | True 8 | -------------------------------------------------------------------------------- /tests/feature_check/complex.py: -------------------------------------------------------------------------------- 1 | try: 2 | complex 3 | print("complex") 4 | except NameError: 5 | print("no") 6 | -------------------------------------------------------------------------------- /tests/io/argv.py: -------------------------------------------------------------------------------- 1 | try: 2 | import usys as sys 3 | except ImportError: 4 | import sys 5 | 6 | print(sys.argv) 7 | -------------------------------------------------------------------------------- /tests/multi_net/ssl_data.py.exp: -------------------------------------------------------------------------------- 1 | --- instance0 --- 2 | b'client to server' 3 | --- instance1 --- 4 | b'server to client' 5 | -------------------------------------------------------------------------------- /tests/unicode/unicode_str_modulo.py: -------------------------------------------------------------------------------- 1 | # test handling of unicode chars in string % formatting 2 | 3 | print("α" % ()) 4 | -------------------------------------------------------------------------------- /ports/xt804/boards/W806/picture.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/gengyong/micropython/HEAD/ports/xt804/boards/W806/picture.jpg -------------------------------------------------------------------------------- /tests/basics/bytes_construct_bytearray.py: -------------------------------------------------------------------------------- 1 | # test construction of bytes from bytearray 2 | 3 | print(bytes(bytearray(4))) 4 | -------------------------------------------------------------------------------- /tests/basics/dict_fixed.py.exp: -------------------------------------------------------------------------------- 1 | TypeError 2 | TypeError 3 | TypeError 4 | TypeError 5 | TypeError 6 | TypeError 7 | TypeError 8 | -------------------------------------------------------------------------------- /tests/extmod/uasyncio_heaplock.py.exp: -------------------------------------------------------------------------------- 1 | start 2 | 1 0 3 | 2 0 4 | sleep 5 | 1 1 6 | 1 2 7 | 2 1 8 | 1 3 9 | finish 10 | -------------------------------------------------------------------------------- /tests/extmod/uasyncio_micropython.py.exp: -------------------------------------------------------------------------------- 1 | True 2 | task start 1 3 | task end 1 4 | 2 5 | task start 2 6 | timeout 7 | finish 8 | -------------------------------------------------------------------------------- /tests/feature_check/bytearray.py: -------------------------------------------------------------------------------- 1 | try: 2 | bytearray 3 | print("bytearray") 4 | except NameError: 5 | print("no") 6 | -------------------------------------------------------------------------------- /tests/import/import_pkg4.py: -------------------------------------------------------------------------------- 1 | # Testing that "recursive" imports (pkg2/__init__.py imports from pkg2) work 2 | import pkg2 3 | -------------------------------------------------------------------------------- /tests/import/rel_import_inv.py: -------------------------------------------------------------------------------- 1 | try: 2 | from . import foo 3 | except: 4 | print("Invalid relative import caught") 5 | -------------------------------------------------------------------------------- /tests/micropython/const_intbig.py.exp: -------------------------------------------------------------------------------- 1 | 0xffffffff 0xffffffffffffffff 2 | 0x100000000fffffffe 0x100000000000000000ffffffff 3 | -------------------------------------------------------------------------------- /tests/micropython/heapalloc_fail_memoryview.py.exp: -------------------------------------------------------------------------------- 1 | MemoryError: memoryview create 2 | MemoryError: memoryview subscr get 3 | -------------------------------------------------------------------------------- /tests/misc/non_compliant_lexer.py.exp: -------------------------------------------------------------------------------- 1 | SyntaxError 2 | SyntaxError 3 | SyntaxError 4 | SyntaxError 5 | NotImplementedError 6 | -------------------------------------------------------------------------------- /tests/net_inet/uasyncio_open_connection.py.exp: -------------------------------------------------------------------------------- 1 | write GET 2 | read response 3 | read: b'HTTP/1.1 200 OK' 4 | close 5 | done 6 | -------------------------------------------------------------------------------- /tests/pyb/timer_callback.py.exp: -------------------------------------------------------------------------------- 1 | before cb1 2 | cb1 3 | before cb2 4 | cb2 5 | before cb1 6 | cb1 7 | before cb4 8 | cb4 3 9 | -------------------------------------------------------------------------------- /examples/SDdatalogger/cardreader.py: -------------------------------------------------------------------------------- 1 | # cardread.py 2 | # This is called when the user enters cardreader mode. It does nothing. 3 | -------------------------------------------------------------------------------- /ports/esp32/boards/GENERIC/mpconfigboard.h: -------------------------------------------------------------------------------- 1 | #define MICROPY_HW_BOARD_NAME "ESP32 module" 2 | #define MICROPY_HW_MCU_NAME "ESP32" 3 | -------------------------------------------------------------------------------- /ports/zephyr/boards/reel_board.conf: -------------------------------------------------------------------------------- 1 | # Flash drivers 2 | CONFIG_FLASH=y 3 | CONFIG_FLASH_MAP=y 4 | CONFIG_MPU_ALLOW_FLASH_WRITE=y 5 | -------------------------------------------------------------------------------- /tests/basics/async_for.py.exp: -------------------------------------------------------------------------------- 1 | init 2 | aiter 3 | anext 4 | a 5 | anext 6 | b 7 | anext 8 | c 9 | anext 10 | finished 11 | -------------------------------------------------------------------------------- /tests/basics/dict_iterator.py: -------------------------------------------------------------------------------- 1 | d = {1: 2, 3: 4} 2 | els = [] 3 | for i in d: 4 | els.append((i, d[i])) 5 | print(sorted(els)) 6 | -------------------------------------------------------------------------------- /tests/basics/set_copy.py: -------------------------------------------------------------------------------- 1 | s = {1, 2, 3, 4} 2 | t = s.copy() 3 | s.add(5) 4 | t.add(7) 5 | for i in s, t: 6 | print(sorted(i)) 7 | -------------------------------------------------------------------------------- /tests/basics/tuple_slice.py: -------------------------------------------------------------------------------- 1 | # tuple slicing 2 | 3 | x = (1, 2, 3 * 4) 4 | 5 | print(x[1:]) 6 | print(x[:-1]) 7 | print(x[2:3]) 8 | -------------------------------------------------------------------------------- /tests/feature_check/coverage.py: -------------------------------------------------------------------------------- 1 | try: 2 | extra_coverage 3 | print("coverage") 4 | except NameError: 5 | print("no") 6 | -------------------------------------------------------------------------------- /tests/feature_check/uio_module.py: -------------------------------------------------------------------------------- 1 | try: 2 | import uio 3 | 4 | print("uio") 5 | except ImportError: 6 | print("no") 7 | -------------------------------------------------------------------------------- /tests/import/import_pkg3.py: -------------------------------------------------------------------------------- 1 | from pkg import mod 2 | 3 | print(mod.foo()) 4 | 5 | import pkg.mod 6 | 7 | print(mod is pkg.mod) 8 | -------------------------------------------------------------------------------- /tests/inlineasm/asmrettype.py.exp: -------------------------------------------------------------------------------- 1 | 1 2 | False True 3 | 0 0x20000000 0x40000000 -0x80000000 4 | 0 0x20000000 0x40000000 0x80000000 5 | -------------------------------------------------------------------------------- /tests/micropython/extreme_exc.py.exp: -------------------------------------------------------------------------------- 1 | Exception() 2 | TypeError( 3 | TypeError( 4 | RuntimeError( 5 | Exception('my exception',) 6 | -------------------------------------------------------------------------------- /tests/micropython/heapalloc.py.exp: -------------------------------------------------------------------------------- 1 | 0 2 | 1 3 | 0 4 | 0 2 5 | 0 0 6 | 1 7 | 3 8 | 1 9 | 1 2 10 | 1 1 11 | 1 2 3 4 10 12 | -------------------------------------------------------------------------------- /tests/multi_net/uasyncio_tcp_client_rst.py.exp: -------------------------------------------------------------------------------- 1 | --- instance0 --- 2 | b'GET / HTTP' 3 | OSError 104 4 | --- instance1 --- 5 | 6 | -------------------------------------------------------------------------------- /tests/pyb/switch.py: -------------------------------------------------------------------------------- 1 | from pyb import Switch 2 | 3 | sw = Switch() 4 | print(sw()) 5 | sw.callback(print) 6 | sw.callback(None) 7 | -------------------------------------------------------------------------------- /tests/unicode/file1.py: -------------------------------------------------------------------------------- 1 | f = open("unicode/data/utf-8_1.txt", encoding="utf-8") 2 | l = f.readline() 3 | print(l) 4 | print(len(l)) 5 | -------------------------------------------------------------------------------- /docs/pyboard/tutorial/img/skin_amp_1.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/gengyong/micropython/HEAD/docs/pyboard/tutorial/img/skin_amp_1.jpg -------------------------------------------------------------------------------- /docs/pyboard/tutorial/img/skin_amp_2.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/gengyong/micropython/HEAD/docs/pyboard/tutorial/img/skin_amp_2.jpg -------------------------------------------------------------------------------- /docs/pyboard/tutorial/img/skin_lcd_1.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/gengyong/micropython/HEAD/docs/pyboard/tutorial/img/skin_lcd_1.jpg -------------------------------------------------------------------------------- /docs/pyboard/tutorial/img/skin_lcd_2.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/gengyong/micropython/HEAD/docs/pyboard/tutorial/img/skin_lcd_2.jpg -------------------------------------------------------------------------------- /drivers/README.md: -------------------------------------------------------------------------------- 1 | This directory contains drivers for specific hardware. The drivers are 2 | intended to work across multiple ports. 3 | -------------------------------------------------------------------------------- /ports/esp32/boards/GENERIC_OTA/mpconfigboard.h: -------------------------------------------------------------------------------- 1 | #define MICROPY_HW_BOARD_NAME "4MB/OTA module" 2 | #define MICROPY_HW_MCU_NAME "ESP32" 3 | -------------------------------------------------------------------------------- /ports/nrf/boards/microbit/modules/iters.h: -------------------------------------------------------------------------------- 1 | 2 | #include "py/runtime.h" 3 | 4 | mp_obj_t microbit_repeat_iterator(mp_obj_t iterable); 5 | -------------------------------------------------------------------------------- /ports/stm32/boards/PYBD_SF2/manifest.py: -------------------------------------------------------------------------------- 1 | include("$(PORT_DIR)/boards/manifest.py") 2 | include("$(MPY_DIR)/extmod/webrepl/manifest.py") 3 | -------------------------------------------------------------------------------- /ports/unix/variants/coverage/frzmpy/frzqstr.py: -------------------------------------------------------------------------------- 1 | # Checks for regression on MP_QSTR_NULL 2 | def returns_NULL(): 3 | return "NULL" 4 | -------------------------------------------------------------------------------- /ports/zephyr/boards/disco_l475_iot1.conf: -------------------------------------------------------------------------------- 1 | # Sensors 2 | CONFIG_HTS221=y 3 | CONFIG_LIS3MDL=y 4 | CONFIG_LPS22HB=y 5 | CONFIG_LSM6DSL=y 6 | -------------------------------------------------------------------------------- /tests/basics/builtin_abs.py: -------------------------------------------------------------------------------- 1 | # test builtin abs 2 | 3 | print(abs(False)) 4 | print(abs(True)) 5 | print(abs(1)) 6 | print(abs(-1)) 7 | -------------------------------------------------------------------------------- /tests/basics/object1.py: -------------------------------------------------------------------------------- 1 | # test builtin object() 2 | 3 | # creation 4 | object() 5 | 6 | # printing 7 | print(repr(object())[:7]) 8 | -------------------------------------------------------------------------------- /tests/basics/tuple_count.py: -------------------------------------------------------------------------------- 1 | a = (1, 2, 3) 2 | a = a + a + a 3 | b = (0, 0, a, 0, a, 0) 4 | print(a.count(2)) 5 | print(b.count(a)) 6 | -------------------------------------------------------------------------------- /tests/import/import2a.py: -------------------------------------------------------------------------------- 1 | from import1b import var 2 | 3 | print(var) 4 | 5 | from import1b import var as var2 6 | 7 | print(var2) 8 | -------------------------------------------------------------------------------- /tests/import/pkg3/mod2.py: -------------------------------------------------------------------------------- 1 | print("mod2 __name__:", __name__) 2 | print("in mod2") 3 | 4 | 5 | def foo(): 6 | print("mod2.foo()") 7 | -------------------------------------------------------------------------------- /tests/micropython/viper_ptr32_load.py.exp: -------------------------------------------------------------------------------- 1 | bytearray(b'\x12\x12\x12\x124444') 2 | 0x12121212 0x34343434 3 | 0x46464646 4 | 0x46464646 5 | -------------------------------------------------------------------------------- /tools/mpremote/mpremote.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env python3 2 | 3 | import sys 4 | from mpremote import main 5 | 6 | sys.exit(main.main()) 7 | -------------------------------------------------------------------------------- /docs/pyboard/tutorial/img/pyboard_servo.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/gengyong/micropython/HEAD/docs/pyboard/tutorial/img/pyboard_servo.jpg -------------------------------------------------------------------------------- /ports/esp32/boards/SIL_WESP32/mpconfigboard.h: -------------------------------------------------------------------------------- 1 | #define MICROPY_HW_BOARD_NAME "Silicognition wESP32" 2 | #define MICROPY_HW_MCU_NAME "ESP32" 3 | -------------------------------------------------------------------------------- /ports/esp8266/boards/GENERIC_1M/mpconfigboard.mk: -------------------------------------------------------------------------------- 1 | LD_FILES = boards/esp8266_1m.ld 2 | 3 | MICROPY_PY_BTREE ?= 1 4 | MICROPY_VFS_LFS2 ?= 1 5 | -------------------------------------------------------------------------------- /ports/esp8266/boards/GENERIC_512K/mpconfigboard.mk: -------------------------------------------------------------------------------- 1 | LD_FILES = boards/esp8266_512k.ld 2 | 3 | FROZEN_MANIFEST ?= $(BOARD_DIR)/manifest.py 4 | -------------------------------------------------------------------------------- /ports/unix/variants/dev/manifest.py: -------------------------------------------------------------------------------- 1 | include("$(PORT_DIR)/variants/manifest.py") 2 | 3 | include("$(MPY_DIR)/extmod/uasyncio/manifest.py") 4 | -------------------------------------------------------------------------------- /ports/unix/variants/standard/mpconfigvariant.mk: -------------------------------------------------------------------------------- 1 | # This is the default variant when you `make` the Unix port. 2 | 3 | PROG ?= micropython 4 | -------------------------------------------------------------------------------- /tests/basics/assign_expr_syntaxerror.py.exp: -------------------------------------------------------------------------------- 1 | SyntaxError 2 | SyntaxError 3 | [1, 2, 3, 4] 4 | [-1] 5 | [[0, 0], [1, 1]] 6 | [[0, 1], [0, 1]] 7 | -------------------------------------------------------------------------------- /tests/basics/try_finally_continue.py.exp: -------------------------------------------------------------------------------- 1 | 4 0 2 | continue 3 | 4 1 4 | continue 5 | 4 2 6 | continue 7 | 4 3 8 | continue 9 | None 10 | -------------------------------------------------------------------------------- /tests/feature_check/byteorder.py: -------------------------------------------------------------------------------- 1 | try: 2 | import usys as sys 3 | except ImportError: 4 | import sys 5 | 6 | print(sys.byteorder) 7 | -------------------------------------------------------------------------------- /tests/stress/recursion.py: -------------------------------------------------------------------------------- 1 | def foo(): 2 | foo() 3 | 4 | 5 | try: 6 | foo() 7 | except RuntimeError: 8 | print("RuntimeError") 9 | -------------------------------------------------------------------------------- /ports/cc3200/bootmgr/relocator/relocator.bin: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/gengyong/micropython/HEAD/ports/cc3200/bootmgr/relocator/relocator.bin -------------------------------------------------------------------------------- /ports/esp32/boards/GENERIC_SPIRAM/mpconfigboard.h: -------------------------------------------------------------------------------- 1 | #define MICROPY_HW_BOARD_NAME "ESP32 module (spiram)" 2 | #define MICROPY_HW_MCU_NAME "ESP32" 3 | -------------------------------------------------------------------------------- /ports/esp32/boards/M5STACK_ATOM/mpconfigboard.h: -------------------------------------------------------------------------------- 1 | #define MICROPY_HW_BOARD_NAME "M5Stack ATOM" 2 | #define MICROPY_HW_MCU_NAME "ESP32-PICO-D4" 3 | -------------------------------------------------------------------------------- /ports/mimxrt/boards/MIMXRT1060_EVK/board.md: -------------------------------------------------------------------------------- 1 | The port for this board is experimental. It is made based on the documentation, but was not yet tested. -------------------------------------------------------------------------------- /ports/mimxrt/boards/MIMXRT1064_EVK/board.md: -------------------------------------------------------------------------------- 1 | The port for this board is experimental. It is made based on the documentation, but was not yet tested. -------------------------------------------------------------------------------- /ports/samd/boards/ADAFRUIT_TRINKET_M0/mpconfigboard.h: -------------------------------------------------------------------------------- 1 | #define MICROPY_HW_BOARD_NAME "Trinket M0" 2 | #define MICROPY_HW_MCU_NAME "SAMD21E18A" 3 | -------------------------------------------------------------------------------- /ports/unix/variants/coverage/frzmpy/frzmpy_pkg1/__init__.py: -------------------------------------------------------------------------------- 1 | # test frozen package with __init__.py 2 | print('frzmpy_pkg1.__init__') 3 | x = 1 4 | -------------------------------------------------------------------------------- /ports/unix/variants/coverage/frzstr/frzstr_pkg1/__init__.py: -------------------------------------------------------------------------------- 1 | # test frozen package with __init__.py 2 | print('frzstr_pkg1.__init__') 3 | x = 1 4 | -------------------------------------------------------------------------------- /ports/unix/variants/manifest.py: -------------------------------------------------------------------------------- 1 | freeze_as_mpy('$(MPY_DIR)/tools', 'upip.py') 2 | freeze_as_mpy('$(MPY_DIR)/tools', 'upip_utarfile.py', opt=3) 3 | -------------------------------------------------------------------------------- /ports/xt804/src/mpy_handle_error.h: -------------------------------------------------------------------------------- 1 | 2 | #ifndef MPY_XT804_MPY_HANDLE_ERROR_H_ 3 | #define MPY_XT804_MPY_HANDLE_ERROR_H_ 4 | 5 | 6 | #endif 7 | -------------------------------------------------------------------------------- /tests/basics/builtin_hex_intbig.py: -------------------------------------------------------------------------------- 1 | # test builtin hex function 2 | 3 | print(hex(12345678901234567890)) 4 | print(hex(0x12345678901234567890)) 5 | -------------------------------------------------------------------------------- /tests/basics/builtin_oct_intbig.py: -------------------------------------------------------------------------------- 1 | # test builtin oct function 2 | 3 | print(oct(12345678901234567890)) 4 | print(oct(0o12345670123456701234)) 5 | -------------------------------------------------------------------------------- /tests/basics/dict_copy.py: -------------------------------------------------------------------------------- 1 | a = {i: 2*i for i in range(100)} 2 | b = a.copy() 3 | for i in range(100): 4 | print(i, b[i]) 5 | print(len(b)) 6 | -------------------------------------------------------------------------------- /tests/basics/errno1.py.exp: -------------------------------------------------------------------------------- 1 | 2 | [Errno ] EIO 3 | [Errno ] EIO: details 4 | ( , 'details', 'more details') 5 | 9999 6 | uerrno 7 | -------------------------------------------------------------------------------- /tests/basics/list_copy.py: -------------------------------------------------------------------------------- 1 | # list copy tests 2 | a = [1, 2, []] 3 | b = a.copy() 4 | a[-1].append(1) 5 | a.append(4) 6 | print(a) 7 | print(b) 8 | -------------------------------------------------------------------------------- /tests/basics/set_specialmeth.py: -------------------------------------------------------------------------------- 1 | # set object with special methods 2 | 3 | s = {1, 2} 4 | print(s.__contains__(1)) 5 | print(s.__contains__(3)) 6 | -------------------------------------------------------------------------------- /tests/extmod/machine1.py.exp: -------------------------------------------------------------------------------- 1 | <8-bit memory> 2 | ValueError 3 | ValueError 4 | TypeError 5 | TypeError 6 | TypeError 7 | TypeError 8 | TypeError 9 | -------------------------------------------------------------------------------- /tests/extmod/ucryptolib_aes128_ecb_enc.py.exp: -------------------------------------------------------------------------------- 1 | b'Iz\xfe9\x17\xac\xa4X\x12\x04\x10\xf5K~#\xc7\xac;\xf9\xc6E\xa8\xca~\xf1\xee\xd3f%\xf1\x8d\xfe' 2 | -------------------------------------------------------------------------------- /tests/float/list_index.py: -------------------------------------------------------------------------------- 1 | x = [1, 2] 2 | 3 | print(x[1]) 4 | 5 | try: 6 | print(x[1.0]) 7 | except TypeError: 8 | print("TypeError") 9 | -------------------------------------------------------------------------------- /tests/micropython/viper_binop_comp_uint.py.exp: -------------------------------------------------------------------------------- 1 | 1 1 == <= >= 2 | 2 1 > >= != 3 | 1 2 < <= != 4 | 2 -1 < <= != 5 | -2 1 > >= != 6 | -2 -1 < <= != 7 | -------------------------------------------------------------------------------- /tests/unicode/unicode_chr.py: -------------------------------------------------------------------------------- 1 | # test builtin chr with unicode characters 2 | 3 | print(chr(945)) 4 | print(chr(0x800)) 5 | print(chr(0x10000)) 6 | -------------------------------------------------------------------------------- /tests/unicode/unicode_str_format.py: -------------------------------------------------------------------------------- 1 | # test handling of unicode chars in format strings 2 | 3 | print("α".format()) 4 | print("{α}".format(α=1)) 5 | -------------------------------------------------------------------------------- /tests/wipy/wlan/server.py.exp: -------------------------------------------------------------------------------- 1 | True 2 | True 3 | True 4 | True 5 | True 6 | True 7 | True 8 | Exception 9 | Exception 10 | Exception 11 | -------------------------------------------------------------------------------- /docs/pyboard/tutorial/img/pyboard_usb_micro.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/gengyong/micropython/HEAD/docs/pyboard/tutorial/img/pyboard_usb_micro.jpg -------------------------------------------------------------------------------- /ports/nrf/boards/pca10000/pins.csv: -------------------------------------------------------------------------------- 1 | UART_RTS,P8 2 | UART_TX,P9 3 | UART_CTS,P10 4 | UART_RX,P11 5 | LED_RED,P21 6 | LED_GREEN,P22 7 | LED_BLUE,P23 8 | -------------------------------------------------------------------------------- /ports/nrf/boards/s132_6.1.1.ld: -------------------------------------------------------------------------------- 1 | /* GNU linker script for s132 SoftDevice version 6.1.1 */ 2 | 3 | _sd_size = 0x00026000; 4 | _sd_ram = 0x000039c0; 5 | -------------------------------------------------------------------------------- /ports/nrf/boards/s140_6.1.1.ld: -------------------------------------------------------------------------------- 1 | /* GNU linker script for s140 SoftDevice version 6.1.1 */ 2 | 3 | _sd_size = 0x00026000; 4 | _sd_ram = 0x000039c0; 5 | -------------------------------------------------------------------------------- /ports/xt804/src/repl_uart0.h: -------------------------------------------------------------------------------- 1 | 2 | #ifndef HEADER_HAL_UART0_REPL_H 3 | #define HEADER_HAL_UART0_REPL_H 4 | 5 | void repl_listen_uart0(); 6 | 7 | #endif -------------------------------------------------------------------------------- /tests/basics/int_big_pow.py: -------------------------------------------------------------------------------- 1 | # test bignum power 2 | 3 | i = 1 << 65 4 | 5 | print(0 ** i) 6 | print(i ** 0) 7 | print(i ** 1) 8 | print(i ** 2) 9 | -------------------------------------------------------------------------------- /tests/basics/int_big_unary.py: -------------------------------------------------------------------------------- 1 | # test bignum unary operations 2 | 3 | i = 1 << 65 4 | 5 | print(bool(i)) 6 | print(+i) 7 | print(-i) 8 | print(~i) 9 | -------------------------------------------------------------------------------- /tests/extmod/machine_pinbase.py.exp: -------------------------------------------------------------------------------- 1 | __init__ 2 | value: None 3 | 1 4 | value: None 5 | 0 6 | value: None 7 | 1 8 | value: 1 9 | value: 0 10 | -------------------------------------------------------------------------------- /tests/extmod/uasyncio_cancel_fair2.py.exp: -------------------------------------------------------------------------------- 1 | sleep a 2 | sleep b 0 3 | sleep b 1 4 | sleep b 2 5 | cancelled a 6 | done b 0 7 | done b 1 8 | done b 2 9 | -------------------------------------------------------------------------------- /tests/extmod/uasyncio_exception.py.exp: -------------------------------------------------------------------------------- 1 | main start 2 | ValueError 1 3 | main start 4 | task start 5 | ValueError 2 6 | main start 7 | ValueError 3 8 | -------------------------------------------------------------------------------- /tests/feature_check/async_check.py: -------------------------------------------------------------------------------- 1 | # check if async/await keywords are supported 2 | async def foo(): 3 | await 1 4 | 5 | 6 | print("async") 7 | -------------------------------------------------------------------------------- /tests/float/int_power.py: -------------------------------------------------------------------------------- 1 | # negative power should produce float 2 | 3 | x = 2 4 | print(x ** -2) 5 | 6 | x = 3 7 | x **= -2 8 | print("%.5f" % x) 9 | -------------------------------------------------------------------------------- /tests/import/import_pkg7.py: -------------------------------------------------------------------------------- 1 | # This tests ... relative imports as used in pkg7 and imports beyond package root 2 | import pkg7.subpkg1.subpkg2.mod3 3 | -------------------------------------------------------------------------------- /tests/inlineasm/asmsum.py.exp: -------------------------------------------------------------------------------- 1 | array('l', [100, 200, 300, 400]) 1000 2 | array('b', [10, 20, 30, 40, 50, 60, 70, 80]) 360 3 | b'\x01\x02\x03\x04' 10 4 | -------------------------------------------------------------------------------- /tests/micropython/heapalloc_fail_list.py.exp: -------------------------------------------------------------------------------- 1 | MemoryError: list index 2 | MemoryError: list get slice 3 | MemoryError: list extend slice 4 | [1, 2] 5 | -------------------------------------------------------------------------------- /tests/micropython/viper_binop_comp_imm.py.exp: -------------------------------------------------------------------------------- 1 | True False False False 2 | False True False False 3 | False False True False 4 | False False False True 5 | -------------------------------------------------------------------------------- /docs/esp8266/img/adafruit_products_pinoutstop.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/gengyong/micropython/HEAD/docs/esp8266/img/adafruit_products_pinoutstop.jpg -------------------------------------------------------------------------------- /ports/esp32/boards/GENERIC_D2WD/mpconfigboard.h: -------------------------------------------------------------------------------- 1 | #define MICROPY_HW_BOARD_NAME "Generic ESP32-D2WD module" 2 | #define MICROPY_HW_MCU_NAME "ESP32-D2WD" 3 | -------------------------------------------------------------------------------- /ports/esp32/boards/UM_TINYS2/board.md: -------------------------------------------------------------------------------- 1 | The following files are daily firmware for the TinyS2. This firmware is compiled 2 | using ESP-IDF v4.3 or later. 3 | -------------------------------------------------------------------------------- /ports/esp32/boards/sdkconfig.usb: -------------------------------------------------------------------------------- 1 | CONFIG_USB_ENABLED=y 2 | CONFIG_USB_CDC_ENABLED=y 3 | CONFIG_USB_CDC_RX_BUFSIZE=256 4 | CONFIG_USB_CDC_TX_BUFSIZE=256 5 | -------------------------------------------------------------------------------- /ports/samd/boards/SAMD21_XPLAINED_PRO/mpconfigboard.h: -------------------------------------------------------------------------------- 1 | #define MICROPY_HW_BOARD_NAME "SAMD21-XPLAINED-PRO" 2 | #define MICROPY_HW_MCU_NAME "SAMD21J18A" 3 | -------------------------------------------------------------------------------- /ports/unix/variants/coverage/frzmpy/frzmpy_pkg2/mod.py: -------------------------------------------------------------------------------- 1 | # test frozen package without __init__.py 2 | print('frzmpy_pkg2.mod') 3 | class Foo: 4 | x = 1 5 | -------------------------------------------------------------------------------- /ports/unix/variants/coverage/frzstr/frzstr_pkg2/mod.py: -------------------------------------------------------------------------------- 1 | # test frozen package without __init__.py 2 | print('frzstr_pkg2.mod') 3 | class Foo: 4 | x = 1 5 | -------------------------------------------------------------------------------- /ports/windows/.gitignore: -------------------------------------------------------------------------------- 1 | *.user 2 | *.*sdf 3 | *.suo 4 | *.sln 5 | *.exe 6 | *.pdb 7 | *.ilk 8 | *.filters 9 | /build/* 10 | .vs/* 11 | *.VC.*db 12 | -------------------------------------------------------------------------------- /tests/basics/for_return.py: -------------------------------------------------------------------------------- 1 | # test returning from within a for loop 2 | 3 | def f(): 4 | for i in [1, 2, 3]: 5 | return i 6 | 7 | print(f()) 8 | -------------------------------------------------------------------------------- /tests/basics/list_count.py: -------------------------------------------------------------------------------- 1 | # list count tests 2 | a = [1, 2, 3] 3 | a = a + a + a 4 | b = [0, 0, a, 0, a, 0] 5 | print(a.count(2)) 6 | print(b.count(a)) 7 | -------------------------------------------------------------------------------- /tests/basics/set_update.py: -------------------------------------------------------------------------------- 1 | s = {1} 2 | s.update() 3 | print(s) 4 | s.update([2]) 5 | print(sorted(s)) 6 | s.update([1,3], [2,2,4]) 7 | print(sorted(s)) 8 | -------------------------------------------------------------------------------- /tests/extmod/machine_pulse.py.exp: -------------------------------------------------------------------------------- 1 | value: 1 2 | value: 0 3 | 4 | value: 1 5 | value: 0 6 | value: 1 7 | 8 | -2 9 | -1 10 | -------------------------------------------------------------------------------- /tests/feature_check/int_big.py: -------------------------------------------------------------------------------- 1 | # Check whether arbitrary-precision integers (MPZ) are supported 2 | print(1000000000000000000000000000000000000000000000) 3 | -------------------------------------------------------------------------------- /tests/float/true_value.py: -------------------------------------------------------------------------------- 1 | # Test true-ish value handling 2 | 3 | if not 0.0: 4 | print("float 0") 5 | 6 | if not 0 + 0j: 7 | print("complex 0") 8 | -------------------------------------------------------------------------------- /tests/micropython/heapalloc_traceback.py.exp: -------------------------------------------------------------------------------- 1 | StopIteration 2 | Traceback (most recent call last): 3 | File , line 25, in test 4 | StopIteration: 5 | 6 | -------------------------------------------------------------------------------- /tests/micropython/viper_binop_multi_comp.py.exp: -------------------------------------------------------------------------------- 1 | 1 == 1 2 | 2 > 1 3 | 2 >= 1 4 | 2 != 1 5 | 1 < 2 6 | 2 > -1 7 | 2 >= -1 8 | 2 != -1 9 | -2 <= 1 10 | -------------------------------------------------------------------------------- /tests/stress/dict_create.py: -------------------------------------------------------------------------------- 1 | # create a large dictionary 2 | 3 | d = {} 4 | x = 1 5 | while x < 1000: 6 | d[x] = x 7 | x += 1 8 | print(d[500]) 9 | -------------------------------------------------------------------------------- /tests/wipy/skipped/rtc_irq.py.exp: -------------------------------------------------------------------------------- 1 | True 2 | True 3 | True 4 | True 5 | True 6 | True 7 | True 8 | True 9 | True 10 | Exception 11 | Exception 12 | -------------------------------------------------------------------------------- /tools/mpremote/pyproject.toml: -------------------------------------------------------------------------------- 1 | [build-system] 2 | requires = [ 3 | "setuptools>=42", 4 | "wheel" 5 | ] 6 | build-backend = "setuptools.build_meta" 7 | -------------------------------------------------------------------------------- /drivers/cc3000/inc/inet_pton.h: -------------------------------------------------------------------------------- 1 | #ifndef __INET_PTON_H 2 | #define __INET_PTON_H 3 | int inet_pton(int, const char *, void *); 4 | #endif /* __INET_PTON_H */ 5 | -------------------------------------------------------------------------------- /ports/esp32/boards/UM_FEATHERS2/board.md: -------------------------------------------------------------------------------- 1 | The following files are daily firmware for the FeatherS2. This firmware is 2 | compiled using ESP-IDF v4.3 or later. 3 | -------------------------------------------------------------------------------- /ports/samd/boards/ADAFRUIT_FEATHER_M0_EXPRESS/mpconfigboard.h: -------------------------------------------------------------------------------- 1 | #define MICROPY_HW_BOARD_NAME "Feather M0 Express" 2 | #define MICROPY_HW_MCU_NAME "SAMD21G18A" 3 | -------------------------------------------------------------------------------- /ports/stm32/boards/ESPRUINO_PICO/deploy.md: -------------------------------------------------------------------------------- 1 | For programming an Espruino Pico see the "Advanced Reflashing" section of [this page](http://www.espruino.com/Pico). 2 | -------------------------------------------------------------------------------- /tests/basics/bytes_gen.py: -------------------------------------------------------------------------------- 1 | # construct a bytes object from a generator 2 | def gen(): 3 | for i in range(4): 4 | yield i 5 | print(bytes(gen())) 6 | -------------------------------------------------------------------------------- /tests/basics/string_cr_conversion.py: -------------------------------------------------------------------------------- 1 | # this file has CR line endings to test lexer's conversion of them to LF # in triple quoted strings print(repr("""abc def""")) -------------------------------------------------------------------------------- /tests/basics/string_upperlow.py: -------------------------------------------------------------------------------- 1 | print("".lower()) 2 | print(" t\tn\nr\rv\vf\f".upper()) 3 | print(" T E S T".lower()) 4 | print("*@a1b2cabc_[]/\\".upper()) 5 | -------------------------------------------------------------------------------- /tests/cmdline/repl_micropyinspect.py: -------------------------------------------------------------------------------- 1 | # cmdline: cmdline/repl_micropyinspect 2 | # setting MICROPYINSPECT environment variable before program exit triggers REPL 3 | -------------------------------------------------------------------------------- /tests/extmod/ussl_keycert.py.exp: -------------------------------------------------------------------------------- 1 | ValueError('invalid key',) 2 | TypeError("can't convert 'NoneType' object to str implicitly",) 3 | ValueError('invalid cert',) 4 | -------------------------------------------------------------------------------- /tests/micropython/opt_level_lineno.py.exp: -------------------------------------------------------------------------------- 1 | Traceback (most recent call last): 2 | File "", line 1, in 3 | NameError: name 'xyz' isn't defined 4 | -------------------------------------------------------------------------------- /ports/esp32/boards/UM_FEATHERS2NEO/board.md: -------------------------------------------------------------------------------- 1 | The following files are daily firmware for the FeatherS2 Neo. This firmware is 2 | compiled using ESP-IDF v4.3 or later. 3 | -------------------------------------------------------------------------------- /ports/esp32/modules/flashbdev.py: -------------------------------------------------------------------------------- 1 | from esp32 import Partition 2 | 3 | bdev = Partition.find(Partition.TYPE_DATA, label="vfs") 4 | bdev = bdev[0] if bdev else None 5 | -------------------------------------------------------------------------------- /ports/minimal/mphalport.h: -------------------------------------------------------------------------------- 1 | static inline mp_uint_t mp_hal_ticks_ms(void) { 2 | return 0; 3 | } 4 | static inline void mp_hal_set_interrupt_char(char c) { 5 | } 6 | -------------------------------------------------------------------------------- /tests/basics/andor.py: -------------------------------------------------------------------------------- 1 | # test short circuit expressions outside if conditionals 2 | print(() or 1) 3 | print((1,) or 1) 4 | print(() and 1) 5 | print((1,) and 1) 6 | -------------------------------------------------------------------------------- /tests/basics/assign1.py: -------------------------------------------------------------------------------- 1 | # test assignments 2 | 3 | a = 1 4 | print(a) 5 | 6 | a = b = 2 7 | print(a, b) 8 | 9 | a = b = c = 3 10 | print(a, b, c) 11 | 12 | -------------------------------------------------------------------------------- /tests/basics/async_await2.py.exp: -------------------------------------------------------------------------------- 1 | wait value: 1 2 | return from send: message from wait(1) 3 | wait got back: message from main 4 | x = 100 5 | got StopIteration 6 | -------------------------------------------------------------------------------- /tests/basics/bytes_construct_intbig.py: -------------------------------------------------------------------------------- 1 | # test construction of bytes from different objects 2 | 3 | # long ints 4 | print(ord(bytes([14953042807679334000 & 0xff]))) 5 | -------------------------------------------------------------------------------- /tests/basics/int2.py: -------------------------------------------------------------------------------- 1 | # test basic int operations 2 | 3 | # test conversion of bool on RHS of binary op 4 | a = False 5 | print(1 + a) 6 | a = True 7 | print(1 + a) 8 | -------------------------------------------------------------------------------- /tests/extmod/uasyncio_wait_task.py.exp: -------------------------------------------------------------------------------- 1 | start 2 | task 1 3 | task 2 4 | ---- 5 | start 6 | hello 7 | world 8 | took 40 40 9 | task_raise 10 | ValueError 11 | -------------------------------------------------------------------------------- /tests/float/builtin_float_round_intbig.py: -------------------------------------------------------------------------------- 1 | # test round() with floats that return large integers 2 | 3 | for x in (-1e25, 1e25): 4 | print("%.3g" % round(x)) 5 | -------------------------------------------------------------------------------- /tests/io/file_stdio.py: -------------------------------------------------------------------------------- 1 | try: 2 | import usys as sys 3 | except ImportError: 4 | import sys 5 | 6 | print(sys.stdin.fileno()) 7 | print(sys.stdout.fileno()) 8 | -------------------------------------------------------------------------------- /tests/net_inet/test_tls_sites.py.exp: -------------------------------------------------------------------------------- 1 | google.com ok 2 | www.google.com ok 3 | micropython.org ok 4 | pypi.org ok 5 | api.telegram.org ok 6 | api.pushbullet.com ok 7 | -------------------------------------------------------------------------------- /ports/samd/boards/ADAFRUIT_TRINKET_M0/mpconfigboard.mk: -------------------------------------------------------------------------------- 1 | MCU_SERIES = SAMD21 2 | CMSIS_MCU = SAMD21E18A 3 | LD_FILES = boards/samd21x18a.ld sections.ld 4 | TEXT0 = 0x2000 5 | -------------------------------------------------------------------------------- /ports/samd/boards/SAMD21_XPLAINED_PRO/mpconfigboard.mk: -------------------------------------------------------------------------------- 1 | MCU_SERIES = SAMD21 2 | CMSIS_MCU = SAMD21J18A 3 | LD_FILES = boards/samd21x18a.ld sections.ld 4 | TEXT0 = 0x2000 5 | -------------------------------------------------------------------------------- /tests/basics/string_fstring_debug.py.exp: -------------------------------------------------------------------------------- 1 | x=1 2 | x=00000001 3 | a x=1 b 2 c 4 | a x=00000001 b 2 c 5 | a f() + g("foo") + h()=15 b 6 | a f() + g("foo") + h()=0000000f b 7 | -------------------------------------------------------------------------------- /tests/esp32/esp32_idf_heap_info.py.exp: -------------------------------------------------------------------------------- 1 | HEAP_DATA >2: True 2 | HEAP_DATA [True, True, True, True] 3 | HEAP_EXEC >2: True 4 | HEAP_EXEC [True, True, True, True] 5 | [] 6 | -------------------------------------------------------------------------------- /tests/qemu-arm/native_test.py: -------------------------------------------------------------------------------- 1 | import native_frozen_align 2 | 3 | native_frozen_align.native_x(1) 4 | native_frozen_align.native_y(2) 5 | native_frozen_align.native_z(3) 6 | -------------------------------------------------------------------------------- /docs/pyboard/tutorial/img/fading_leds_breadboard_fritzing.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/gengyong/micropython/HEAD/docs/pyboard/tutorial/img/fading_leds_breadboard_fritzing.png -------------------------------------------------------------------------------- /ports/esp32/boards/LOLIN_S2_PICO/manifest.py: -------------------------------------------------------------------------------- 1 | include("$(PORT_DIR)/boards/manifest.py") 2 | freeze("./modules") 3 | 4 | freeze("$(MPY_DIR)/drivers/display", "ssd1306.py") 5 | -------------------------------------------------------------------------------- /ports/esp32/boards/UM_FEATHERS2/manifest.py: -------------------------------------------------------------------------------- 1 | include("$(PORT_DIR)/boards/manifest.py") 2 | freeze("$(PORT_DIR)/boards/UM_TINYPICO/modules", "dotstar.py") 3 | freeze("modules") 4 | -------------------------------------------------------------------------------- /ports/xt804/src/utf8_map.h: -------------------------------------------------------------------------------- 1 | 2 | #ifndef MPY_XT804_UTF8_MAPPING_H 3 | #define MPY_XT804_UTF8_MAPPING_H 4 | 5 | extern const unsigned char SizeOfUTF8Code[256]; 6 | 7 | #endif 8 | -------------------------------------------------------------------------------- /tests/basics/builtin_hash_gen.py: -------------------------------------------------------------------------------- 1 | # test builtin hash function, on generators 2 | 3 | def gen(): 4 | yield 5 | 6 | print(type(hash(gen))) 7 | print(type(hash(gen()))) 8 | -------------------------------------------------------------------------------- /tests/basics/bytes_add_bytearray.py: -------------------------------------------------------------------------------- 1 | # test bytes + bytearray 2 | 3 | print(b"123" + bytearray(2)) 4 | 5 | print(b"" + bytearray(1)) # LHS is empty but can't be optimised 6 | -------------------------------------------------------------------------------- /tests/extmod/uasyncio_cancel_wait_on_finished.py.exp: -------------------------------------------------------------------------------- 1 | main sleep 2 | sleep_task sleep 3 | wait_task wait 4 | main sleep 5 | sleep_task wake 6 | main wait 7 | CancelledError() 8 | -------------------------------------------------------------------------------- /tests/extmod/ussl_basic.py.exp: -------------------------------------------------------------------------------- 1 | wrap_socket: OSError(-256, 'CONN_LOST') 2 | <_SSLSocket 3 | 4 4 | b'' 5 | read: OSError(-261,) 6 | read: OSError(9,) 7 | write: OSError(9,) 8 | -------------------------------------------------------------------------------- /tests/feature_check/native_check.py: -------------------------------------------------------------------------------- 1 | # this test for the availability of native emitter 2 | @micropython.native 3 | def f(): 4 | pass 5 | 6 | 7 | f() 8 | print("native") 9 | -------------------------------------------------------------------------------- /tests/feature_check/repl_emacs_check.py.exp: -------------------------------------------------------------------------------- 1 | MicroPython \.\+ version 2 | Use \.\+ 3 | >>> # Check for emacs keys in REPL 4 | >>> t = \.\+ 5 | >>> t == 2 6 | True 7 | >>> 8 | -------------------------------------------------------------------------------- /tests/import/import_pkg5.py: -------------------------------------------------------------------------------- 1 | # This tests relative imports as used in pkg3 2 | import pkg3 3 | import pkg3.mod1 4 | import pkg3.subpkg1.mod1 5 | 6 | pkg3.subpkg1.mod1.foo() 7 | -------------------------------------------------------------------------------- /tests/internal_bench/loop_count-1-range.py: -------------------------------------------------------------------------------- 1 | import bench 2 | 3 | 4 | def test(num): 5 | for i in range(num): 6 | pass 7 | 8 | 9 | bench.run(test) 10 | -------------------------------------------------------------------------------- /tests/micropython/viper_addr.py.exp: -------------------------------------------------------------------------------- 1 | 2 | 3 | bytearray(b'0000') 4 | bytearray(b'1111') 5 | bytearray(b'2222') 6 | bytearray(b'2233') 7 | 10 8 | -------------------------------------------------------------------------------- /tests/micropython/viper_ptr16_store.py.exp: -------------------------------------------------------------------------------- 1 | bytearray(b'\x00\x00\x00\x00') 2 | bytearray(b'BB\x00\x00') 3 | bytearray(b'BBCC') 4 | bytearray(b'DDDD') 5 | bytearray(b'EEEE') 6 | -------------------------------------------------------------------------------- /lib/libm_dbl/lgamma.c: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | double __lgamma_r(double, int*); 4 | 5 | double lgamma(double x) { 6 | int sign; 7 | return __lgamma_r(x, &sign); 8 | } 9 | -------------------------------------------------------------------------------- /lib/libm_dbl/log10.c: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | static const double _M_LN10 = 2.302585092994046; 4 | 5 | double log10(double x) { 6 | return log(x) / (double)_M_LN10; 7 | } 8 | -------------------------------------------------------------------------------- /ports/samd/boards/ADAFRUIT_FEATHER_M0_EXPRESS/mpconfigboard.mk: -------------------------------------------------------------------------------- 1 | MCU_SERIES = SAMD21 2 | CMSIS_MCU = SAMD21G18A 3 | LD_FILES = boards/samd21x18a.ld sections.ld 4 | TEXT0 = 0x2000 5 | -------------------------------------------------------------------------------- /ports/samd/boards/ADAFRUIT_ITSYBITSY_M4_EXPRESS/mpconfigboard.mk: -------------------------------------------------------------------------------- 1 | MCU_SERIES = SAMD51 2 | CMSIS_MCU = SAMD51G19A 3 | LD_FILES = boards/samd51g19a.ld sections.ld 4 | TEXT0 = 0x4000 5 | -------------------------------------------------------------------------------- /ports/unix/variants/nanbox/mpconfigvariant.mk: -------------------------------------------------------------------------------- 1 | # build interpreter with nan-boxing as object model (object repr D) 2 | PROG = micropython-nanbox 3 | 4 | MICROPY_FORCE_32BIT = 1 5 | -------------------------------------------------------------------------------- /ports/xt804/src/hal_uart0_core.h: -------------------------------------------------------------------------------- 1 | 2 | #ifndef HEADER_HAL_UART0_CORE_H 3 | #define HEADER_HAL_UART0_CORE_H 4 | 5 | void HAL_UART0_Init(); 6 | void HAL_UART0_DeInit(); 7 | 8 | #endif -------------------------------------------------------------------------------- /tests/basics/builtin_pow.py: -------------------------------------------------------------------------------- 1 | # test builtin pow() with integral values 2 | # 2 arg version 3 | 4 | print(pow(0, 1)) 5 | print(pow(1, 0)) 6 | print(pow(-2, 3)) 7 | print(pow(3, 8)) 8 | -------------------------------------------------------------------------------- /tests/basics/builtin_round.py: -------------------------------------------------------------------------------- 1 | # test round() with integral values 2 | 3 | tests = [ 4 | False, True, 5 | 0, 1, -1, 10 6 | ] 7 | for t in tests: 8 | print(round(t)) 9 | -------------------------------------------------------------------------------- /tests/basics/dict_specialmeth.py: -------------------------------------------------------------------------------- 1 | # dict object with special methods 2 | 3 | d = {} 4 | d.__setitem__('2', 'two') 5 | print(d.__getitem__('2')) 6 | d.__delitem__('2') 7 | print(d) 8 | -------------------------------------------------------------------------------- /tests/basics/fun2.py: -------------------------------------------------------------------------------- 1 | # calling a function from a function 2 | 3 | def f(x): 4 | print(x + 1) 5 | 6 | def g(x): 7 | f(2 * x) 8 | f(4 * x) 9 | 10 | g(3) 11 | -------------------------------------------------------------------------------- /tests/basics/module2.py: -------------------------------------------------------------------------------- 1 | # uPy behaviour only: builtin modules are read-only 2 | import usys 3 | try: 4 | usys.x = 1 5 | except AttributeError: 6 | print("AttributeError") 7 | -------------------------------------------------------------------------------- /tests/cmdline/repl_basic.py.exp: -------------------------------------------------------------------------------- 1 | MicroPython \.\+ version 2 | Use \.\+ 3 | >>> # basic REPL tests 4 | >>> print(1) 5 | 1 6 | >>> print(1) 7 | 1 8 | >>> 2 9 | 2 10 | >>> 11 | -------------------------------------------------------------------------------- /tests/extmod/uzlib_decompio_gz.py.exp: -------------------------------------------------------------------------------- 1 | 16 2 | b'h' 3 | 18 4 | b'el' 5 | b'lo' 6 | 31 7 | b'' 8 | b'' 9 | 31 10 | b'hello' 11 | b'hello' 12 | ValueError 13 | OSError(22,) 14 | -------------------------------------------------------------------------------- /tests/feature_check/repl_words_move_check.py.exp: -------------------------------------------------------------------------------- 1 | MicroPython \.\+ version 2 | Use \.\+ 3 | >>> # Check for emacs keys in REPL 4 | >>> t = \.\+ 5 | >>> t == 2 6 | True 7 | >>> 8 | -------------------------------------------------------------------------------- /tests/float/string_format_modulo3.py: -------------------------------------------------------------------------------- 1 | # uPy and CPython outputs differ for the following 2 | print("%.1g" % -9.9) # round up 'g' with '-' sign 3 | print("%.2g" % 99.9) # round up 4 | -------------------------------------------------------------------------------- /tests/internal_bench/loop_count-4-while_down_gt.py: -------------------------------------------------------------------------------- 1 | import bench 2 | 3 | 4 | def test(num): 5 | while num > 0: 6 | num -= 1 7 | 8 | 9 | bench.run(test) 10 | -------------------------------------------------------------------------------- /tests/internal_bench/loop_count-5-while_down_ne.py: -------------------------------------------------------------------------------- 1 | import bench 2 | 3 | 4 | def test(num): 5 | while num != 0: 6 | num -= 1 7 | 8 | 9 | bench.run(test) 10 | -------------------------------------------------------------------------------- /tests/io/file_readinto_len.py.exp: -------------------------------------------------------------------------------- 1 | 8 2 | bytearray(b'longer l\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00') 3 | 4 4 | bytearray(b'long') 5 | -------------------------------------------------------------------------------- /tests/micropython/decorator.py: -------------------------------------------------------------------------------- 1 | # test micropython-specific decorators 2 | 3 | 4 | @micropython.bytecode 5 | def f(): 6 | return "bytecode" 7 | 8 | 9 | print(f()) 10 | -------------------------------------------------------------------------------- /tests/micropython/viper_ptr8_store.py.exp: -------------------------------------------------------------------------------- 1 | bytearray(b'\x00\x00\x00\x00') 2 | bytearray(b')\x00\x00\x00') 3 | bytearray(b')*\x00\x00') 4 | bytearray(b'++++') 5 | bytearray(b',,,,') 6 | -------------------------------------------------------------------------------- /drivers/cc3000/inc/inet_ntop.h: -------------------------------------------------------------------------------- 1 | #ifndef __INET_NTOP_H 2 | #define __INET_NTOP_H 3 | char *inet_ntop(int af, const void *addr, char *buf, size_t size); 4 | #endif /* __INET_NTOP_H */ 5 | -------------------------------------------------------------------------------- /ports/qemu-arm/mphalport.h: -------------------------------------------------------------------------------- 1 | #include 2 | #include "uart.h" 3 | 4 | #define mp_hal_stdin_rx_chr() (0) 5 | #define mp_hal_stdout_tx_strn_cooked(s, l) uart_tx_strn((s), (l)) 6 | -------------------------------------------------------------------------------- /ports/zephyr/boards/frdm_kw41z.conf: -------------------------------------------------------------------------------- 1 | # Hardware features 2 | CONFIG_I2C=y 3 | 4 | # Sensor drivers 5 | CONFIG_FXOS8700=y 6 | CONFIG_FXOS8700_MODE_HYBRID=y 7 | CONFIG_FXOS8700_TEMP=y 8 | -------------------------------------------------------------------------------- /tests/basics/assign_expr.py.exp: -------------------------------------------------------------------------------- 1 | 4 2 | True 3 | 2 4 | 4 5 5 | 5 6 | 1 5 5 7 | 5 8 | any True 9 | 8 10 | 123 11 | any True 12 | 8 13 | [(1, 0), (2, 2), (3, 6), (4, 12)] 14 | 4 15 | -------------------------------------------------------------------------------- /tests/basics/fun3.py: -------------------------------------------------------------------------------- 1 | # function with large number of arguments 2 | 3 | def fun(a, b, c, d, e, f, g): 4 | return a + b + c * d + e * f * g 5 | 6 | print(fun(1, 2, 3, 4, 5, 6, 7)) 7 | -------------------------------------------------------------------------------- /tests/basics/ifexpr.py: -------------------------------------------------------------------------------- 1 | # test if-expressions 2 | 3 | print(1 if 0 else 2) 4 | print(3 if 1 else 4) 5 | 6 | def f(x): 7 | print('a' if x else 'b') 8 | f([]) 9 | f([1]) 10 | -------------------------------------------------------------------------------- /tests/basics/string_crlf_conversion.py: -------------------------------------------------------------------------------- 1 | # this file has CRLF line endings to test lexer's conversion of them to LF 2 | # in triple quoted strings 3 | print(repr("""abc 4 | def""")) 5 | -------------------------------------------------------------------------------- /tests/import/import_pkg7.py.exp: -------------------------------------------------------------------------------- 1 | pkg __name__: pkg7 2 | pkg __name__: pkg7.subpkg1 3 | pkg __name__: pkg7.subpkg1.subpkg2 4 | mod1 5 | mod2 6 | mod1.foo 7 | mod2.bar 8 | ImportError 9 | -------------------------------------------------------------------------------- /tests/internal_bench/loop_count-2-range_iter.py: -------------------------------------------------------------------------------- 1 | import bench 2 | 3 | 4 | def test(num): 5 | for i in iter(range(num)): 6 | pass 7 | 8 | 9 | bench.run(test) 10 | -------------------------------------------------------------------------------- /tests/internal_bench/loop_count-3-while_up.py: -------------------------------------------------------------------------------- 1 | import bench 2 | 3 | 4 | def test(num): 5 | i = 0 6 | while i < num: 7 | i += 1 8 | 9 | 10 | bench.run(test) 11 | -------------------------------------------------------------------------------- /tests/internal_bench/var-1-constant.py: -------------------------------------------------------------------------------- 1 | import bench 2 | 3 | 4 | def test(num): 5 | i = 0 6 | while i < 20000000: 7 | i += 1 8 | 9 | 10 | bench.run(test) 11 | -------------------------------------------------------------------------------- /tests/micropython/heapalloc_exc_compressed_emg_exc.py.exp: -------------------------------------------------------------------------------- 1 | NameError name 'name' isn't defined 2 | KeyError pop from an empty set 3 | name 'name' isn't defined 4 | pop from an empty set 5 | -------------------------------------------------------------------------------- /tests/multi_net/uasyncio_tcp_readexactly.py.exp: -------------------------------------------------------------------------------- 1 | --- instance0 --- 2 | server running 3 | close 4 | done 5 | --- instance1 --- 6 | b'ab' 7 | b'' 8 | b'c' 9 | EOFError 10 | b'' 11 | -------------------------------------------------------------------------------- /tests/stress/dict_copy.py: -------------------------------------------------------------------------------- 1 | # copying a large dictionary 2 | 3 | a = {i: 2 * i for i in range(1000)} 4 | b = a.copy() 5 | for i in range(1000): 6 | print(i, b[i]) 7 | print(len(b)) 8 | -------------------------------------------------------------------------------- /examples/hwapi/hwconfig_z_frdm_k64f.py: -------------------------------------------------------------------------------- 1 | from machine import Pin, Signal 2 | 3 | # Freescale/NXP FRDM-K64F board 4 | # Blue LED on port B, pin 21 5 | LED = Signal(("GPIO_1", 21), Pin.OUT) 6 | -------------------------------------------------------------------------------- /lib/mbedtls_errors/do-test.sh: -------------------------------------------------------------------------------- 1 | #! /bin/bash -e 2 | # Generate mp_mbedtls_errors.c and build the tester app 3 | ./do-mp.sh 4 | cc -o tester -I../mbedtls/include/ mp_mbedtls_errors.c tester.c 5 | -------------------------------------------------------------------------------- /lib/uzlib/tinf.h: -------------------------------------------------------------------------------- 1 | /* Compatibility header for the original tinf lib/older versions of uzlib. 2 | Note: may be removed in the future, please migrate to uzlib.h. */ 3 | #include "uzlib.h" 4 | -------------------------------------------------------------------------------- /ports/esp32/boards/GENERIC_OTA/sdkconfig.board: -------------------------------------------------------------------------------- 1 | CONFIG_BOOTLOADER_APP_ROLLBACK_ENABLE=y 2 | CONFIG_PARTITION_TABLE_CUSTOM=y 3 | CONFIG_PARTITION_TABLE_CUSTOM_FILENAME="partitions-ota.csv" 4 | -------------------------------------------------------------------------------- /ports/stm32/boards/LIMIFROG/mpconfigboard.mk: -------------------------------------------------------------------------------- 1 | MCU_SERIES = l4 2 | CMSIS_MCU = STM32L476xx 3 | AF_FILE = boards/stm32l476_af.csv 4 | LD_FILES = boards/stm32l476xe.ld boards/common_basic.ld 5 | -------------------------------------------------------------------------------- /ports/zephyr/boards/nucleo_wb55rg.conf: -------------------------------------------------------------------------------- 1 | CONFIG_CONSOLE_SUBSYS=n 2 | CONFIG_NETWORKING=n 3 | CONFIG_BT=y 4 | CONFIG_BT_DEVICE_NAME_DYNAMIC=y 5 | CONFIG_BT_PERIPHERAL=y 6 | CONFIG_BT_CENTRAL=y 7 | -------------------------------------------------------------------------------- /shared/README.md: -------------------------------------------------------------------------------- 1 | This directory contains libraries, utilities and helper code developed 2 | specifically for this project. The code is intended to be portable and 3 | usable by any port. 4 | -------------------------------------------------------------------------------- /tests/basics/bytes_compare_bytearray.py: -------------------------------------------------------------------------------- 1 | print(b"123" == bytearray(b"123")) 2 | print(b'123' < bytearray(b"124")) 3 | print(b'123' > bytearray(b"122")) 4 | print(bytearray(b"23") in b"1234") 5 | -------------------------------------------------------------------------------- /tests/basics/list_insert.py: -------------------------------------------------------------------------------- 1 | a = [1, 2, 3] 2 | a.insert(1, 42) 3 | print(a) 4 | a.insert(-1, -1) 5 | print(a) 6 | a.insert(99, 99) 7 | print(a) 8 | a.insert(-99, -99) 9 | print(a) 10 | -------------------------------------------------------------------------------- /tests/basics/string_endswith_upy.py: -------------------------------------------------------------------------------- 1 | # MicroPython doesn't support tuple argument 2 | 3 | try: 4 | "foobar".endswith(("bar", "sth")) 5 | except TypeError: 6 | print("TypeError") 7 | -------------------------------------------------------------------------------- /tests/basics/string_startswith_upy.py: -------------------------------------------------------------------------------- 1 | # MicroPython doesn't support tuple argument 2 | 3 | try: 4 | "foobar".startswith(("foo", "sth")) 5 | except TypeError: 6 | print("TypeError") 7 | -------------------------------------------------------------------------------- /tests/cmdline/repl_inspect.py.exp: -------------------------------------------------------------------------------- 1 | test 2 | MicroPython \.\+ version 3 | Use \.\+ 4 | >>> # cmdline: -i -c print("test") 5 | >>> # -c option combined with -i option results in REPL 6 | >>> 7 | -------------------------------------------------------------------------------- /tests/extmod/vfs_fat_ramdisklarge.py.exp: -------------------------------------------------------------------------------- 1 | statvfs: (32768, 32768, 131054, 131053, 131053, 0, 0, 0, 0, 255) 2 | statvfs: (32768, 32768, 131054, 131052, 131052, 0, 0, 0, 0, 255) 3 | test file 4 | -------------------------------------------------------------------------------- /tests/float/complex1_intbig.py: -------------------------------------------------------------------------------- 1 | # test basic complex number functionality 2 | 3 | # convert bignum to complex on rhs 4 | ans = 1j + (1 << 70) 5 | print("%.5g %.5g" % (ans.real, ans.imag)) 6 | -------------------------------------------------------------------------------- /tests/import/gen_context.py: -------------------------------------------------------------------------------- 1 | import gen_context2 2 | 3 | GLOBAL = "GLOBAL" 4 | 5 | 6 | def gen(): 7 | print(GLOBAL) 8 | yield 1 9 | 10 | 11 | gen_context2.call(gen()) 12 | -------------------------------------------------------------------------------- /tests/micropython/const_error.py.exp: -------------------------------------------------------------------------------- 1 | SyntaxError 2 | SyntaxError 3 | SyntaxError 4 | SyntaxError 5 | SyntaxError 6 | SyntaxError 7 | SyntaxError 8 | SyntaxError 9 | SyntaxError 10 | -------------------------------------------------------------------------------- /tests/micropython/viper_binop_arith_uint.py.exp: -------------------------------------------------------------------------------- 1 | add 2 | 3 3 3 | 4294967293 4294967293 4 | sub 5 | 4294967295 1 6 | 1 4294967295 7 | mul 8 | 6 6 9 | 4294967290 4294967290 10 | 6 6 11 | -------------------------------------------------------------------------------- /tests/stress/list_sort.py: -------------------------------------------------------------------------------- 1 | # test large list sorting (should not stack overflow) 2 | l = list(range(2000)) 3 | l.sort() 4 | print(l[0], l[-1]) 5 | l.sort(reverse=True) 6 | print(l[0], l[-1]) 7 | -------------------------------------------------------------------------------- /ports/cc3200/boards/WIPY/deploy.md: -------------------------------------------------------------------------------- 1 | The following files are firmware for the WiPy. The zip file contains mcuimg.bin 2 | which should be copied via ftp to the /flash/sys directory on the WiPy. 3 | -------------------------------------------------------------------------------- /ports/samd/README.md: -------------------------------------------------------------------------------- 1 | Port of MicroPython to Microchip SAMD MCUs 2 | ========================================== 3 | 4 | Supports SAMD21 and SAMD51. 5 | 6 | Features: 7 | - REPL over USB VCP 8 | -------------------------------------------------------------------------------- /ports/stm32/boards/LEGO_HUB_NO6/hub_display.h: -------------------------------------------------------------------------------- 1 | void hub_display_on(void); 2 | void hub_display_off(void); 3 | void hub_display_update(void); 4 | void hub_display_set(uint8_t led, uint16_t value); 5 | -------------------------------------------------------------------------------- /tests/basics/bytearray_decode.py: -------------------------------------------------------------------------------- 1 | try: 2 | print(bytearray(b'').decode()) 3 | print(bytearray(b'abc').decode()) 4 | except AttributeError: 5 | print("SKIP") 6 | raise SystemExit 7 | -------------------------------------------------------------------------------- /tests/extmod/uctypes_array_assign_native_le.py.exp: -------------------------------------------------------------------------------- 1 | 0x11 2 | 0x2233 3 | 0x4455 4 | 0x66778899 5 | True 6 | 0x11 7 | 0x1122 8 | 0x11223344 9 | IndexError 10 | TypeError 11 | TypeError 12 | -------------------------------------------------------------------------------- /tests/extmod/vfs_fat_fileio1.py.exp: -------------------------------------------------------------------------------- 1 | 2 | True 3 | True 4 | True 5 | True 6 | hello!world! 7 | 12 8 | h 9 | e 10 | o 11 | d 12 | True 13 | [('foo_dir', 16384, 0, 0)] 14 | -------------------------------------------------------------------------------- /tests/feature_check/reverse_ops.py: -------------------------------------------------------------------------------- 1 | class Foo: 2 | def __radd__(self, other): 3 | pass 4 | 5 | 6 | try: 7 | 5 + Foo() 8 | except TypeError: 9 | print("TypeError") 10 | -------------------------------------------------------------------------------- /tests/float/lexer.py: -------------------------------------------------------------------------------- 1 | # since black code formatter does not allow leading decimal point with nothing 2 | # before it, we need to test it explicitly 3 | 4 | # fmt: off 5 | print(.1) 6 | # fmt: on 7 | -------------------------------------------------------------------------------- /tests/internal_bench/bytealloc-1-bytes_n.py: -------------------------------------------------------------------------------- 1 | import bench 2 | 3 | 4 | def test(num): 5 | for i in iter(range(num // 1000)): 6 | bytes(10000) 7 | 8 | 9 | bench.run(test) 10 | -------------------------------------------------------------------------------- /tests/internal_bench/bytealloc-2-repeat.py: -------------------------------------------------------------------------------- 1 | import bench 2 | 3 | 4 | def test(num): 5 | for i in iter(range(num // 1000)): 6 | b"\0" * 10000 7 | 8 | 9 | bench.run(test) 10 | -------------------------------------------------------------------------------- /tests/internal_bench/var-4-arg.py: -------------------------------------------------------------------------------- 1 | import bench 2 | 3 | 4 | def test(num): 5 | i = 0 6 | while i < num: 7 | i += 1 8 | 9 | 10 | bench.run(lambda n: test(20000000)) 11 | -------------------------------------------------------------------------------- /tests/micropython/native_const_intbig.py: -------------------------------------------------------------------------------- 1 | # check loading constants 2 | 3 | 4 | @micropython.native 5 | def f(): 6 | return 123456789012345678901234567890 7 | 8 | 9 | print(f()) 10 | -------------------------------------------------------------------------------- /tests/micropython/viper_const_intbig.py: -------------------------------------------------------------------------------- 1 | # check loading constants 2 | 3 | 4 | @micropython.viper 5 | def f(): 6 | return 123456789012345678901234567890 7 | 8 | 9 | print(f()) 10 | -------------------------------------------------------------------------------- /lib/libm_dbl/__signbit.c: -------------------------------------------------------------------------------- 1 | #include "libm.h" 2 | 3 | int __signbitd(double x) 4 | { 5 | union { 6 | double d; 7 | uint64_t i; 8 | } y = { x }; 9 | return y.i>>63; 10 | } 11 | 12 | 13 | -------------------------------------------------------------------------------- /ports/unix/variants/fast/mpconfigvariant.mk: -------------------------------------------------------------------------------- 1 | # build synthetically fast interpreter for benchmarking 2 | 3 | COPT += -fno-crossjumping -O2 4 | 5 | PROG = micropython-fast 6 | 7 | FROZEN_MANIFEST = 8 | -------------------------------------------------------------------------------- /tests/basics/builtin_hex.py: -------------------------------------------------------------------------------- 1 | # test builtin hex function 2 | 3 | print(hex(1)) 4 | print(hex(-1)) 5 | print(hex(15)) 6 | print(hex(-15)) 7 | 8 | print(hex(12345)) 9 | print(hex(0x12345)) 10 | -------------------------------------------------------------------------------- /tests/basics/builtin_oct.py: -------------------------------------------------------------------------------- 1 | # test builtin oct function 2 | 3 | print(oct(1)) 4 | print(oct(-1)) 5 | print(oct(15)) 6 | print(oct(-15)) 7 | 8 | print(oct(12345)) 9 | print(oct(0o12345)) 10 | -------------------------------------------------------------------------------- /tests/basics/bytes_add.py: -------------------------------------------------------------------------------- 1 | # test bytes + other 2 | 3 | print(b"123" + b"456") 4 | 5 | print(b"123" + b"") # RHS is empty, can be optimised 6 | print(b"" + b"123") # LHS is empty, can be optimised 7 | -------------------------------------------------------------------------------- /tests/basics/class_misc.py: -------------------------------------------------------------------------------- 1 | # converting user instance to buffer 2 | class C: 3 | pass 4 | 5 | c = C() 6 | try: 7 | d = bytes(c) 8 | except TypeError: 9 | print('TypeError') 10 | -------------------------------------------------------------------------------- /tests/basics/int_big_cmp.py: -------------------------------------------------------------------------------- 1 | # test bignum comparisons 2 | 3 | i = 1 << 65 4 | 5 | print(i == 0) 6 | print(i != 0) 7 | print(i < 0) 8 | print(i > 0) 9 | print(i <= 0) 10 | print(i >= 0) 11 | -------------------------------------------------------------------------------- /tests/basics/set_containment.py: -------------------------------------------------------------------------------- 1 | for i in 1, 2: 2 | for o in {}, {1}, {2}: 3 | print("{} in {}: {}".format(i, o, i in o)) 4 | print("{} not in {}: {}".format(i, o, i not in o)) 5 | -------------------------------------------------------------------------------- /tests/basics/slice_intbig.py: -------------------------------------------------------------------------------- 1 | # test slicing when arguments are bignums 2 | 3 | print(list(range(10))[(1<<66)>>65:]) 4 | print(list(range(10))[:(1<<66)>>65]) 5 | print(list(range(10))[::(1<<66)>>65]) 6 | -------------------------------------------------------------------------------- /tests/basics/try1.py: -------------------------------------------------------------------------------- 1 | # basic exceptions 2 | x = 1 3 | try: 4 | x.a() 5 | except: 6 | print(x) 7 | 8 | try: 9 | raise IndexError 10 | except IndexError: 11 | print("caught") 12 | -------------------------------------------------------------------------------- /tests/inlineasm/asmpushpop.py: -------------------------------------------------------------------------------- 1 | @micropython.asm_thumb 2 | def f(r0, r1, r2): 3 | push({r0}) 4 | push({r1, r2}) 5 | pop({r0}) 6 | pop({r1, r2}) 7 | 8 | 9 | print(f(0, 1, 2)) 10 | -------------------------------------------------------------------------------- /tests/internal_bench/bench.py: -------------------------------------------------------------------------------- 1 | import time 2 | 3 | 4 | ITERS = 20000000 5 | 6 | 7 | def run(f): 8 | t = time.time() 9 | f(ITERS) 10 | t = time.time() - t 11 | print(t) 12 | -------------------------------------------------------------------------------- /tests/multi_net/uasyncio_tcp_close_write.py.exp: -------------------------------------------------------------------------------- 1 | --- instance0 --- 2 | server running 3 | read: b'' 4 | close 5 | done 6 | --- instance1 --- 7 | read: b'x' 8 | close 9 | write 10 | OSError 11 | -------------------------------------------------------------------------------- /ports/esp32/boards/UM_TINYS2/sdkconfig.board: -------------------------------------------------------------------------------- 1 | CONFIG_FLASHMODE_QIO=y 2 | CONFIG_ESPTOOLPY_FLASHFREQ_80M=y 3 | CONFIG_USB_AND_UART=y 4 | # LWIP 5 | CONFIG_LWIP_LOCAL_HOSTNAME="UMTinyS2" 6 | # end of LWIP 7 | -------------------------------------------------------------------------------- /ports/mimxrt/boards/manifest.py: -------------------------------------------------------------------------------- 1 | freeze("$(PORT_DIR)/modules") 2 | freeze("$(MPY_DIR)/drivers/onewire") 3 | freeze("$(MPY_DIR)/drivers/dht", "dht.py") 4 | include("$(MPY_DIR)/extmod/uasyncio/manifest.py") 5 | -------------------------------------------------------------------------------- /ports/stm32/boards/PYBD_SF2/board.md: -------------------------------------------------------------------------------- 1 | Firmware can be found in the sections below, which is built daily from the ports/stm32/ directory of MicroPython. Check which model you have by the sticker on the top. 2 | -------------------------------------------------------------------------------- /ports/stm32/boards/PYBD_SF3/board.md: -------------------------------------------------------------------------------- 1 | Firmware can be found in the sections below, which is built daily from the ports/stm32/ directory of MicroPython. Check which model you have by the sticker on the top. 2 | -------------------------------------------------------------------------------- /ports/stm32/boards/PYBD_SF6/board.md: -------------------------------------------------------------------------------- 1 | Firmware can be found in the sections below, which is built daily from the ports/stm32/ directory of MicroPython. Check which model you have by the sticker on the top. 2 | -------------------------------------------------------------------------------- /shared/libc/abort_.c: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | NORETURN void abort_(void); 4 | 5 | NORETURN void abort_(void) { 6 | mp_raise_msg(&mp_type_RuntimeError, MP_ERROR_TEXT("abort() called")); 7 | } 8 | -------------------------------------------------------------------------------- /tests/basics/builtin_zip.py: -------------------------------------------------------------------------------- 1 | try: 2 | zip 3 | set 4 | except NameError: 5 | print("SKIP") 6 | raise SystemExit 7 | 8 | print(list(zip())) 9 | print(list(zip([1], set([2, 3])))) 10 | -------------------------------------------------------------------------------- /tests/basics/closure_namedarg.py: -------------------------------------------------------------------------------- 1 | # test passing named arg to closed-over function 2 | 3 | def f(): 4 | x = 1 5 | def g(z): 6 | print(x, z) 7 | return g 8 | 9 | f()(z=42) 10 | -------------------------------------------------------------------------------- /tests/basics/set_isdisjoint.py: -------------------------------------------------------------------------------- 1 | s = {1, 2, 3, 4} 2 | print(s.isdisjoint({1})) 3 | print(s.isdisjoint([2])) 4 | print(s.isdisjoint([])) 5 | print(s.isdisjoint({7,8,9,10})) 6 | print(s.isdisjoint([7,8,9,1])) 7 | -------------------------------------------------------------------------------- /tests/basics/subclass_native_iter.py: -------------------------------------------------------------------------------- 1 | # test subclassing a native type which can be iterated over 2 | 3 | class mymap(map): 4 | pass 5 | 6 | m = mymap(lambda x: x + 10, range(4)) 7 | print(list(m)) 8 | -------------------------------------------------------------------------------- /tests/internal_bench/func_builtin-1-enum_pos.py: -------------------------------------------------------------------------------- 1 | import bench 2 | 3 | 4 | def test(num): 5 | for i in iter(range(num // 20)): 6 | enumerate([1, 2], 1) 7 | 8 | 9 | bench.run(test) 10 | -------------------------------------------------------------------------------- /tests/internal_bench/var-3-local.py: -------------------------------------------------------------------------------- 1 | import bench 2 | 3 | 4 | def test(num): 5 | ITERS = 20000000 6 | i = 0 7 | while i < ITERS: 8 | i += 1 9 | 10 | 11 | bench.run(test) 12 | -------------------------------------------------------------------------------- /tests/micropython/heapalloc_exc_compressed.py.exp: -------------------------------------------------------------------------------- 1 | NameError name 'name' isn't defined 2 | KeyError pop from an empty set 3 | name 'name' isn't defined 4 | pop from an empty set 5 | NameError 6 | KeyError 7 | -------------------------------------------------------------------------------- /tests/multi_net/uasyncio_tcp_server_client.py.exp: -------------------------------------------------------------------------------- 1 | --- instance0 --- 2 | server running 3 | echo: b'client data' 4 | close 5 | done 6 | --- instance1 --- 7 | write: b'client data' 8 | read: b'client data' 9 | -------------------------------------------------------------------------------- /examples/hwapi/hwconfig_esp8266_esp12.py: -------------------------------------------------------------------------------- 1 | from machine import Pin, Signal 2 | 3 | # ESP12 module as used by many boards 4 | # Blue LED on pin 2, active low (inverted) 5 | LED = Signal(2, Pin.OUT, invert=True) 6 | -------------------------------------------------------------------------------- /lib/README.md: -------------------------------------------------------------------------------- 1 | This directory contains third-party, low-level C libraries and SDKs. 2 | Libraries that do not target any specific platform are generally chosen 3 | based on them being independent and efficient. 4 | -------------------------------------------------------------------------------- /ports/esp32/boards/UM_TINYPICO/sdkconfig.board: -------------------------------------------------------------------------------- 1 | CONFIG_FLASHMODE_QIO=y 2 | CONFIG_ESPTOOLPY_FLASHFREQ_80M=y 3 | CONFIG_SPIRAM_SPEED_80M=y 4 | CONFIG_ESP32_REV_MIN_1=y 5 | CONFIG_LWIP_LOCAL_HOSTNAME="UMTinyPICO" 6 | -------------------------------------------------------------------------------- /ports/esp8266/boards/deploy.md: -------------------------------------------------------------------------------- 1 | Program your board using the esptool.py program as described [the tutorial](http://docs.micropython.org/en/latest/esp8266/esp8266/tutorial/intro.html#deploying-the-firmware). 2 | -------------------------------------------------------------------------------- /ports/rp2/boards/manifest.py: -------------------------------------------------------------------------------- 1 | freeze("$(PORT_DIR)/modules") 2 | freeze("$(MPY_DIR)/drivers/onewire") 3 | include("$(MPY_DIR)/extmod/uasyncio/manifest.py") 4 | include("$(MPY_DIR)/drivers/neopixel/manifest.py") 5 | -------------------------------------------------------------------------------- /ports/zephyr/boards/nucleo_h743zi.conf: -------------------------------------------------------------------------------- 1 | # disable console subsys to get REPL working 2 | CONFIG_CONSOLE_SUBSYS=n 3 | 4 | # flash config 5 | CONFIG_FLASH=y 6 | CONFIG_FLASH_MAP=y 7 | CONFIG_FLASH_PAGE_LAYOUT=y 8 | -------------------------------------------------------------------------------- /tests/basics/builtin_chr.py: -------------------------------------------------------------------------------- 1 | # test builtin chr (whether or not we support unicode) 2 | 3 | print(chr(65)) 4 | 5 | try: 6 | chr(0x110000) 7 | except ValueError: 8 | print("ValueError") 9 | 10 | -------------------------------------------------------------------------------- /tests/basics/for2.py: -------------------------------------------------------------------------------- 1 | i = 'init' 2 | for i in range(0): 3 | pass 4 | print(i) # should not have been modified 5 | 6 | for i in range(10): 7 | pass 8 | print(i) # should be last successful value of loop 9 | -------------------------------------------------------------------------------- /tests/cpydiff/types_float_rounding.py: -------------------------------------------------------------------------------- 1 | """ 2 | categories: Types,float 3 | description: uPy and CPython outputs formats may differ 4 | cause: Unknown 5 | workaround: Unknown 6 | """ 7 | print("%.1g" % -9.9) 8 | -------------------------------------------------------------------------------- /tests/cpydiff/types_str_formatsubscr.py: -------------------------------------------------------------------------------- 1 | """ 2 | categories: Types,str 3 | description: Attributes/subscr not implemented 4 | cause: Unknown 5 | workaround: Unknown 6 | """ 7 | print("{a[0]}".format(a=[1, 2])) 8 | -------------------------------------------------------------------------------- /tests/internal_bench/loop_count-5.1-while_down_ne_localvar.py: -------------------------------------------------------------------------------- 1 | import bench 2 | 3 | 4 | def test(num): 5 | zero = 0 6 | while num != zero: 7 | num -= 1 8 | 9 | 10 | bench.run(test) 11 | -------------------------------------------------------------------------------- /tests/internal_bench/var-2-global.py: -------------------------------------------------------------------------------- 1 | import bench 2 | 3 | ITERS = 20000000 4 | 5 | 6 | def test(num): 7 | i = 0 8 | while i < ITERS: 9 | i += 1 10 | 11 | 12 | bench.run(test) 13 | -------------------------------------------------------------------------------- /tests/micropython/viper_ptr32_store.py.exp: -------------------------------------------------------------------------------- 1 | bytearray(b'\x00\x00\x00\x00\x00\x00\x00\x00') 2 | bytearray(b'BBBB\x00\x00\x00\x00') 3 | bytearray(b'BBBBCCCC') 4 | bytearray(b'DDDDDDDD') 5 | bytearray(b'EEEEEEEE') 6 | -------------------------------------------------------------------------------- /examples/micropython.py: -------------------------------------------------------------------------------- 1 | # micropython module placeholder for CPython 2 | 3 | # Dummy function decorators 4 | 5 | 6 | def nodecor(x): 7 | return x 8 | 9 | 10 | bytecode = native = viper = nodecor 11 | -------------------------------------------------------------------------------- /ports/esp32/boards/LOLIN_S2_MINI/sdkconfig.board: -------------------------------------------------------------------------------- 1 | CONFIG_FLASHMODE_QIO=y 2 | CONFIG_ESPTOOLPY_FLASHFREQ_80M=y 3 | CONFIG_USB_AND_UART=y 4 | # LWIP 5 | CONFIG_LWIP_LOCAL_HOSTNAME="LOLIN_S2_MINI" 6 | # end of LWIP 7 | -------------------------------------------------------------------------------- /ports/esp32/boards/LOLIN_S2_PICO/sdkconfig.board: -------------------------------------------------------------------------------- 1 | CONFIG_FLASHMODE_QIO=y 2 | CONFIG_ESPTOOLPY_FLASHFREQ_80M=y 3 | CONFIG_USB_AND_UART=y 4 | # LWIP 5 | CONFIG_LWIP_LOCAL_HOSTNAME="LOLIN_S2_PICO" 6 | # end of LWIP 7 | -------------------------------------------------------------------------------- /ports/esp32/boards/M5STACK_ATOM/sdkconfig.board: -------------------------------------------------------------------------------- 1 | CONFIG_FLASHMODE_QIO=y 2 | CONFIG_ESPTOOLPY_FLASHFREQ_80M=y 3 | CONFIG_SPIRAM_SPEED_80M=y 4 | CONFIG_ESP32_REV_MIN_1=y 5 | CONFIG_LWIP_LOCAL_HOSTNAME="M5StackATOM" 6 | -------------------------------------------------------------------------------- /ports/esp8266/boards/GENERIC/mpconfigboard.mk: -------------------------------------------------------------------------------- 1 | LD_FILES = boards/esp8266_2m.ld 2 | 3 | MICROPY_PY_BTREE ?= 1 4 | MICROPY_VFS_FAT ?= 1 5 | MICROPY_VFS_LFS2 ?= 1 6 | 7 | FROZEN_MANIFEST ?= $(BOARD_DIR)/manifest.py 8 | -------------------------------------------------------------------------------- /tests/basics/builtin_filter.py: -------------------------------------------------------------------------------- 1 | try: 2 | filter 3 | except: 4 | print("SKIP") 5 | raise SystemExit 6 | 7 | print(list(filter(lambda x: x & 1, range(-3, 4)))) 8 | print(list(filter(None, range(-3, 4)))) 9 | -------------------------------------------------------------------------------- /tests/basics/iter_of_iter.py: -------------------------------------------------------------------------------- 1 | i = iter(iter((1, 2, 3))) 2 | print(list(i)) 3 | i = iter(iter([1, 2, 3])) 4 | print(list(i)) 5 | i = iter(iter({1:2, 3:4, 5:6})) 6 | print(sorted(i)) 7 | # set, see set_iter_of_iter.py 8 | -------------------------------------------------------------------------------- /tests/cmdline/repl_autocomplete.py: -------------------------------------------------------------------------------- 1 | # tests for autocompletion 2 | impo sys 3 | not_exist.  4 | not_exist  5 | x = '123' 6 | 1, x.isdi () 7 | i = str 8 | i.lowe ('ABC') 9 | None.  10 | -------------------------------------------------------------------------------- /tests/cpydiff/core_fstring_raw.py: -------------------------------------------------------------------------------- 1 | """ 2 | categories: Core 3 | description: Raw f-strings are not supported 4 | cause: MicroPython is optimised for code space. 5 | workaround: Unknown 6 | """ 7 | 8 | rf"hello" 9 | -------------------------------------------------------------------------------- /tests/cpydiff/types_str_subscrstep.py: -------------------------------------------------------------------------------- 1 | """ 2 | categories: Types,str 3 | description: Subscript with step != 1 is not yet implemented 4 | cause: Unknown 5 | workaround: Unknown 6 | """ 7 | print("abcdefghi"[0:9:2]) 8 | -------------------------------------------------------------------------------- /tests/cpydiff/types_tuple_subscrstep.py: -------------------------------------------------------------------------------- 1 | """ 2 | categories: Types,tuple 3 | description: Tuple load with step != 1 not implemented 4 | cause: Unknown 5 | workaround: Unknown 6 | """ 7 | print((1, 2, 3, 4)[0:4:2]) 8 | -------------------------------------------------------------------------------- /tests/extmod/vfs_lfs_mtime.py.exp: -------------------------------------------------------------------------------- 1 | test 2 | mtime=True 3 | True True 4 | True 5 | True 6 | True 7 | True 8 | mtime=False 9 | True 10 | True 11 | True 12 | mtime=True 13 | True 14 | True 15 | -------------------------------------------------------------------------------- /tests/jni/system_out.py: -------------------------------------------------------------------------------- 1 | try: 2 | import jni 3 | 4 | System = jni.cls("java/lang/System") 5 | except: 6 | print("SKIP") 7 | raise SystemExit 8 | 9 | System.out.println("Hello, Java!") 10 | -------------------------------------------------------------------------------- /tests/micropython/import_mpy_invalid.py.exp: -------------------------------------------------------------------------------- 1 | mod0 ValueError incompatible .mpy file 2 | mod1 ValueError incompatible .mpy file 3 | mod2 ValueError incompatible .mpy file 4 | mod3 ValueError incompatible .mpy file 5 | -------------------------------------------------------------------------------- /tests/micropython/native_with.py.exp: -------------------------------------------------------------------------------- 1 | __init__ 2 | __enter__ 3 | 1 4 | __exit__ None None None 5 | __init__ 6 | __enter__ 7 | 1 8 | __exit__ name 'fail' isn't defined None 9 | NameError 10 | -------------------------------------------------------------------------------- /tests/micropython/viper_misc.py.exp: -------------------------------------------------------------------------------- 1 | 6 2 | 3 3 | 0 4 | Ellipsis 5 | 6 6 | 7 7 | 20 8 | 49994955 9 | 1 1 10 | 1 3 11 | (0, 1, False, True) 12 | (1, 3) 13 | [1, 3] 14 | [1, 3] 15 | OSError(1,) 16 | 1 17 | 1 18 | -------------------------------------------------------------------------------- /tests/micropython/viper_with.py.exp: -------------------------------------------------------------------------------- 1 | __init__ 2 | __enter__ 3 | 1 4 | __exit__ None None None 5 | __init__ 6 | __enter__ 7 | 1 8 | __exit__ name 'fail' isn't defined None 9 | NameError 10 | -------------------------------------------------------------------------------- /tests/pyb/pyb_f411.py: -------------------------------------------------------------------------------- 1 | # test pyb module on F411 MCUs 2 | 3 | import os, pyb 4 | 5 | if not "STM32F411" in os.uname().machine: 6 | print("SKIP") 7 | raise SystemExit 8 | 9 | print(pyb.freq()) 10 | -------------------------------------------------------------------------------- /tests/unicode/unicode_index.py: -------------------------------------------------------------------------------- 1 | print("Привет".find("т")) 2 | print("Привет".find("П")) 3 | print("Привет".rfind("т")) 4 | print("Привет".rfind("П")) 5 | print("Привет".index("т")) 6 | print("Привет".index("П")) 7 | -------------------------------------------------------------------------------- /tests/unicode/unicode_pos.py: -------------------------------------------------------------------------------- 1 | # str methods with explicit start/end pos 2 | print("Привет".startswith("П")) 3 | print("Привет".startswith("р", 1)) 4 | print("абвба".find("а", 1)) 5 | print("абвба".find("а", 1, -1)) 6 | -------------------------------------------------------------------------------- /tests/basics/async_with.py.exp: -------------------------------------------------------------------------------- 1 | enter 2 | body 3 | exit None None 4 | finished 5 | enter 6 | 1 7 | exit error 8 | ValueError 9 | enter 10 | exit 11 | BaseException 12 | -------------------------------------------------------------------------------- /tests/basics/builtin_map.py: -------------------------------------------------------------------------------- 1 | print(list(map(lambda x: x & 1, range(-3, 4)))) 2 | print(list(map(abs, range(-3, 4)))) 3 | print(list(map(tuple, [[i] for i in range(-3, 4)]))) 4 | print(list(map(pow, range(4), range(4)))) 5 | -------------------------------------------------------------------------------- /tests/basics/dict_fromkeys.py: -------------------------------------------------------------------------------- 1 | d = dict.fromkeys([1, 2, 3, 4]) 2 | l = list(d.keys()) 3 | l.sort() 4 | print(l) 5 | 6 | d = dict.fromkeys([1, 2, 3, 4], 42) 7 | l = list(d.values()) 8 | l.sort() 9 | print(l) 10 | -------------------------------------------------------------------------------- /tests/basics/int_divzero.py: -------------------------------------------------------------------------------- 1 | try: 2 | 1 // 0 3 | except ZeroDivisionError: 4 | print("ZeroDivisionError") 5 | 6 | try: 7 | 1 % 0 8 | except ZeroDivisionError: 9 | print("ZeroDivisionError") 10 | -------------------------------------------------------------------------------- /tests/basics/set_intersection.py: -------------------------------------------------------------------------------- 1 | s = {1, 2, 3, 4} 2 | print(sorted(s)) 3 | print(sorted(s.intersection({1, 3}))) 4 | print(sorted(s.intersection([3, 4]))) 5 | 6 | print(s.intersection_update([1])) 7 | print(sorted(s)) 8 | -------------------------------------------------------------------------------- /tests/basics/subclass_native4.py: -------------------------------------------------------------------------------- 1 | # Test calling non-special method inherited from native type 2 | 3 | class mylist(list): 4 | pass 5 | 6 | l = mylist([1, 2, 3]) 7 | print(l) 8 | l.append(10) 9 | print(l) 10 | -------------------------------------------------------------------------------- /tests/cmdline/repl_emacs_keys.py: -------------------------------------------------------------------------------- 1 | # REPL tests of GNU-ish readline navigation 2 | # history buffer navigation 3 | 1 4 | 2 5 | 3 6 |  7 |  8 | # input line motion 9 | t = 12 10 | 'boofar fbar' 11 | -------------------------------------------------------------------------------- /tests/float/int_divzero.py: -------------------------------------------------------------------------------- 1 | try: 2 | 1 / 0 3 | except ZeroDivisionError: 4 | print("ZeroDivisionError") 5 | 6 | try: 7 | 0 ** -1 8 | except ZeroDivisionError: 9 | print("ZeroDivisionError") 10 | -------------------------------------------------------------------------------- /tests/internal_bench/func_builtin-2-enum_kw.py: -------------------------------------------------------------------------------- 1 | import bench 2 | 3 | 4 | def test(num): 5 | for i in iter(range(num // 20)): 6 | enumerate(iterable=[1, 2], start=1) 7 | 8 | 9 | bench.run(test) 10 | -------------------------------------------------------------------------------- /tests/multi_net/uasyncio_tcp_readinto.py.exp: -------------------------------------------------------------------------------- 1 | --- instance0 --- 2 | server running 3 | close 4 | done 5 | --- instance1 --- 6 | 2 7 | bytearray(b'ab') 8 | 1 9 | array('b', [99]) 10 | TypeError 11 | TypeError 12 | -------------------------------------------------------------------------------- /ports/esp8266/boards/GENERIC_512K/board.md: -------------------------------------------------------------------------------- 1 | The following are daily builds of the ESP8266 firmware tailored for modules with 2 | only 512kiB of flash. Certain features are disabled to get the firmware down 3 | to this size. 4 | -------------------------------------------------------------------------------- /ports/esp8266/boards/GENERIC_512K/mpconfigboard.h: -------------------------------------------------------------------------------- 1 | #define MICROPY_HW_BOARD_NAME "ESP module (512K)" 2 | #define MICROPY_HW_MCU_NAME "ESP8266" 3 | 4 | #define MICROPY_ERROR_REPORTING (MICROPY_ERROR_REPORTING_TERSE) 5 | -------------------------------------------------------------------------------- /ports/nrf/boards/nrf9160_1M_256k_secure.ld: -------------------------------------------------------------------------------- 1 | /* Specify the memory areas */ 2 | MEMORY 3 | { 4 | FLASH_TEXT (rx) : ORIGIN = 0x00000000, LENGTH = 32K 5 | RAM (xrw) : ORIGIN = 0x20000000, LENGTH = 64K 6 | } 7 | -------------------------------------------------------------------------------- /ports/rp2/boards/PICO/mpconfigboard.h: -------------------------------------------------------------------------------- 1 | // Board and hardware specific configuration 2 | #define MICROPY_HW_BOARD_NAME "Raspberry Pi Pico" 3 | #define MICROPY_HW_FLASH_STORAGE_BYTES (1408 * 1024) 4 | -------------------------------------------------------------------------------- /tests/basics/builtin_ellipsis.py: -------------------------------------------------------------------------------- 1 | # tests that .../Ellipsis exists 2 | 3 | print(...) 4 | print(Ellipsis) 5 | 6 | print(... == Ellipsis) 7 | 8 | # Test that Ellipsis can be hashed 9 | print(type(hash(Ellipsis))) 10 | -------------------------------------------------------------------------------- /tests/basics/class_inplace_op2.py.exp: -------------------------------------------------------------------------------- 1 | __imul__ 2 | __imatmul__ 3 | __ifloordiv__ 4 | __itruediv__ 5 | __imod__ 6 | __ipow__ 7 | __ior__ 8 | __ixor__ 9 | __iand__ 10 | __ilshift__ 11 | __irshift__ 12 | TypeError 13 | -------------------------------------------------------------------------------- /tests/cmdline/repl_micropyinspect.py.exp: -------------------------------------------------------------------------------- 1 | MicroPython \.\+ version 2 | Use \.\+ 3 | >>> # cmdline: cmdline/repl_micropyinspect 4 | >>> # setting MICROPYINSPECT environment variable before program exit triggers REPL 5 | >>> 6 | -------------------------------------------------------------------------------- /tests/cpydiff/syntax_unicode_nameesc.py: -------------------------------------------------------------------------------- 1 | """ 2 | categories: Syntax,Unicode 3 | description: Unicode name escapes are not implemented 4 | cause: Unknown 5 | workaround: Unknown 6 | """ 7 | print("\N{LATIN SMALL LETTER A}") 8 | -------------------------------------------------------------------------------- /tests/extmod/framebuf_subclass.py.exp: -------------------------------------------------------------------------------- 1 | b'\x02\x01\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x04\x03\x04\x03\x04\x03' 2 | b'\x06\x05\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x08\x07' 3 | TypeError 4 | TypeError 5 | -------------------------------------------------------------------------------- /tests/feature_check/repl_words_move_check.py: -------------------------------------------------------------------------------- 1 | # just check if ctrl+w is supported, because it makes sure that 2 | # both MICROPY_REPL_EMACS_WORDS_MOVE and MICROPY_REPL_EXTRA_WORDS_MOVE are enabled. 3 | t = 1231 4 | t == 1 5 | -------------------------------------------------------------------------------- /tests/internal_bench/func_args-1.1-pos_1.py: -------------------------------------------------------------------------------- 1 | import bench 2 | 3 | 4 | def func(a): 5 | pass 6 | 7 | 8 | def test(num): 9 | for i in iter(range(num)): 10 | func(i) 11 | 12 | 13 | bench.run(test) 14 | -------------------------------------------------------------------------------- /tests/micropython/viper_binop_comp.py.exp: -------------------------------------------------------------------------------- 1 | 1 == 1 2 | 1 <= 1 3 | 1 >= 1 4 | 2 > 1 5 | 2 >= 1 6 | 2 != 1 7 | 1 < 2 8 | 1 <= 2 9 | 1 != 2 10 | 2 > -1 11 | 2 >= -1 12 | 2 != -1 13 | -2 < 1 14 | -2 <= 1 15 | -2 != 1 16 | -------------------------------------------------------------------------------- /tests/thread/thread_exc2.py.exp: -------------------------------------------------------------------------------- 1 | Unhandled exception in thread started by 2 | Traceback (most recent call last): 3 | File \.\+, line 7, in thread_entry 4 | ValueError: 5 | done 6 | -------------------------------------------------------------------------------- /examples/natmod/btree/btree_py.py: -------------------------------------------------------------------------------- 1 | # Implemented in Python to support keyword arguments 2 | def open(stream, *, flags=0, cachesize=0, pagesize=0, minkeypage=0): 3 | return _open(stream, flags, cachesize, pagesize, minkeypage) 4 | -------------------------------------------------------------------------------- /examples/natmod/features2/prod.c: -------------------------------------------------------------------------------- 1 | #include "prod.h" 2 | 3 | float prod_array(int n, float *ar) { 4 | float ans = 1; 5 | for (int i = 0; i < n; ++i) { 6 | ans *= ar[i]; 7 | } 8 | return ans; 9 | } 10 | -------------------------------------------------------------------------------- /ports/minimal/frozentest.py: -------------------------------------------------------------------------------- 1 | print("uPy") 2 | print("a long string that is not interned") 3 | print("a string that has unicode αβγ chars") 4 | print(b"bytes 1234\x01") 5 | print(123456789) 6 | for i in range(4): 7 | print(i) 8 | -------------------------------------------------------------------------------- /ports/nrf/boards/evk_nina_b3/mpconfigboard.mk: -------------------------------------------------------------------------------- 1 | MCU_SERIES = m4 2 | MCU_VARIANT = nrf52 3 | MCU_SUB_VARIANT = nrf52840 4 | SOFTDEV_VERSION = 6.1.1 5 | LD_FILES += boards/nrf52840_1M_256k.ld 6 | 7 | NRF_DEFINES += -DNRF52840_XXAA 8 | -------------------------------------------------------------------------------- /ports/powerpc/frozentest.py: -------------------------------------------------------------------------------- 1 | print("uPy") 2 | print("a long string that is not interned") 3 | print("a string that has unicode αβγ chars") 4 | print(b"bytes 1234\x01") 5 | print(123456789) 6 | for i in range(4): 7 | print(i) 8 | -------------------------------------------------------------------------------- /ports/samd/boards/MINISAM_M4/mpconfigboard.mk: -------------------------------------------------------------------------------- 1 | # https://www.minifigboards.com/mini-sam-m4/mini-sam-m4-hardware/ 2 | MCU_SERIES = SAMD51 3 | CMSIS_MCU = SAMD51G19A 4 | LD_FILES = boards/samd51g19a.ld sections.ld 5 | TEXT0 = 0x4000 6 | -------------------------------------------------------------------------------- /ports/zephyr/boards/qemu_x86.conf: -------------------------------------------------------------------------------- 1 | # Interrupt-driven UART console has emulation artifacts under QEMU, 2 | # disable it 3 | CONFIG_CONSOLE_SUBSYS=n 4 | 5 | # Networking drivers 6 | # SLIP driver for QEMU 7 | CONFIG_NET_SLIP_TAP=y 8 | -------------------------------------------------------------------------------- /tests/basics/deque2.py.exp: -------------------------------------------------------------------------------- 1 | ValueError 2 | ValueError 3 | TypeError 4 | IndexError 5 | None 6 | 1 7 | 2 8 | 3 4 9 | IndexError('empty',) 10 | 2 11 | IndexError('full',) 12 | 2 13 | 5 6 14 | 0 15 | IndexError('empty',) 16 | -------------------------------------------------------------------------------- /tests/basics/exception_chain.py: -------------------------------------------------------------------------------- 1 | # Exception chaining is not supported, but check that basic 2 | # exception works as expected. 3 | try: 4 | raise Exception from None 5 | except Exception: 6 | print("Caught Exception") 7 | -------------------------------------------------------------------------------- /tests/basics/io_stringio_with.py: -------------------------------------------------------------------------------- 1 | try: 2 | import uio as io 3 | except ImportError: 4 | import io 5 | 6 | # test __enter__/__exit__ 7 | with io.StringIO() as b: 8 | b.write("foo") 9 | print(b.getvalue()) 10 | -------------------------------------------------------------------------------- /tests/basics/return1.py: -------------------------------------------------------------------------------- 1 | # test return statement 2 | 3 | def f(): 4 | return 5 | print(f()) 6 | 7 | def g(): 8 | return 1 9 | print(g()) 10 | 11 | def f(x): 12 | return 1 if x else 2 13 | print(f(0), f(1)) 14 | -------------------------------------------------------------------------------- /tests/basics/set_symmetric_difference.py: -------------------------------------------------------------------------------- 1 | print(sorted({1,2}.symmetric_difference({2,3}))) 2 | print(sorted({1,2}.symmetric_difference([2,3]))) 3 | s = {1,2} 4 | print(s.symmetric_difference_update({2,3})) 5 | print(sorted(s)) 6 | -------------------------------------------------------------------------------- /tests/basics/string_repr.py: -------------------------------------------------------------------------------- 1 | # anything above 0xa0 is printed as Unicode by CPython 2 | # the abobe is CPython implementation detail, stick to ASCII 3 | for c in range(0x80): 4 | print("0x{:02x}: {}".format(c, repr(chr(c)))) 5 | -------------------------------------------------------------------------------- /tests/extmod/utime_res.py.exp: -------------------------------------------------------------------------------- 1 | Testing time 2 | Testing gmtime 3 | Testing localtime 4 | Testing gmtime_time 5 | Testing localtime_time 6 | Testing ticks_ms 7 | Testing ticks_us 8 | Testing ticks_ns 9 | Testing ticks_cpu 10 | -------------------------------------------------------------------------------- /tests/internal_bench/from_iter-1-list_bound.py: -------------------------------------------------------------------------------- 1 | import bench 2 | 3 | 4 | def test(num): 5 | for i in iter(range(num // 10000)): 6 | l = [0] * 1000 7 | l2 = list(l) 8 | 9 | 10 | bench.run(test) 11 | -------------------------------------------------------------------------------- /tests/internal_bench/from_iter-3-tuple_bound.py: -------------------------------------------------------------------------------- 1 | import bench 2 | 3 | 4 | def test(num): 5 | for i in iter(range(num // 10000)): 6 | l = [0] * 1000 7 | l2 = tuple(l) 8 | 9 | 10 | bench.run(test) 11 | -------------------------------------------------------------------------------- /tests/internal_bench/from_iter-5-bytes_bound.py: -------------------------------------------------------------------------------- 1 | import bench 2 | 3 | 4 | def test(num): 5 | for i in iter(range(num // 10000)): 6 | l = [0] * 1000 7 | l2 = bytes(l) 8 | 9 | 10 | bench.run(test) 11 | -------------------------------------------------------------------------------- /tests/internal_bench/func_args-3.1-kw_1.py: -------------------------------------------------------------------------------- 1 | import bench 2 | 3 | 4 | def func(a): 5 | pass 6 | 7 | 8 | def test(num): 9 | for i in iter(range(num)): 10 | func(a=i) 11 | 12 | 13 | bench.run(test) 14 | -------------------------------------------------------------------------------- /tests/wipy/pin_irq.py.exp: -------------------------------------------------------------------------------- 1 | True 2 | True 3 | True 4 | True 5 | True 6 | True 7 | True 8 | True 9 | True 10 | True 11 | True 12 | True 13 | True 14 | Awake 15 | True 16 | Awake 17 | Exception 18 | Exception 19 | Exception 20 | -------------------------------------------------------------------------------- /tools/.gitignore: -------------------------------------------------------------------------------- 1 | tinytest/.gitignore 2 | tinytest/.travis.yml 3 | tinytest/Makefile 4 | tinytest/Makefile.arm-cortex-m3-qemu 5 | tinytest/Makefile.avr 6 | tinytest/TODO 7 | tinytest/portable_demo.c 8 | tinytest/tinytest_demo.c 9 | -------------------------------------------------------------------------------- /ports/esp32/modules/apa106.py: -------------------------------------------------------------------------------- 1 | # APA106driver for MicroPython on ESP32 2 | # MIT license; Copyright (c) 2016 Damien P. George 3 | 4 | from neopixel import NeoPixel 5 | 6 | 7 | class APA106(NeoPixel): 8 | ORDER = (0, 1, 2, 3) 9 | -------------------------------------------------------------------------------- /ports/nrf/boards/pca10031/pins.csv: -------------------------------------------------------------------------------- 1 | UART_RTS,P8 2 | UART_TX,P9 3 | UART_CTS,P10 4 | UART_RX,P11 5 | LED_RED,P21 6 | LED_GREEN,P22 7 | LED_BLUE,P23 8 | P15,P15 9 | P16,P16 10 | P17,P17 11 | P18,P18 12 | P19,P19 13 | P20,P20 14 | -------------------------------------------------------------------------------- /ports/xt804/modules/apa106.py: -------------------------------------------------------------------------------- 1 | # APA106driver for MicroPython on ESP32 2 | # MIT license; Copyright (c) 2016 Damien P. George 3 | 4 | from neopixel import NeoPixel 5 | 6 | 7 | class APA106(NeoPixel): 8 | ORDER = (0, 1, 2, 3) 9 | -------------------------------------------------------------------------------- /tests/basics/class_super_aslocal.py: -------------------------------------------------------------------------------- 1 | # test using the name "super" as a local variable 2 | 3 | class A: 4 | def foo(self): 5 | super = [1, 2] 6 | super.pop() 7 | print(super) 8 | 9 | A().foo() 10 | -------------------------------------------------------------------------------- /tests/basics/set_isfooset.py: -------------------------------------------------------------------------------- 1 | sets = [set(), {1}, {1, 2, 3}, {3, 4, 5}, {5, 6, 7}] 2 | args = sets + [[1], [1, 2], [1, 2 ,3]] 3 | for i in sets: 4 | for j in args: 5 | print(i.issubset(j)) 6 | print(i.issuperset(j)) 7 | -------------------------------------------------------------------------------- /tests/basics/subclass_native_str.py: -------------------------------------------------------------------------------- 1 | # Test subclassing built-in str 2 | 3 | class S(str): 4 | pass 5 | 6 | s = S('hello') 7 | print(s == 'hello') 8 | print('hello' == s) 9 | print(s == 'Hello') 10 | print('Hello' == s) 11 | -------------------------------------------------------------------------------- /tests/cpydiff/types_str_endswith.py: -------------------------------------------------------------------------------- 1 | """ 2 | categories: Types,str 3 | description: Start/end indices such as str.endswith(s, start) not implemented 4 | cause: Unknown 5 | workaround: Unknown 6 | """ 7 | print("abc".endswith("c", 1)) 8 | -------------------------------------------------------------------------------- /tests/extmod/uasyncio_set_exception_handler.py.exp: -------------------------------------------------------------------------------- 1 | None 2 | True 3 | sleep 4 | custom_handler ValueError(0, 1) 5 | sleep 6 | custom_handler ValueError(1, 2) 7 | custom_handler ValueError(2, 3) 8 | ValueError(3, 4) 9 | done 10 | -------------------------------------------------------------------------------- /tests/float/complex_special_methods.py: -------------------------------------------------------------------------------- 1 | # test complex interacting with special methods 2 | 3 | 4 | class A: 5 | def __add__(self, x): 6 | print("__add__") 7 | return 1 8 | 9 | 10 | print(A() + 1j) 11 | -------------------------------------------------------------------------------- /ports/esp32/boards/UM_TINYPICO/board.md: -------------------------------------------------------------------------------- 1 | The following files are daily firmware for the TinyPICO. This firmware is compiled 2 | using ESP-IDF v4.2 or later. Some older releases are also provided that are 3 | compiled with ESP-IDF v3.x. 4 | -------------------------------------------------------------------------------- /ports/stm32/boards/CERB40/mpconfigboard.mk: -------------------------------------------------------------------------------- 1 | MCU_SERIES = f4 2 | CMSIS_MCU = STM32F405xx 3 | AF_FILE = boards/stm32f405_af.csv 4 | LD_FILES = boards/stm32f405.ld boards/common_ifs.ld 5 | TEXT0_ADDR = 0x08000000 6 | TEXT1_ADDR = 0x08020000 7 | -------------------------------------------------------------------------------- /ports/stm32/boards/HYDRABUS/mpconfigboard.mk: -------------------------------------------------------------------------------- 1 | MCU_SERIES = f4 2 | CMSIS_MCU = STM32F405xx 3 | AF_FILE = boards/stm32f405_af.csv 4 | LD_FILES = boards/stm32f405.ld boards/common_ifs.ld 5 | TEXT0_ADDR = 0x08000000 6 | TEXT1_ADDR = 0x08020000 7 | -------------------------------------------------------------------------------- /ports/stm32/boards/NUCLEO_L452RE/mpconfigboard.mk: -------------------------------------------------------------------------------- 1 | MCU_SERIES = l4 2 | CMSIS_MCU = STM32L452xx 3 | AF_FILE = boards/stm32l452_af.csv 4 | LD_FILES = boards/stm32l452xe.ld boards/common_basic.ld 5 | OPENOCD_CONFIG = boards/openocd_stm32l4.cfg 6 | -------------------------------------------------------------------------------- /ports/stm32/boards/NUCLEO_L476RG/mpconfigboard.mk: -------------------------------------------------------------------------------- 1 | MCU_SERIES = l4 2 | CMSIS_MCU = STM32L476xx 3 | AF_FILE = boards/stm32l476_af.csv 4 | LD_FILES = boards/stm32l476xg.ld boards/common_basic.ld 5 | OPENOCD_CONFIG = boards/openocd_stm32l4.cfg 6 | -------------------------------------------------------------------------------- /ports/stm32/boards/PYBV3/mpconfigboard.mk: -------------------------------------------------------------------------------- 1 | MCU_SERIES = f4 2 | CMSIS_MCU = STM32F405xx 3 | AF_FILE = boards/stm32f405_af.csv 4 | LD_FILES = boards/stm32f405.ld boards/common_ifs.ld 5 | TEXT0_ADDR = 0x08000000 6 | TEXT1_ADDR = 0x08020000 7 | -------------------------------------------------------------------------------- /ports/stm32/boards/PYBV4/mpconfigboard.mk: -------------------------------------------------------------------------------- 1 | MCU_SERIES = f4 2 | CMSIS_MCU = STM32F405xx 3 | AF_FILE = boards/stm32f405_af.csv 4 | LD_FILES = boards/stm32f405.ld boards/common_ifs.ld 5 | TEXT0_ADDR = 0x08000000 6 | TEXT1_ADDR = 0x08020000 7 | -------------------------------------------------------------------------------- /ports/stm32/boards/STM32F439/mpconfigboard.mk: -------------------------------------------------------------------------------- 1 | MCU_SERIES = f4 2 | CMSIS_MCU = STM32F439xx 3 | AF_FILE = boards/stm32f439_af.csv 4 | LD_FILES = boards/stm32f439.ld boards/common_ifs.ld 5 | TEXT0_ADDR = 0x08000000 6 | TEXT1_ADDR = 0x08020000 7 | -------------------------------------------------------------------------------- /ports/stm32/boards/STM32L476DISC/mpconfigboard.mk: -------------------------------------------------------------------------------- 1 | MCU_SERIES = l4 2 | CMSIS_MCU = STM32L476xx 3 | AF_FILE = boards/stm32l476_af.csv 4 | LD_FILES = boards/stm32l476xg.ld boards/common_basic.ld 5 | OPENOCD_CONFIG = boards/openocd_stm32l4.cfg 6 | -------------------------------------------------------------------------------- /ports/stm32/boards/VCC_GND_F407VE/board_init.c: -------------------------------------------------------------------------------- 1 | #include "py/mphal.h" 2 | 3 | void VCC_GND_F407VE_board_early_init(void) { 4 | // set SPI flash CS pin high 5 | mp_hal_pin_output(pin_A4); 6 | mp_hal_pin_write(pin_A4, 1); 7 | } 8 | -------------------------------------------------------------------------------- /ports/stm32/boards/VCC_GND_F407ZG/board_init.c: -------------------------------------------------------------------------------- 1 | #include "py/mphal.h" 2 | 3 | void VCC_GND_F407ZG_board_early_init(void) { 4 | // set SPI flash CS pin high 5 | mp_hal_pin_output(pin_C4); 6 | mp_hal_pin_write(pin_C4, 1); 7 | } 8 | -------------------------------------------------------------------------------- /ports/teensy/memzip_files/main.py: -------------------------------------------------------------------------------- 1 | import pyb 2 | 3 | print("Executing main.py") 4 | 5 | led = pyb.LED(1) 6 | 7 | led.on() 8 | pyb.delay(100) 9 | led.off() 10 | pyb.delay(100) 11 | led.on() 12 | pyb.delay(100) 13 | led.off() 14 | -------------------------------------------------------------------------------- /ports/zephyr/boards/qemu_cortex_m3.conf: -------------------------------------------------------------------------------- 1 | # Interrupt-driven UART console has emulation artifacts under QEMU, 2 | # disable it 3 | CONFIG_CONSOLE_SUBSYS=n 4 | 5 | # Networking drivers 6 | # SLIP driver for QEMU 7 | CONFIG_NET_SLIP_TAP=y 8 | -------------------------------------------------------------------------------- /tests/basics/closure_defargs.py: -------------------------------------------------------------------------------- 1 | # test closure with default args 2 | 3 | def f(): 4 | a = 1 5 | def bar(b = 10, c = 20): 6 | print(a + b + c) 7 | bar() 8 | bar(2) 9 | bar(2, 3) 10 | 11 | print(f()) 12 | -------------------------------------------------------------------------------- /tests/basics/int_big_rshift.py: -------------------------------------------------------------------------------- 1 | i = 123456789012345678901234567890 2 | print(i >> 1) 3 | print(i >> 1000) 4 | 5 | # result needs rounding up 6 | i = -(1 << 70) 7 | print(i >> 80) 8 | i = -0xffffffffffffffff 9 | print(i >> 32) 10 | -------------------------------------------------------------------------------- /tests/basics/string_escape.py: -------------------------------------------------------------------------------- 1 | a = "a\1b" 2 | print(len(a)) 3 | print(ord(a[1])) 4 | print(len("a\123b")) 5 | a = "a\12345b" 6 | print(len(a)) 7 | print(ord(a[1])) 8 | 9 | a = "a\xffb" 10 | print(len(a)) 11 | print(ord(a[1])) 12 | -------------------------------------------------------------------------------- /tests/extmod/uasyncio_event_fair.py.exp: -------------------------------------------------------------------------------- 1 | sleep 0 2 | wait 2 3 | sleep 1 4 | wait 3 5 | sleep 0 6 | sleep 1 7 | wait 2 8 | sleep 0 9 | sleep 1 10 | wait 3 11 | sleep 0 12 | sleep 1 13 | wait 2 14 | wait 3 15 | wait 2 16 | wait 3 17 | -------------------------------------------------------------------------------- /tests/extmod/ujson_dumps_extra.py: -------------------------------------------------------------------------------- 1 | # test uPy ujson behaviour that's not valid in CPy 2 | 3 | try: 4 | import ujson 5 | except ImportError: 6 | print("SKIP") 7 | raise SystemExit 8 | 9 | print(ujson.dumps(b"1234")) 10 | -------------------------------------------------------------------------------- /tests/float/complex_reverse_op.py: -------------------------------------------------------------------------------- 1 | # test complex interacting with special reverse methods 2 | 3 | 4 | class A: 5 | def __radd__(self, x): 6 | print("__radd__") 7 | return 2 8 | 9 | 10 | print(1j + A()) 11 | -------------------------------------------------------------------------------- /tests/inlineasm/asmconst.py: -------------------------------------------------------------------------------- 1 | # test constants in assembler 2 | 3 | 4 | @micropython.asm_thumb 5 | def c1(): 6 | movwt(r0, 0xFFFFFFFF) 7 | movwt(r1, 0xF0000000) 8 | sub(r0, r0, r1) 9 | 10 | 11 | print(hex(c1())) 12 | -------------------------------------------------------------------------------- /tests/internal_bench/from_iter-7-bytearray_bound.py: -------------------------------------------------------------------------------- 1 | import bench 2 | 3 | 4 | def test(num): 5 | for i in iter(range(num // 10000)): 6 | l = [0] * 1000 7 | l2 = bytearray(l) 8 | 9 | 10 | bench.run(test) 11 | -------------------------------------------------------------------------------- /tests/internal_bench/func_args-1.2-pos_3.py: -------------------------------------------------------------------------------- 1 | import bench 2 | 3 | 4 | def func(a, b, c): 5 | pass 6 | 7 | 8 | def test(num): 9 | for i in iter(range(num)): 10 | func(i, i, i) 11 | 12 | 13 | bench.run(test) 14 | -------------------------------------------------------------------------------- /tests/internal_bench/var-5-class-attr.py: -------------------------------------------------------------------------------- 1 | import bench 2 | 3 | 4 | class Foo: 5 | num = 20000000 6 | 7 | 8 | def test(num): 9 | i = 0 10 | while i < Foo.num: 11 | i += 1 12 | 13 | 14 | bench.run(test) 15 | -------------------------------------------------------------------------------- /tests/pyb/pin.py.exp: -------------------------------------------------------------------------------- 1 | Pin(Pin.cpu.A7, mode=Pin.IN) 2 | A7 3 | 7 4 | 0 5 | Pin(Pin.cpu.A7, mode=Pin.IN, pull=Pin.PULL_UP) 6 | 1 7 | Pin(Pin.cpu.A7, mode=Pin.IN, pull=Pin.PULL_DOWN) 8 | 0 9 | 0 10 | 1 11 | 0 12 | 1 13 | 0 14 | 1 15 | -------------------------------------------------------------------------------- /drivers/wiznet5k/README.md: -------------------------------------------------------------------------------- 1 | This is the driver for the WIZnet5x00 series of Ethernet controllers. 2 | 3 | Adapted for MicroPython. 4 | 5 | Original source: https://github.com/Wiznet/W5500_EVB/tree/master/ioLibrary 6 | Taken on: 30 August 2014 7 | -------------------------------------------------------------------------------- /ports/esp32/boards/sdkconfig.spiram: -------------------------------------------------------------------------------- 1 | # MicroPython on ESP32, ESP IDF configuration with SPIRAM support 2 | 3 | CONFIG_ESP32_SPIRAM_SUPPORT=y 4 | CONFIG_SPIRAM_CACHE_WORKAROUND=y 5 | CONFIG_SPIRAM_IGNORE_NOTFOUND=y 6 | CONFIG_SPIRAM_USE_MEMMAP=y 7 | -------------------------------------------------------------------------------- /ports/stm32/boards/NUCLEO_F411RE/mpconfigboard.mk: -------------------------------------------------------------------------------- 1 | MCU_SERIES = f4 2 | CMSIS_MCU = STM32F411xE 3 | AF_FILE = boards/stm32f411_af.csv 4 | LD_FILES = boards/stm32f411.ld boards/common_ifs.ld 5 | TEXT0_ADDR = 0x08000000 6 | TEXT1_ADDR = 0x08020000 7 | -------------------------------------------------------------------------------- /ports/stm32/boards/NUCLEO_F446RE/mpconfigboard.mk: -------------------------------------------------------------------------------- 1 | MCU_SERIES = f4 2 | CMSIS_MCU = STM32F446xx 3 | AF_FILE = boards/stm32f429_af.csv 4 | LD_FILES = boards/stm32f411.ld boards/common_ifs.ld 5 | TEXT0_ADDR = 0x08000000 6 | TEXT1_ADDR = 0x08020000 7 | -------------------------------------------------------------------------------- /ports/stm32/boards/NUCLEO_F722ZE/mpconfigboard.mk: -------------------------------------------------------------------------------- 1 | MCU_SERIES = f7 2 | CMSIS_MCU = STM32F722xx 3 | AF_FILE = boards/stm32f722_af.csv 4 | LD_FILES = boards/stm32f722.ld boards/common_ifs.ld 5 | TEXT0_ADDR = 0x08000000 6 | TEXT1_ADDR = 0x08020000 7 | -------------------------------------------------------------------------------- /ports/stm32/boards/OLIMEX_H407/mpconfigboard.mk: -------------------------------------------------------------------------------- 1 | MCU_SERIES = f4 2 | CMSIS_MCU = STM32F407xx 3 | AF_FILE = boards/stm32f405_af.csv 4 | LD_FILES = boards/stm32f405.ld boards/common_ifs.ld 5 | TEXT0_ADDR = 0x08000000 6 | TEXT1_ADDR = 0x08020000 7 | -------------------------------------------------------------------------------- /ports/stm32/boards/PYBLITEV10/mpconfigboard.mk: -------------------------------------------------------------------------------- 1 | MCU_SERIES = f4 2 | CMSIS_MCU = STM32F411xE 3 | AF_FILE = boards/stm32f411_af.csv 4 | LD_FILES = boards/stm32f411.ld boards/common_ifs.ld 5 | TEXT0_ADDR = 0x08000000 6 | TEXT1_ADDR = 0x08020000 7 | -------------------------------------------------------------------------------- /ports/stm32/boards/STM32F411DISC/mpconfigboard.mk: -------------------------------------------------------------------------------- 1 | MCU_SERIES = f4 2 | CMSIS_MCU = STM32F411xE 3 | AF_FILE = boards/stm32f411_af.csv 4 | LD_FILES = boards/stm32f411.ld boards/common_ifs.ld 5 | TEXT0_ADDR = 0x08000000 6 | TEXT1_ADDR = 0x08020000 7 | -------------------------------------------------------------------------------- /ports/stm32/boards/STM32F429DISC/mpconfigboard.mk: -------------------------------------------------------------------------------- 1 | MCU_SERIES = f4 2 | CMSIS_MCU = STM32F429xx 3 | AF_FILE = boards/stm32f429_af.csv 4 | LD_FILES = boards/stm32f429.ld boards/common_ifs.ld 5 | TEXT0_ADDR = 0x08000000 6 | TEXT1_ADDR = 0x08020000 7 | -------------------------------------------------------------------------------- /ports/stm32/boards/STM32F4DISC/mpconfigboard.mk: -------------------------------------------------------------------------------- 1 | MCU_SERIES = f4 2 | CMSIS_MCU = STM32F407xx 3 | AF_FILE = boards/stm32f405_af.csv 4 | LD_FILES = boards/stm32f405.ld boards/common_ifs.ld 5 | TEXT0_ADDR = 0x08000000 6 | TEXT1_ADDR = 0x08020000 7 | -------------------------------------------------------------------------------- /ports/stm32/boards/STM32L496GDISC/mpconfigboard.mk: -------------------------------------------------------------------------------- 1 | MCU_SERIES = l4 2 | CMSIS_MCU = STM32L496xx 3 | AF_FILE = boards/stm32l496_af.csv 4 | LD_FILES = boards/stm32l496xg.ld boards/common_basic.ld 5 | OPENOCD_CONFIG = boards/openocd_stm32l4.cfg 6 | -------------------------------------------------------------------------------- /ports/stm32/boards/VCC_GND_F407VE/mpconfigboard.mk: -------------------------------------------------------------------------------- 1 | MCU_SERIES = f4 2 | CMSIS_MCU = STM32F407xx 3 | AF_FILE = boards/stm32f405_af.csv 4 | LD_FILES = boards/stm32f405.ld boards/common_ifs.ld 5 | TEXT0_ADDR = 0x08000000 6 | TEXT1_ADDR = 0x08020000 7 | -------------------------------------------------------------------------------- /tests/basics/builtin_bin.py: -------------------------------------------------------------------------------- 1 | # test builtin bin function 2 | 3 | print(bin(1)) 4 | print(bin(-1)) 5 | print(bin(15)) 6 | print(bin(-15)) 7 | 8 | print(bin(12345)) 9 | print(bin(0b10101)) 10 | 11 | print(bin(0b10101010101010101010)) 12 | -------------------------------------------------------------------------------- /tests/basics/builtin_len1.py: -------------------------------------------------------------------------------- 1 | # builtin len 2 | 3 | print(len(())) 4 | print(len((1,))) 5 | print(len((1, 2))) 6 | 7 | print(len([])) 8 | x = [1, 2, 3] 9 | print(len(x)) 10 | 11 | f = len 12 | print(f({})) 13 | print(f({1:2, 3:4})) 14 | -------------------------------------------------------------------------------- /tests/basics/int_divmod_intbig.py: -------------------------------------------------------------------------------- 1 | # test integer floor division and modulo 2 | 3 | # this tests bignum modulo 4 | a = 987654321987987987987987987987 5 | b = 19 6 | print(a % b) 7 | print(a % -b) 8 | print(-a % b) 9 | print(-a % -b) 10 | -------------------------------------------------------------------------------- /tests/basics/list_remove.py: -------------------------------------------------------------------------------- 1 | a = [1, 2, 3] 2 | print(a.remove(2)) 3 | print(a) 4 | try: 5 | a.remove(2) 6 | except ValueError: 7 | print("Raised ValueError") 8 | else: 9 | raise AssertionError("Did not raise ValueError") 10 | -------------------------------------------------------------------------------- /tests/basics/python34.py.exp: -------------------------------------------------------------------------------- 1 | None 2 | ['a', 'b'] 3 | ('a', 'b') {'kw_arg': None} 4 | 2 5 | 1 6 | SyntaxError 7 | SyntaxError 8 | SyntaxError 9 | SyntaxError 10 | SyntaxError 11 | SyntaxError 12 | 3.4 13 | 3 4 14 | IndexError('foo',) 15 | -------------------------------------------------------------------------------- /tests/internal_bench/func_args-3.2-kw_3.py: -------------------------------------------------------------------------------- 1 | import bench 2 | 3 | 4 | def func(a, b, c): 5 | pass 6 | 7 | 8 | def test(num): 9 | for i in iter(range(num)): 10 | func(c=i, b=i, a=i) 11 | 12 | 13 | bench.run(test) 14 | -------------------------------------------------------------------------------- /drivers/dht/dht.h: -------------------------------------------------------------------------------- 1 | #ifndef MICROPY_INCLUDED_DRIVERS_DHT_DHT_H 2 | #define MICROPY_INCLUDED_DRIVERS_DHT_DHT_H 3 | 4 | #include "py/obj.h" 5 | 6 | MP_DECLARE_CONST_FUN_OBJ_2(dht_readinto_obj); 7 | 8 | #endif // MICROPY_INCLUDED_DRIVERS_DHT_DHT_H 9 | -------------------------------------------------------------------------------- /ports/stm32/boards/NETDUINO_PLUS_2/mpconfigboard.mk: -------------------------------------------------------------------------------- 1 | MCU_SERIES = f4 2 | CMSIS_MCU = STM32F405xx 3 | AF_FILE = boards/stm32f405_af.csv 4 | LD_FILES = boards/stm32f405.ld boards/common_ifs.ld 5 | TEXT0_ADDR = 0x08000000 6 | TEXT1_ADDR = 0x08020000 7 | -------------------------------------------------------------------------------- /ports/stm32/boards/NUCLEO_F401RE/mpconfigboard.mk: -------------------------------------------------------------------------------- 1 | MCU_SERIES = f4 2 | CMSIS_MCU = STM32F401xE 3 | AF_FILE = boards/stm32f401_af.csv 4 | LD_FILES = boards/stm32f401xe.ld boards/common_ifs.ld 5 | TEXT0_ADDR = 0x08000000 6 | TEXT1_ADDR = 0x08020000 7 | -------------------------------------------------------------------------------- /ports/stm32/boards/NUCLEO_F412ZG/mpconfigboard.mk: -------------------------------------------------------------------------------- 1 | MCU_SERIES = f4 2 | CMSIS_MCU = STM32F412Zx 3 | AF_FILE = boards/stm32f412_af.csv 4 | LD_FILES = boards/stm32f412zx.ld boards/common_ifs.ld 5 | TEXT0_ADDR = 0x08000000 6 | TEXT1_ADDR = 0x08020000 7 | -------------------------------------------------------------------------------- /ports/stm32/boards/NUCLEO_F413ZH/mpconfigboard.mk: -------------------------------------------------------------------------------- 1 | MCU_SERIES = f4 2 | CMSIS_MCU = STM32F413xx 3 | AF_FILE = boards/stm32f413_af.csv 4 | LD_FILES = boards/stm32f413xh.ld boards/common_ifs.ld 5 | TEXT0_ADDR = 0x08000000 6 | TEXT1_ADDR = 0x08060000 7 | -------------------------------------------------------------------------------- /tests/basics/async_with_break.py.exp: -------------------------------------------------------------------------------- 1 | enter 2 | body 3 | exit None None 4 | finished 5 | enter 6 | body 7 | exit None None 8 | finally 9 | finished 10 | enter 11 | body 12 | exit None None 13 | finally inner 14 | finally outer 15 | finished 16 | -------------------------------------------------------------------------------- /tests/basics/builtin_slice.py: -------------------------------------------------------------------------------- 1 | # test builtin slice 2 | 3 | # print slice 4 | class A: 5 | def __getitem__(self, idx): 6 | print(idx) 7 | return idx 8 | s = A()[1:2:3] 9 | 10 | # check type 11 | print(type(s) is slice) 12 | -------------------------------------------------------------------------------- /tests/basics/closure_manyvars.py: -------------------------------------------------------------------------------- 1 | # test closure with lots of closed over variables 2 | 3 | def f(): 4 | a, b, c, d, e, f, g, h = [i for i in range(8)] 5 | def x(): 6 | print(a, b, c, d, e, f, g, h) 7 | x() 8 | 9 | f() 10 | -------------------------------------------------------------------------------- /tests/cpydiff/types_str_rsplitnone.py: -------------------------------------------------------------------------------- 1 | """ 2 | categories: Types,str 3 | description: None as first argument for rsplit such as str.rsplit(None, n) not implemented 4 | cause: Unknown 5 | workaround: Unknown 6 | """ 7 | print("a a a".rsplit(None, 1)) 8 | -------------------------------------------------------------------------------- /tests/extmod/uasyncio_lock_cancel.py.exp: -------------------------------------------------------------------------------- 1 | task 0 start 2 | task 1 start 3 | task 2 start 4 | task 3 start 5 | task 1 cancel 6 | task 2 cancel 7 | task 0 lock_flag False 8 | task 0 done 9 | task 3 lock_flag False 10 | task 3 done 11 | False 12 | -------------------------------------------------------------------------------- /tests/extmod/uzlib_decompio.py.exp: -------------------------------------------------------------------------------- 1 | 0 2 | b'h' 3 | 2 4 | b'el' 5 | b'lo' 6 | 7 7 | b'' 8 | b'' 9 | 7 10 | b'0000000000' 11 | b'000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000' 12 | OSError(22,) 13 | -------------------------------------------------------------------------------- /tests/inlineasm/asmspecialregs.py: -------------------------------------------------------------------------------- 1 | @micropython.asm_thumb 2 | def getIPSR(): 3 | mrs(r0, IPSR) 4 | 5 | 6 | @micropython.asm_thumb 7 | def getBASEPRI(): 8 | mrs(r0, BASEPRI) 9 | 10 | 11 | print(getBASEPRI()) 12 | print(getIPSR()) 13 | -------------------------------------------------------------------------------- /tests/internal_bench/from_iter-2-list_unbound.py: -------------------------------------------------------------------------------- 1 | import bench 2 | 3 | 4 | def test(num): 5 | for i in iter(range(num // 10000)): 6 | l = [0] * 1000 7 | l2 = list(map(lambda x: x, l)) 8 | 9 | 10 | bench.run(test) 11 | -------------------------------------------------------------------------------- /tests/internal_bench/from_iter-4-tuple_unbound.py: -------------------------------------------------------------------------------- 1 | import bench 2 | 3 | 4 | def test(num): 5 | for i in iter(range(num // 10000)): 6 | l = [0] * 1000 7 | l2 = tuple(map(lambda x: x, l)) 8 | 9 | 10 | bench.run(test) 11 | -------------------------------------------------------------------------------- /tests/internal_bench/from_iter-6-bytes_unbound.py: -------------------------------------------------------------------------------- 1 | import bench 2 | 3 | 4 | def test(num): 5 | for i in iter(range(num // 10000)): 6 | l = [0] * 1000 7 | l2 = bytes(map(lambda x: x, l)) 8 | 9 | 10 | bench.run(test) 11 | -------------------------------------------------------------------------------- /tests/internal_bench/func_args-2-pos_default_2_of_3.py: -------------------------------------------------------------------------------- 1 | import bench 2 | 3 | 4 | def func(a, b=1, c=2): 5 | pass 6 | 7 | 8 | def test(num): 9 | for i in iter(range(num)): 10 | func(i) 11 | 12 | 13 | bench.run(test) 14 | -------------------------------------------------------------------------------- /tests/micropython/stack_use.py: -------------------------------------------------------------------------------- 1 | # tests stack_use function in micropython module 2 | import micropython 3 | 4 | if not hasattr(micropython, "stack_use"): 5 | print("SKIP") 6 | else: 7 | print(type(micropython.stack_use())) # output varies 8 | -------------------------------------------------------------------------------- /docs/rp2/tutorial/intro.rst: -------------------------------------------------------------------------------- 1 | .. _rp2_intro: 2 | 3 | Getting started with MicroPython on the RP2xxx 4 | ============================================== 5 | 6 | Let's get started! 7 | 8 | .. toctree:: 9 | :maxdepth: 1 10 | 11 | pio.rst 12 | -------------------------------------------------------------------------------- /examples/hwapi/button_led.py: -------------------------------------------------------------------------------- 1 | import utime 2 | from hwconfig import LED, BUTTON 3 | 4 | # Light LED when (and while) a BUTTON is pressed 5 | 6 | while 1: 7 | LED.value(BUTTON.value()) 8 | # Don't burn CPU 9 | utime.sleep_ms(10) 10 | -------------------------------------------------------------------------------- /examples/usercmodule/cppexample/examplemodule.h: -------------------------------------------------------------------------------- 1 | // Include MicroPython API. 2 | #include "py/runtime.h" 3 | 4 | // Declare the function we'll make available in Python as cppexample.cppfunc(). 5 | extern mp_obj_t cppfunc(mp_obj_t a_obj, mp_obj_t b_obj); 6 | -------------------------------------------------------------------------------- /ports/esp32/boards/GENERIC/board.md: -------------------------------------------------------------------------------- 1 | The following files are daily firmware for ESP32-based boards without external SPIRAM. 2 | 3 | This firmware is compiled using ESP-IDF v4.x. Some older releases are also provided that are compiled with ESP-IDF v3.x. 4 | -------------------------------------------------------------------------------- /ports/nrf/boards/pca10090/mpconfigboard.mk: -------------------------------------------------------------------------------- 1 | MCU_SERIES = m33 2 | MCU_VARIANT = nrf91 3 | MCU_SUB_VARIANT = nrf9160 4 | LD_FILES += boards/nrf9160_1M_256k.ld 5 | 6 | NRF_DEFINES += -DNRF9160_XXAA -DNRF_TRUSTZONE_NONSECURE 7 | 8 | MICROPY_VFS_LFS2 = 1 9 | -------------------------------------------------------------------------------- /ports/teensy/lexermemzip.h: -------------------------------------------------------------------------------- 1 | #ifndef MICROPY_INCLUDED_TEENSY_LEXERMEMZIP_H 2 | #define MICROPY_INCLUDED_TEENSY_LEXERMEMZIP_H 3 | 4 | mp_lexer_t *mp_lexer_new_from_memzip_file(const char *filename); 5 | 6 | #endif // MICROPY_INCLUDED_TEENSY_LEXERMEMZIP_H 7 | -------------------------------------------------------------------------------- /ports/unix/input.h: -------------------------------------------------------------------------------- 1 | #ifndef MICROPY_INCLUDED_UNIX_INPUT_H 2 | #define MICROPY_INCLUDED_UNIX_INPUT_H 3 | 4 | char *prompt(char *p); 5 | void prompt_read_history(void); 6 | void prompt_write_history(void); 7 | 8 | #endif // MICROPY_INCLUDED_UNIX_INPUT_H 9 | -------------------------------------------------------------------------------- /tests/basics/async_with_return.py.exp: -------------------------------------------------------------------------------- 1 | enter 2 | body 3 | exit None None 4 | finished 5 | enter 6 | body 7 | exit None None 8 | finally 9 | finished 10 | enter 11 | body 12 | exit None None 13 | finally inner 14 | finally outer 15 | finished 16 | -------------------------------------------------------------------------------- /tests/basics/class_use_other.py: -------------------------------------------------------------------------------- 1 | # check that we can use an instance of B in a method of A 2 | 3 | class A: 4 | def store(a, b): 5 | a.value = b 6 | 7 | class B: 8 | pass 9 | 10 | b = B() 11 | A.store(b, 1) 12 | print(b.value) 13 | -------------------------------------------------------------------------------- /tests/basics/frozenset_copy.py: -------------------------------------------------------------------------------- 1 | try: 2 | frozenset 3 | except NameError: 4 | print("SKIP") 5 | raise SystemExit 6 | 7 | s = frozenset({1, 2, 3, 4}) 8 | t = s.copy() 9 | print(type(t)) 10 | for i in s, t: 11 | print(sorted(i)) 12 | -------------------------------------------------------------------------------- /tests/basics/int_divmod.py: -------------------------------------------------------------------------------- 1 | # test integer floor division and modulo 2 | 3 | # test all combination of +/-/0 cases 4 | for i in range(-2, 3): 5 | for j in range(-4, 5): 6 | if j != 0: 7 | print(i, j, i // j, i % j, divmod(i, j)) 8 | -------------------------------------------------------------------------------- /tests/cpydiff/modules_array_containment.py: -------------------------------------------------------------------------------- 1 | """ 2 | categories: Modules,array 3 | description: Looking for integer not implemented 4 | cause: Unknown 5 | workaround: Unknown 6 | """ 7 | import array 8 | 9 | print(1 in array.array("B", b"12")) 10 | -------------------------------------------------------------------------------- /tests/extmod/uasyncio_fair.py.exp: -------------------------------------------------------------------------------- 1 | task start 1 2 | task start 2 3 | task work 2 4 | task start 3 5 | task work 3 6 | task start 4 7 | task work 2 8 | task work 3 9 | task work 2 10 | task work 2 11 | task work 3 12 | task work 2 13 | finish 14 | -------------------------------------------------------------------------------- /tests/extmod/uctypes_le.py.exp: -------------------------------------------------------------------------------- 1 | 0x3130 2 | 48 49 3 | TypeError 4 | arr: 48 49 5 | arr of struct: 48 49 6 | IndexError 7 | bf: 48 49 8 | bf 4bit: 3 1 3 0 9 | bytearray(b'21') 10 | bytearray(b'2Q') 11 | bytearray(b'5123') 12 | bytearray(b'51R3') 13 | -------------------------------------------------------------------------------- /tests/extmod/uctypes_le_float.py.exp: -------------------------------------------------------------------------------- 1 | 12.3400 2 | 12.3400 3 | 12.3400 4 | 1.0000 2.0000 bytearray(b'\x00\x00\x80?\x00\x00\x00@\x00\x00\x00\x00\x00\x00\x00\x00') 5 | 1.0000 2.0000 bytearray(b'\x00\x00\x00\x00\x00\x00\xf0?\x00\x00\x00\x00\x00\x00\x00@') 6 | -------------------------------------------------------------------------------- /tests/micropython/viper_binop_comp_imm.py: -------------------------------------------------------------------------------- 1 | # comparisons with immediate boundary values 2 | @micropython.viper 3 | def f(a: int): 4 | print(a == -1, a == -255, a == -256, a == -257) 5 | 6 | 7 | f(-1) 8 | f(-255) 9 | f(-256) 10 | f(-257) 11 | -------------------------------------------------------------------------------- /tests/micropython/viper_misc_intbig.py: -------------------------------------------------------------------------------- 1 | import micropython 2 | 3 | # unsigned ints 4 | @micropython.viper 5 | def viper_uint() -> uint: 6 | return uint(-1) 7 | 8 | 9 | import usys 10 | 11 | print(viper_uint() == (usys.maxsize << 1 | 1)) 12 | -------------------------------------------------------------------------------- /tests/pyb/spi.py.exp: -------------------------------------------------------------------------------- 1 | ValueError -1 2 | ValueError 0 3 | SPI 1 4 | SPI 2 5 | SPI(1) 6 | SPI(1, SPI.CONTROLLER, baudrate= , polarity=1, phase=0, bits=8) 7 | SPI(1, SPI.PERIPHERAL, polarity=1, phase=1, bits=8) 8 | OSError 9 | b'\xff' 10 | b'\xff' 11 | -------------------------------------------------------------------------------- /tests/unicode/unicode_slice.py: -------------------------------------------------------------------------------- 1 | # Test slicing of Unicode strings 2 | 3 | s = "Привет" 4 | 5 | print(s[:]) 6 | print(s[2:]) 7 | print(s[:5]) 8 | print(s[2:5]) 9 | print(s[2:5:1]) 10 | print(s[2:10]) 11 | print(s[-3:10]) 12 | print(s[-4:10]) 13 | -------------------------------------------------------------------------------- /docs/static/customstyle.css: -------------------------------------------------------------------------------- 1 | /* custom CSS for MicroPython docs 2 | */ 3 | 4 | .admonition-difference-to-cpython { 5 | border: 1px solid black; 6 | } 7 | 8 | .admonition-difference-to-cpython .admonition-title { 9 | margin: 4px; 10 | } 11 | -------------------------------------------------------------------------------- /examples/embedding/Makefile: -------------------------------------------------------------------------------- 1 | MPTOP = ../.. 2 | CFLAGS = -std=c99 -I. -I$(MPTOP) -DNO_QSTR 3 | LDFLAGS = -L. 4 | 5 | hello-embed: hello-embed.o -lmicropython 6 | 7 | -lmicropython: 8 | $(MAKE) -f $(MPTOP)/examples/embedding/Makefile.upylib MPTOP=$(MPTOP) 9 | -------------------------------------------------------------------------------- /ports/esp32/boards/GENERIC/mpconfigboard.cmake: -------------------------------------------------------------------------------- 1 | set(SDKCONFIG_DEFAULTS 2 | boards/sdkconfig.base 3 | boards/sdkconfig.ble 4 | ) 5 | if(NOT MICROPY_FROZEN_MANIFEST) 6 | set(MICROPY_FROZEN_MANIFEST ${MICROPY_PORT_DIR}/boards/manifest.py) 7 | endif() 8 | -------------------------------------------------------------------------------- /ports/esp32/boards/GENERIC_D2WD/sdkconfig.board: -------------------------------------------------------------------------------- 1 | CONFIG_ESPTOOLPY_FLASHMODE_DIO=y 2 | CONFIG_ESPTOOLPY_FLASHFREQ_40M=y 3 | CONFIG_ESPTOOLPY_FLASHSIZE_2MB=y 4 | CONFIG_PARTITION_TABLE_CUSTOM=y 5 | CONFIG_PARTITION_TABLE_CUSTOM_FILENAME="partitions-2MiB.csv" 6 | -------------------------------------------------------------------------------- /ports/esp32/boards/UM_FEATHERS2NEO/sdkconfig.board: -------------------------------------------------------------------------------- 1 | CONFIG_FLASHMODE_QIO=y 2 | CONFIG_ESPTOOLPY_FLASHFREQ_80M=y 3 | CONFIG_USB_AND_UART=y 4 | CONFIG_ESPTOOLPY_AFTER_NORESET=y 5 | 6 | # LWIP 7 | CONFIG_LWIP_LOCAL_HOSTNAME="UMFeatherS2Neo" 8 | # end of LWIP 9 | -------------------------------------------------------------------------------- /ports/esp32/boards/sdkconfig.240mhz: -------------------------------------------------------------------------------- 1 | # MicroPython on ESP32, ESP IDF configuration with 240MHz CPU 2 | CONFIG_ESP32_DEFAULT_CPU_FREQ_80= 3 | CONFIG_ESP32_DEFAULT_CPU_FREQ_160= 4 | CONFIG_ESP32_DEFAULT_CPU_FREQ_240=y 5 | CONFIG_ESP32_DEFAULT_CPU_FREQ_MHZ=240 6 | -------------------------------------------------------------------------------- /ports/nrf/boards/actinius_icarus/mpconfigboard.mk: -------------------------------------------------------------------------------- 1 | MCU_SERIES = m33 2 | MCU_VARIANT = nrf91 3 | MCU_SUB_VARIANT = nrf9160 4 | LD_FILES += boards/nrf9160_1M_256k.ld 5 | 6 | NRF_DEFINES += -DNRF9160_XXAA -DNRF_TRUSTZONE_NONSECURE 7 | 8 | MICROPY_VFS_LFS2 = 1 9 | -------------------------------------------------------------------------------- /ports/stm32/boards/NUCLEO_H743ZI/board_init.c: -------------------------------------------------------------------------------- 1 | #include "py/mphal.h" 2 | 3 | void NUCLEO_H743ZI_board_early_init(void) { 4 | // Turn off the USB switch 5 | mp_hal_pin_output(pyb_pin_OTG_FS_POWER); 6 | mp_hal_pin_low(pyb_pin_OTG_FS_POWER); 7 | } 8 | -------------------------------------------------------------------------------- /tests/basics/async_await.py.exp: -------------------------------------------------------------------------------- 1 | 4 2 | 3 3 | 2 4 | 1 5 | 0 6 | 0 7 | 1 8 | 0 9 | 0 10 | 2 11 | 1 12 | 0 13 | 0 14 | 1 15 | 0 16 | 0 17 | 3 18 | 2 19 | 1 20 | 0 21 | 0 22 | 1 23 | 0 24 | 0 25 | 2 26 | 1 27 | 0 28 | 0 29 | 1 30 | 0 31 | 0 32 | finished 33 | -------------------------------------------------------------------------------- /tests/basics/break.py: -------------------------------------------------------------------------------- 1 | while True: 2 | break 3 | 4 | for i in range(4): 5 | print('one', i) 6 | if i > 2: 7 | break 8 | print('two', i) 9 | 10 | for i in [1, 2, 3, 4]: 11 | if i == 3: 12 | break 13 | print(i) 14 | -------------------------------------------------------------------------------- /tests/basics/builtin_sum.py: -------------------------------------------------------------------------------- 1 | # test builtin "sum" 2 | 3 | tests = ( 4 | (), 5 | [], 6 | [0], 7 | [1], 8 | [0, 1, 2], 9 | range(10), 10 | ) 11 | 12 | for test in tests: 13 | print(sum(test)) 14 | print(sum(test, -2)) 15 | -------------------------------------------------------------------------------- /tests/basics/class_instance_override.py: -------------------------------------------------------------------------------- 1 | # test that we can override a class method with an instance method 2 | 3 | class A: 4 | def foo(self): 5 | return 1 6 | 7 | a = A() 8 | print(a.foo()) 9 | a.foo = lambda:2 10 | print(a.foo()) 11 | -------------------------------------------------------------------------------- /tests/basics/subclass_native5.py: -------------------------------------------------------------------------------- 1 | # Subclass from 2 bases explicitly subclasses from object 2 | 3 | class Base1(object): 4 | pass 5 | 6 | class Base2(object): 7 | pass 8 | 9 | class Sub(Base1, Base2): 10 | pass 11 | 12 | o = Sub() 13 | -------------------------------------------------------------------------------- /tests/cpydiff/types_bytearray_sliceassign.py: -------------------------------------------------------------------------------- 1 | """ 2 | categories: Types,bytearray 3 | description: Array slice assignment with unsupported RHS 4 | cause: Unknown 5 | workaround: Unknown 6 | """ 7 | b = bytearray(4) 8 | b[0:1] = [1, 2] 9 | print(b) 10 | -------------------------------------------------------------------------------- /tests/extmod/uctypes_native_le.py.exp: -------------------------------------------------------------------------------- 1 | 0x3130 2 | 48 49 3 | TypeError 4 | arr: 48 49 5 | arr of struct: 48 49 6 | IndexError 7 | bf: 48 49 8 | bf 4bit: 3 1 3 0 9 | bytearray(b'21') 10 | bytearray(b'2Q') 11 | bytearray(b'5123') 12 | bytearray(b'51R3') 13 | --------------------------------------------------------------------------------