Paul Sokolovsky
ca582675e1
zephyr/Makefile: Explicitly define default target as "all".
...
For some reason, with the latest Zephyr master, running just "make" led
to executing Zephyr's "qemu" target.
2017-08-03 00:16:38 +03:00
Alexander Steffen
55f33240f3
all: Use the name MicroPython consistently in comments
...
There were several different spellings of MicroPython present in comments,
when there should be only one.
2017-07-31 18:35:40 +10:00
Alexander Steffen
299bc62586
all: Unify header guard usage.
...
The code conventions suggest using header guards, but do not define how
those should look like and instead point to existing files. However, not
all existing files follow the same scheme, sometimes omitting header guards
altogether, sometimes using non-standard names, making it easy to
accidentally pick a "wrong" example.
This commit ensures that all header files of the MicroPython project (that
were not simply copied from somewhere else) follow the same pattern, that
was already present in the majority of files, especially in the py folder.
The rules are as follows.
Naming convention:
* start with the words MICROPY_INCLUDED
* contain the full path to the file
* replace special characters with _
In addition, there are no empty lines before #ifndef, between #ifndef and
one empty line before #endif. #endif is followed by a comment containing
the name of the guard macro.
py/grammar.h cannot use header guards by design, since it has to be
included multiple times in a single C file. Several other files also do not
need header guards as they are only used internally and guaranteed to be
included only once:
* MICROPY_MPHALPORT_H
* mpconfigboard.h
* mpconfigport.h
* mpthreadport.h
* pin_defs_*.h
* qstrdefs*.h
2017-07-18 11:57:39 +10:00
Damien George
d91c1170ca
zephyr: Remove long-obsolete machine_ptr_t typedef's.
2017-07-17 15:17:06 +10:00
Paul Sokolovsky
bfa68ef6b2
zephyr/Makefile: Revert prj.conf construction rule to the previous state.
...
CONF_FILE can be overriden, e.g. for minimal build, and we don't construct
such overriden conf file like we do for prj_merged.conf.
2017-07-09 11:56:37 +03:00
Paul Sokolovsky
0c75990d6e
zephyr/Makefile: Rework dependencies and "clean" target.
...
Got tired of running rm -rf manually. Make should clean, and should clean
fast. Also, fix always-running config-related commands (by having per-board
merged configs).
2017-07-08 21:36:16 +03:00
Paul Sokolovsky
0161939ed1
zephyr/machine_pin: Use native Zephyr types for Zephyr API calls.
...
In 1.8, Zephyr made a controversial change of dumping C99 stdint types
and switching to its own types.
2017-06-10 19:40:31 +03:00
Paul Sokolovsky
4352b944d2
zephyr: Define MICROPY_PY_SYS_PLATFORM (to "zephyr").
2017-06-08 17:58:55 +03:00
Paul Sokolovsky
43f58386e0
zephyr/modusocket: getaddrinfo: Fix mp_obj_len() usage.
...
Return value is mp_obj_t, so needs to be accessed using
MP_OBJ_SMALL_INT_VALUE().
2017-06-03 16:11:53 +03:00
Ville Skyttä
ca16c38210
various: Spelling fixes
2017-05-29 11:36:05 +03:00
Paul Sokolovsky
011684bd4f
zephyr/modusocket: Use DEBUG_PRINT macro name as other modules do.
...
Indeed, just "DEBUG" is too generic.
2017-05-26 10:20:25 +03:00
Paul Sokolovsky
982e676902
zephyr/modusocket: getaddrinfo: Raise OSError on resolution timeout, etc.
2017-05-24 19:55:14 +03:00
Paul Sokolovsky
bcf31a3908
esp8266, stmhal, zephyr: Rename machine.Pin high/low methods to on/off.
...
For consistent Pin/Signal class hierarchy. With it, Signal is a proper
(while still ducktyped) subclass of a Pin, and any (direct) usage of Pin
can be replace with Signal.
As stmhal's class is reused both as machine.Pin and legacy pyb.Pin,
high/low methods actually retained there.
2017-05-21 17:44:58 +03:00
Paul Sokolovsky
0912334f54
zephyr/modusocket: getaddrinfo: Use RAISE_ERRNO for proper error decoding.
2017-05-17 00:21:22 +03:00
Paul Sokolovsky
5f648ff60e
zephyr/main: Check default netif before applying operations to it.
...
If no network driver is enabled (e.g., it doesn't exist for a particular
board), it will be NULL.
2017-05-17 00:17:53 +03:00
Paul Sokolovsky
aa9ce283c2
zephyr/modusocket: Get rid of cur_pkt object member.
...
Instead, just peek a packet at the head of the queue and work with it.
2017-05-16 13:46:54 +03:00
Paul Sokolovsky
a3008e447c
zephyr/modusocket: First step to switch to alternative FIFO processing.
...
Here we wait for non-empty FIFO, and then directly access/drop its head
element.
2017-05-16 13:43:06 +03:00
Paul Sokolovsky
0c57979ce2
zephyr/modusocket: Implement getaddrinfo().
2017-05-13 16:42:35 +03:00
Paul Sokolovsky
86c4544ef9
zephyr/modusocket: If there're no packets in recv_q, cancel waiter.
...
This solves a case when socker_read() has blocked on fifo, and then peer
closed event arrives.
2017-05-13 16:22:14 +03:00
Paul Sokolovsky
69f0b4ad5b
zephyr/modusocket: Switch to net_pkt_append() returning length.
...
Requires patch in review.
2017-05-13 16:05:10 +03:00
Paul Sokolovsky
39d3335606
zephyr/modusocket: Update for net_pkt refactor.
2017-05-13 15:47:47 +03:00
Paul Sokolovsky
c022c9a2f0
zephyr/modusocket: Wrap pkt_get_info() call.
...
The most important info it returns are numbers of free buffers
in different pools (rx/tx packet headers, data fragments).
2017-05-13 15:23:31 +03:00
Paul Sokolovsky
5383a50072
zephyr/README: Update to require Zephyr 1.8.
...
There're a lot of changes and fixes in 1.8 regarding IP stack,
incompatible with previous Zephyr versions, so supporting them
doesn't make sense.
This is the last commit which should build with Zephyr 1.7.
2017-05-12 22:05:07 +03:00
Paul Sokolovsky
d57c6564dc
zephyr/prj_qemu_x86.conf: Bump RAM size to 320K.
2017-05-12 21:58:51 +03:00
Paul Sokolovsky
50d7ed325a
zephyr/modusocket: Add SOL_SOCKET and SO_REUSEADDR constants.
2017-05-12 21:55:42 +03:00
Paul Sokolovsky
1659c0645d
zephyr/modusocket: Add dummy setsockopt() implementation.
2017-05-12 21:54:32 +03:00
Paul Sokolovsky
4c2fa83f2a
zephyr/main: Remove superfluous include.
2017-05-02 23:35:13 +03:00
Paul Sokolovsky
b5159a9149
zephyr/mpconfigport.h: Enable line number information for scripts.
2017-05-02 23:33:16 +03:00
Paul Sokolovsky
674da04e2e
zephyr/Makefile: Add debugserver Zephyr target.
2017-05-02 01:12:02 +03:00
Paul Sokolovsky
31bbcd448c
zephyr/modusocket: Add dummy makefile() implementation.
2017-04-27 14:57:49 +03:00
Paul Sokolovsky
868453d3d8
zephyr/modusocket: sock_read: Check socket status only at the start of packet.
...
Otherwise, if we already have a packet in progress, finish it first, before
check "peer closed" status.
2017-04-26 09:14:41 +03:00
Paul Sokolovsky
1fe0f678f8
zephyr/modusocket: Add read/readline/readinto stream methods.
2017-04-26 08:43:07 +03:00
Paul Sokolovsky
ef55be159c
zephyr/modusocket: Refactor recv() into stream read() method.
2017-04-26 08:43:07 +03:00
Paul Sokolovsky
63068875c5
zephyr/modusocket: Enable stream write() method.
2017-04-26 01:06:42 +03:00
Paul Sokolovsky
0e177e0649
zephyr/modusocket: Refactor send() into stream write() method.
2017-04-26 01:05:54 +03:00
Kushal Das
083cd21a74
zephyr: Add 96b_carbon configuration.
...
As there's no networking support in mainline yet, networking is disabled,
because otherwise the board hangs on startup.
2017-04-26 00:22:48 +03:00
Paul Sokolovsky
5e66f2b751
zephyr/main: Configure IPv4 netmask and gateway to allow Internet access.
2017-04-22 19:29:47 +03:00
Paul Sokolovsky
5846770997
zephyr/modmachine: Implement machine.reset().
2017-04-19 13:28:36 +03:00
Paul Sokolovsky
209eaec599
socket_send: Don't send more than MTU allows.
...
As Zephyr currently doesn't handle MTU itself (ZEP-1998), limit amount
of data we send on our side.
Also, if we get unsuccessful result from net_nbuf_append(), calculate
how much data it has added still. This works around ZEP-1984.
2017-04-14 19:46:27 +03:00
Paul Sokolovsky
84e17063c3
zephyr/modusocket: Strip packet header right in the receive callback.
...
Instead of complicating recv() implementation.
2017-04-13 22:19:16 +03:00
Paul Sokolovsky
81d302b8f8
zephyr/modusocket: Call net_nbuf_print_frags() in recv callback if DEBUG > 1.
2017-04-11 15:25:42 +03:00
Paul Sokolovsky
0a88b44248
zephyr/machine_pin: Implement pin protocol for machine.Signal support.
2017-04-08 14:27:36 +03:00
Paul Sokolovsky
e05cb4183a
zephyr/modmachine: Add Signal class.
2017-04-08 00:50:19 +03:00
Paul Sokolovsky
cf70f9a474
zephyr/mpconfigport.h: Fix build if usocket module is disabled.
2017-04-08 00:38:51 +03:00
Paul Sokolovsky
8ef469f7ca
zephyr/modusocket: Implement accept().
2017-04-08 00:33:09 +03:00
Paul Sokolovsky
96166ec165
zephyr/modusocket: socket_bind: Don't set recv callback on STREAM sockets.
...
For stream sockets, next exected operation is listen().
2017-04-08 00:30:17 +03:00
Paul Sokolovsky
f1c0676a70
zephyr/modusocket: Implement listen().
2017-04-07 16:47:10 +03:00
Paul Sokolovsky
1da8404647
modusocket: Handle a case when recv_q is empty when EOF is signaled.
...
In this case, we can mark socket as closed directly.
2017-04-06 10:12:14 +03:00
Paul Sokolovsky
faf333c04f
zephyr/modusocket: Factor out "extended k_fifo API".
...
Internal structure of k_fifo changed between 1.7 and 1.8, so we need
to abstract it away. This adds more functions than currently used, for
future work.
2017-04-05 13:39:16 +03:00
Paul Sokolovsky
a9e6f08adb
zephyr/Makefile: Add "test" target, runs testsuite in QEMU.
2017-04-05 00:46:00 +03:00