Commit Graph

5 Commits

Author SHA1 Message Date
Jim Mussared 8a0ee5a5c0 py/objstr: Split mp_obj_str_from_vstr into bytes/str versions.
Previously the desired output type was specified.  Now make the type part
of the function name.  Because this function is used in a few places this
saves code size due to smaller call-site.

This makes `mp_obj_new_str_type_from_vstr` a private function of objstr.c
(which is almost the only place where the output type isn't a compile-time
constant).

This saves ~140 bytes on PYBV11.

Signed-off-by: Jim Mussared <jim.mussared@gmail.com>
2022-08-26 16:43:55 +10:00
Damien George 926b554daf extmod/moduos: Create general uos module to be used by all ports.
Based on the rp2 port version, with the rp2 port converted to use this
module.

Signed-off-by: Damien George <damien@micropython.org>
2022-03-09 10:03:23 +11:00
iabdalkader 5db278f1dd rp2/mphalport: Add optional dupterm support. 2022-01-20 16:57:03 +11:00
robert-hh 6f06dcaee5 rp2/moduos: Implement uos.urandom().
The implementation samples rosc.randombits at a frequency lower than the
oscillator frequency.  This gives better random values.  In addition, for
an 8-bit value 8 samples are taken and fed through a 8-bit CRC,
distributing the sampling over the byte.  The resulting sampling rate is
about 120k/sec.

The RNG does not include testing of error conditions, like the ROSC being
in sync with the sampling or completely failing.  Making the interim value
static causes it to perform a little bit better in short sync or drop-out
situations.

The output of uos.urandom() performs well with the NIST800-22 test suite.
In my trial it passed all tests of the sts 2.1.2 test suite.  I also ran a
test of the random data with the Common Criteria test suite AIS 31, and it
passed all tests too.
2021-04-09 18:24:38 +10:00
Damien George 469345e728 rp2: Add new port to Raspberry Pi RP2 microcontroller.
This commit adds a new port "rp2" which targets the new Raspberry Pi RP2040
microcontroller.

The build system uses pure cmake (with a small Makefile wrapper for
convenience).  The USB driver is TinyUSB, and there is a machine module
with most of the standard classes implemented.  Some examples are provided
in the examples/rp2/ directory.

Work done in collaboration with Graham Sanderson.

Signed-off-by: Damien George <damien@micropython.org>
2021-01-30 00:42:29 +11:00