Commit Graph

475 Commits

Author SHA1 Message Date
Damien George e6782428be cc3200: Initialise variable to zero to prevent compiler warnings. 2017-06-20 17:14:48 +10:00
Damien George 1686346d53 cc3200: Make non-zero socket timeout work with connect/accept/send.
The CC3100 only allows to set a timeout for receiving data, not for accept,
connect or send.  But it can set non-blocking for all these operations and
this patch uses that feature to implement socket timeout in terms of non-
blocking behaviour combined with a loop.
2017-06-20 16:52:39 +10:00
Damien George 4f9858e86d stmhal: Move pybstdio.c to lib/utils/sys_stdio_mphal.c for common use.
It provides sys.stdin, sys.stdout, sys.stderr for bare-metal targets based
on mp_hal functions.
2017-06-15 18:55:34 +10:00
Damien George 696fcde800 cc3200/modusocket: Simplify socket.makefile() function.
Following how extmod/modlwip.c does it.
2017-06-14 17:40:02 +10:00
Damien George 6ff0ecfffc ports: Convert from using stmhal's input() to core provided version. 2017-06-01 16:02:49 +10:00
Ville Skyttä ca16c38210 various: Spelling fixes 2017-05-29 11:36:05 +03:00
Paul Sokolovsky 19e065294d cc3200/mods/pybpin: Remove toggle() method.
It's not part of MicroPython HW API and can be easily implemented on Python
level in case of need.

Saved 56 bytes of binary.
2017-05-21 15:39:27 +03:00
Damien George f1609bc843 ports: Add ilistdir in uos module. 2017-05-10 12:13:53 +10:00
Damien George 9d7c53734c cc3200/mods/pybi2c: Make readfnom_mem_into/writeto_mem return None.
This aligns the I2C class to match the standard machine.I2C API.

Note that this is a (small) breaking change to the existing cc3200 API.
The original API just returned the size of the input buffer so there's no
information lost by this change.  To update scripts users should just use
the size of the buffer passed to these functions to get the number of bytes
that are read/written.
2017-04-18 15:31:08 +10:00
Damien George 8f205c2c9b cc3200/mods/pybi2c: Make machine.I2C constructor/init conform to HW API.
This is a user-facing change to the cc3200's API, to make it conform to the
new machine hardware API.  The changes are:

- change I2C constructor to: I2C(id=0, *, freq=100000, scl=None, sda=None)
- change I2C init to: init(*, freq, scl, sda)
- removal of machine.I2C.MASTER constant
- I2C str/repr no longer prints I2C.MASTER

To update existing code it should be enough to just remove the I2C.MASTER
constant from contructor/init for I2C.
2017-04-18 13:16:05 +10:00
Paul Sokolovsky e322b2afbf cc3200/pybuart: Make parity specifications consistent with HW API.
parity=0 means even parity, parity=1 - odd.
2017-04-09 00:19:02 +03:00
Paul Sokolovsky 9a38b7afe0 cc3200/modmachine: Return frequency value directly, like other ports. 2017-04-05 11:58:17 +03:00
Damien George 4c307bfba1 all: Move BYTES_PER_WORD definition from ports to py/mpconfig.h
It can still be overwritten by a port in mpconfigport.h but for almost
all cases one can use the provided default.
2017-04-01 11:39:38 +11:00
Damien George b6c7e4b143 all: Use full path name when including mp-readline/timeutils/netutils.
This follows the pattern of how all other headers are now included, and
makes it explicit where the header file comes from.  This patch also
removes -I options from Makefile's that specify the mp-readline/timeutils/
netutils directories, which are no longer needed.
2017-03-31 22:29:39 +11:00
Damien George 6bfb344a80 cc3200/mods/pybi2c: Raise OSError if readfrom_mem fails to write addr. 2017-03-29 16:09:46 +11:00
Damien George 3a77342719 cc3200: Update for changes to mp_obj_str_get_data. 2017-03-29 12:56:45 +11:00
Damien George 87f068d7d9 cc3200: Update to use size_t for tuple/list accessors. 2017-03-29 12:56:17 +11:00
Krzysztof Blazewicz 75589272ef all/Makefile: Remove -ansi from GCC flags, its ignored anyway.
The -ansi flag is used for C dialect selection and it is equivalent to -std=c90.
Because it goes right before -std=gnu99 it is ignored as for conflicting flags
GCC always uses the last one.
2017-03-23 15:32:12 +11:00
Damien George 1110c8873c cc3200/mods/modutime: Use generic sleep_ms and sleep_us implementations. 2017-03-22 12:57:51 +11:00
Damien George 12d0731b91 extmod/vfs_fat: Remove obsolete and unused str/len members. 2017-03-10 19:09:42 +11:00
Damien George 70201f4038 cc3200/mptask: Allocate flash VFS struct on the heap to trace root ptrs. 2017-03-10 19:09:19 +11:00
Paul Sokolovsky f5ee4d95a9 cc3200/moduos: Remove uos.sep, as it's strictly optional.
In MicroPython, the path separator is guaranteed to be "/", extra unneeded
things take precious code space (in the port which doesn't have basic things
like floating-port support).
2017-02-23 22:10:58 -08:00
Damien George 047af9b10b cc3200: Remove socket.timeout class, use OSError(ETIMEDOUT) instead.
socket.timeout is a subclass of OSError, and using the latter is more
efficient than having a dedicated class.  The argument of OSError is
ETIMEDOUT so the error can be distinguished from other kinds of
OSErrors.  This follows how the esp8266 port does it.
2017-02-22 15:08:32 +11:00
Damien George d03f089baa cc3200/mods/modusocket: Init vars to 0 to silence compiler warnings.
Some compilers can't analyse the code to determine that these variables
are always set before being used.
2017-02-22 14:58:37 +11:00
Damien George e859ddf3e1 cc3200: Enable uerrno module with short, custom list of error codes.
Since we recently replaced the OSError string messages with simple error
codes, having the uerrno module gets back some user friendly error
messages.  The total code size (after removing strings, replacing with
uerrno module) is decreased.
2017-02-22 12:58:11 +11:00
Damien George 22a6344ebe cc3200: When raising OSError's use MP_Exxx as arg instead of a string. 2017-02-22 12:58:11 +11:00
Damien George 8bb8e97dfe cc3200: Convert to using uPy internal errno numbers. 2017-02-22 12:58:11 +11:00
Damien George 85ab469c64 cc3200: Move wlan socket glue functions from modwlan to modusocket.
It saves about 400 bytes of code space because the functions can now be
inlined.
2017-02-22 11:29:19 +11:00
Damien George 71ae3f389d cc3200: Remove remaining references to std.h. 2017-02-21 18:01:43 +11:00
Damien George 8c5988bf61 cc3200/mods/modwlan: Add int casts to silence compiler warnings. 2017-02-21 17:29:40 +11:00
Damien George 0258f819bd cc3200/mods/modwlan: Allow antenna diversity to be fully compiled out. 2017-02-21 17:29:02 +11:00
Damien George a162832b1a cc3200/mods/modwlan: Make multi-threaded a proper compile-time option. 2017-02-21 17:28:14 +11:00
Damien George 26ddd4b621 cc3200/mods/modwlan: Remove unused header includes; simplify others. 2017-02-21 17:27:17 +11:00
Damien George 1c35270667 cc3200: Remove util/std.h, can just use stdio.h instead. 2017-02-21 17:26:21 +11:00
Damien George d9f7120af1 cc3200: Use simplelink API instead of emulated BSD API.
Most of cc3200 uses explicit simplelink calls anyway, and this means there
are no longer any clashes with macros from the C stdlib.
2017-02-21 17:24:12 +11:00
Damien George 29551ba566 cc3200: Move stoupper to ftp.c and define in terms of unichar_toupper.
ftp.c is the only user of this function so making it static in that file
allows it to be inlined.  Also, reusing unichar_toupper means we no longer
depend on the C stdlib for toupper, saving about 300 bytes of code space.
2017-02-21 17:20:58 +11:00
Damien George ae8d867586 py: Add iter_buf to getiter type method.
Allows to iterate over the following without allocating on the heap:
- tuple
- list
- string, bytes
- bytearray, array
- dict (not dict.keys, dict.values, dict.items)
- set, frozenset

Allows to call the following without heap memory:
- all, any, min, max, sum

TODO: still need to allocate stack memory in bytecode for iter_buf.
2017-02-16 18:38:06 +11:00
Damien George b7d27e31e8 cc3200: Refactor "ticks" functions to use common extmod implementation.
The port now uses the common mp_utime_ticks_{ms,us,cpu,add,diff} functions
from extmod/utime_mphal.c.

The mp_utime_sleep_XXX functions are still cc3200-specific because they
handle the GIL differently to the ones in extmod.

The files misc/mpsystick.[ch] have been removed because they contain 2
unused functions, and the other remaining function is renamed to
mp_hal_ticks_us and moved to hal/cc3200_hal.c.
2017-02-06 11:14:16 +11:00
Damien George b697c89009 extmod: Merge old fsusermount.h header into vfs.h and vfs_fat.h.
vfs.h is for generic VFS declarations, and vfs_fat.h is for VfsFat
specific things.
2017-01-30 12:26:08 +11:00
Damien George 0bd61d23b9 extmod/vfs_fat: Remove MICROPY_FATFS_OO config option.
Everyone should now be using the new ooFatFs library.  The old one is no
longer supported and will be removed.
2017-01-30 12:26:07 +11:00
Damien George 56506fd64a cc3200: Convert to use new VFS sub-system and new ooFatFs library. 2017-01-30 12:26:07 +11:00
Paul Sokolovsky 3a3543251f cc3200/modusocket: Remove deprecated socket.error.
socket.error is deprecated even in upstream:
https://docs.python.org/3/library/socket.html#socket.error,
and never was a part of MicroPython socket API.
2017-01-29 02:47:26 +03:00
Damien George bfa948c0a5 cc3200: Add implementations of mp_import_stat and builtin_open.
They disappeared when stmhal changed to use new MICROPY_VFS code.
2017-01-27 23:22:15 +11:00
Damien George 32a1138b9f extmod: Rename vfs_fat_file.h to vfs_fat.h.
And move declaration of mp_fat_vfs_type to this file.
2017-01-27 15:04:17 +11:00
Damien George 4d7fba83a6 cc3200: Convert to use builtin help function. 2017-01-22 11:56:16 +11:00
Paul Sokolovsky 044f96c330 cc3200/modwlan: Add network.WLAN.print_ver() diagnostic function.
Prints NWP/MAC/PHY version, as affected by servicepack installed.
2017-01-07 19:48:12 +03:00
Paul Sokolovsky eac22e29a5 all: Consistently update signatures of .make_new and .call methods.
Otherwise, they serve reoccurring source of copy-paste mistakes and
breaking nanbox build.
2017-01-04 16:10:42 +03:00
Paul Sokolovsky b315d76b6b cc3200/README: Reorganize and update to the current state of affairs.
Try to put sections in more logical order, and information about cc3200tool
to be the default flashing method.
2016-12-29 19:46:25 +03:00
Paul Sokolovsky 0748143a4c cc3200: Add targets to erase flash, deploy firmware using cc3200tool.
cc3200tool, https://github.com/ALLTERCO/cc3200tool is a (mostly, some
binary blobs present) open-source, Linux-friendly tool to flash a cc3200
devices. It's an alternative to fully proprietary, Windows-only Uniflash
from TI.

The provided make targets are for erasing flash, flashing the uPy
bootloader and firmware, and flashing vendor's WiFi firmware "servicepacks"
(the latter needs to be downloaded from vendor side, a link is present
inside Makefile).
2016-12-29 17:12:47 +03:00
Paul Sokolovsky 45a8cc8f0b cc3200: make: Rename "deploy" target to "deploy-ota".
There should be target to deploy uPy over wired (UART) connection, and
wired and OTA targets should be named differently.
2016-12-29 01:27:50 +03:00