Commit Graph

3138 Commits

Author SHA1 Message Date
Damien George d0caaadaee stmhal: Allow network, uselect, usocket mods to be used by other ports.
Remove include of stm32f4xx_hal.h, replace by include of MICROPY_HAL_H
where needed, and make it compile without float support.  This makes
these 3 modules much more generic and usable by other ports.
2014-12-07 17:03:47 +00:00
Damien George 1f8a2f6623 windows: define __USE_MINGW_ANSI_STDIO for all Windows compilers. 2014-12-06 19:51:30 +00:00
Damien George 9de6773237 stmhal: Make SPI bus use DMA for transfers.
Uses DMA if interrupts are enabled, polling if they are disabled.
2014-12-06 17:41:17 +00:00
Paul Sokolovsky d4f80f58b8 esp8266/README: Fix typos. 2014-12-06 13:34:18 +02:00
Damien George be6d8be91e py: Rename mp_obj_int_get to mp_obj_int_get_truncated; fix struct.pack.
mp_obj_int_get_truncated is used as a "fast path" int accessor that
doesn't check for overflow and returns the int truncated to the machine
word size, ie mp_int_t.

Use mp_obj_int_get_truncated to fix struct.pack when packing maximum word
sized values.

Addresses issues #779 and #998.
2014-12-05 23:13:52 +00:00
Damien George 451a087075 py: Fix printing of size_t entity; fix qemu-arm for changes to lexer. 2014-12-05 22:50:16 +00:00
Damien George 759cc9bcc8 unix-cpy: Fix build due to change in lexer API. 2014-12-05 21:42:28 +00:00
Damien George a4c52c5a3d py: Optimise lexer by exposing lexer type.
mp_lexer_t type is exposed, mp_token_t type is removed, and simple lexer
functions (like checking current token kind) are now inlined.

This saves 784 bytes ROM on 32-bit unix, 348 bytes on stmhal, and 460
bytes on bare-arm.  It also saves a tiny bit of RAM since mp_lexer_t
is a bit smaller.  Also will run a bit more efficiently.
2014-12-05 19:35:18 +00:00
Paul Sokolovsky 41c07d5b80 docs: uzlib: Typo fix. 2014-12-05 02:08:30 +02:00
Paul Sokolovsky adf4c4cea8 docs: Add quick docs for uzlib. 2014-12-05 00:40:35 +02:00
Damien George c0b3d4540b docs: Update network docs to reflect changes to code. 2014-12-04 19:43:56 +00:00
Damien George 29a1ec1bd6 stmhal: Overhaul network drivers; has generic network protocol in C.
This patch overhauls the network driver interface.  A generic NIC must
provide a set of C-level functions to implement low-level socket control
(eg socket, bind, connect, send, recv).  Doing this, the network and
usocket modules can then use such a NIC to implement proper socket
control at the Python level.

This patch also updates the CC3K and WIZNET5K drivers to conform to the
new interface, and fixes some bugs in the drivers.  They now work
reasonably well.
2014-12-04 18:57:57 +00:00
Damien George d8f239263d drivers, wiznet5k: Add socket_reset; fix orderly shutdown in recv. 2014-12-04 18:57:18 +00:00
Damien George 32ef3a3517 py: Allow bytes/bytearray/array to be init'd by buffer protocol objects.
Behaviour of array initialisation is subtly different for bytes,
bytearray and array.array when argument has buffer protocol.  This patch
gets us CPython conformant (except we allow initialisation of
array.array by buffer with length not a multiple of typecode).
2014-12-04 15:46:14 +00:00
Paul Sokolovsky 3a5352b483 docs: Add skeleton docs for ure module. 2014-12-04 00:07:00 +02:00
Damien George cd97a43f8d py, vm: Make unum a local variable for each opcode that uses it.
This makes no change to the generated code, but it's now easier to
understand since unum is not a "global" variable anymore.
2014-12-02 19:25:10 +00:00
Damien George 57c70d6073 stmhal: Move RTC HAL init functions to rtc.c, where they belong.
So can remove unnecessary stm32f4xx_hal_msp.c file.
2014-12-02 12:40:37 +00:00
Damien George 578ea6d4a5 docs: Add links to LCD and AMP skin schematics. 2014-12-02 12:32:39 +00:00
Paul Sokolovsky d8fd3103fa docs: Add quick docs for ubinascii. 2014-12-02 01:51:56 +02:00
Paul Sokolovsky d96a916405 docs: Add quick docs for uhashlib. 2014-12-02 00:53:19 +02:00
Paul Sokolovsky 7f0699eedf docs: Sort "micro-library" module list alphabetically. 2014-12-01 20:42:38 +02:00
Paul Sokolovsky 6e8ff9cd68 modmicropython: Move mem_info() and qstr_info() functions from unix port.
TODO: Merge useful functionality from modpyb too.
2014-12-01 20:42:24 +02:00
Damien George 17c5ce3727 tools: Make pyboard.py have infinite timeout when running script.
This makes pyboard.py much more useful for long running scripts.  When
running a script via pyboard.py, it now waits until the script finishes,
with no timeout.  CTRL-C can be used to break out of the waiting if
needed.
2014-11-30 21:30:53 +00:00
Damien George 1960475ed7 stmhal: Make pyb.[u]delay use systick with IRQs, busy loop otherwise.
pyb.delay and pyb.udelay now use systick if IRQs are enabled, otherwise
they use a busy loop.  Thus they work correctly when IRQs are disabled.
The busy loop is computed from the current CPU frequency, so works no
matter the CPU frequency.
2014-11-30 21:23:25 +00:00
Damien George c7ca01ad96 py: Generalise and reduce code size of array +, += and .extend().
By using the buffer protocol for these array operations, we now allow
addition of memoryview objects, and objects with "incompatible"
typecodes (in this case it just adds bytes naively).  This is an
extension to CPython which seems sensible.  It also reduces the code
size.
2014-11-30 14:01:33 +00:00
Henrik Sölver d8c2b2a1c4 Update documentation for the CAN class 2014-11-30 01:04:56 +00:00
Damien George b2e731177e py: Implement +, += and .extend for bytearray and array objs.
Addresses issue #994.
2014-11-30 00:00:55 +00:00
Damien George 19fb1b4dd7 stmhal: Add USB_VCP.setinterrupt method, to disable CTRL-C. 2014-11-29 15:23:21 +00:00
Damien George b395220ef0 esp8266: Add README.md. 2014-11-29 15:06:20 +00:00
Damien George 7288403b9b tests: Split out float test from builtin_round.py. 2014-11-29 14:47:54 +00:00
Damien George 3b603f29ec Use MP_DEFINE_CONST_DICT macro to define module dicts.
This is just a clean-up of the code.  Generated code is exactly the
same.
2014-11-29 14:39:27 +00:00
Damien George e636279fe0 esp8266: Move more rodata to irom section.
rodata can only go in iram/irom if it's accessed only using word loads
(ie no byte or half-word access).
2014-11-29 14:36:18 +00:00
Paul Sokolovsky bfdc205934 modubinascii: Add, with hexlify() implementation. 2014-11-29 13:52:47 +00:00
Damien George d96e6b14c9 esp8266: Make default ESP_SDK variable work correctly.
When esp-open-sdk is built with STANDALONE=y (the default) then ESP_SDK
is set to the correct value, so that "make" just works.
2014-11-28 18:05:25 +00:00
Damien George 722fab7c2a docs: Bump version to 1.3.7. 2014-11-28 17:48:48 +00:00
inaugurator 9aae41121b Update uheapq.rst
Erratum in froh.
2014-11-28 17:32:29 +00:00
Damien George fbea810043 esp8266: Change bignum from mpz to longlong; move some rodata to iram.
Some rodata items can go in iram/irom segment, but not others.  With
this patch ESP now has 24256 bytes of heap ram.  It passes 228 out of
248 tests from tests/basics directory.
2014-11-28 14:58:25 +00:00
Damien George 5f10065718 esp8266: Provide sensible default ESP_SDK; deploy 2 the images together. 2014-11-28 10:22:01 +00:00
Paul Sokolovsky 1bbc389d67 esp8266: Allow to override serial port. 2014-11-28 01:54:46 +02:00
Damien George 075d597464 esp8266: New port of Micro Python to ESP8266 wifi module. 2014-11-27 20:30:33 +00:00
Damien George 2399aa03b8 py: Add NLR support for xtensa CPU. 2014-11-27 20:29:33 +00:00
Damien George 92f1ed8f40 stmhal: Enable uhashlib module; add heapq, hashlib weak links.
hashlib test passes on pyboard.
2014-11-27 17:54:37 +00:00
Paul Sokolovsky df732bb01b pfenv_printf: Properly implement %p format specifier.
Previously, it truncated pointer value to 32 bits on 64-bit systems.
2014-11-27 17:38:03 +00:00
Paul Sokolovsky 1eca32836d builtin: Reimplement __repl_print__() in terms of print().
Before, __repl_print__() used libc printf(), while print() used uPy streams
and own printf() implementation. This led to subtle, but confusing
differences in output when just doing "foo" vs "print(foo)" on interactive
prompt.
2014-11-27 17:38:03 +00:00
Paul Sokolovsky e5dbe1e283 map: Add empty fixed map.
Useful when need to call kw-receiving functions  without any keywords
from C, etc.
2014-11-27 17:37:07 +00:00
Damien George 317cf18486 stmhal: Remove unnecessary HAL_Delay in readline loop.
The reason for having this delay is to reduce power consumption at the
REPL (HAL_Delay calls __WFI to idle the CPU).  But stdin_rx_chr has a
__WFI in it anyway, so this delay call is not needed.

By removing this call, the readline input can consume characters much
more quickly (before was limited to 1000 chrs/s), and has much reduced
dependency on the specific port.
2014-11-27 17:04:09 +00:00
Damien George 5cbc9e0db0 stmhal: Reduce coupling between USB driver and readline.
This makes it easier to re-use readline.c and pyexec.c from stmhal in
other ports.
2014-11-27 16:58:31 +00:00
Damien George 6f5eb84c19 py: #if guard str_make_new when not needed. 2014-11-27 16:55:47 +00:00
Henrik Sölver acb92c186c Adding CAN filter management 2014-11-26 18:52:33 +00:00
Damien George 20d239cb28 stmhal: Enable DAC on STM32F4DISC.
Addresses issue #987.
2014-11-25 11:42:26 +00:00