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
Paul Sokolovsky
58168c8e6b
zephyr/zephyr_getchar: Explicitly yield to other threads on char availability.
...
Without this, if there's a large chunk of data coming from hardware (e.g.
clipboard paste, or fed programmatically from the other side of the console),
there's a behavior of initial mass fill-in of the buffer without any
consumption, which starts much later and doesn't catch up with further
filling, leading to buffer overflow.
2017-04-04 17:14:53 +03:00
Paul Sokolovsky
2908c3ca41
zephyr/modusocket: Factor out socket_new() function.
...
It will be reused e.g. for accept() implementation.
2017-04-04 06:28:14 +03:00
Paul Sokolovsky
6e99a8c94e
zephyr/modusocket: Be sure to use MP_OBJ_FROM_PTR.
2017-04-04 06:21:09 +03:00
Paul Sokolovsky
4c392243ae
zephyr/prj_base.conf: Add config for net_buf logging.
...
Disabled by default.
2017-04-03 12:07:56 +03:00
Paul Sokolovsky
ca81c3ab0b
zephyr/modusocket: Implement recv() for TCP sockets.
...
Short read approach is taken - at most, the remaining data in the current
fragment will be returned.
2017-04-02 16:27:09 +03:00
Paul Sokolovsky
3df65e9bae
zephyr/modusocket: Implement recv() for UDP sockets.
...
The foundation of recv() support is per-socket queue of incoming packets,
implemented using Zephyr FIFO object. This patch implements just recv()
for UDP, because TCP recv() requires much more fine-grained control of
network fragments and handling other issues, like EOF condition, etc.
2017-04-01 09:20: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
Paul Sokolovsky
64d00511e1
zephyr/modusocket: Implement send().
2017-03-31 23:14:39 +03:00
Paul Sokolovsky
88582e33cc
zephyr/modusocket: Implement bind() and connect().
2017-03-31 23:02:41 +03:00
Paul Sokolovsky
6cc1a7a214
zephyr: Integrate modusocket into build.
2017-03-31 00:06:31 +03:00
Paul Sokolovsky
d1015f0e0d
zephyr/modusocket: Initial version of usocket module for Zephyr.
...
So far, socket creation and closure is implemented.
2017-03-31 00:04:31 +03:00
Paul Sokolovsky
344bfbb71c
zephyr: Fix NLR segfault in minimal build.
...
Requires inclusion of zephyr.h to properly detect that we're building for
Zephyr.
2017-03-30 22:17:18 +03:00
Paul Sokolovsky
df48f4645d
zephyr/Makefile: Add workaround (fix?) for broken builds for DTS targets.
2017-03-30 15:16:55 +03:00
Paul Sokolovsky
29dd92c82a
zephyr/Makefile: Rework to use modern, official build integration.
...
Build happens in 3 stages:
1. Zephyr config header and make vars are generated from prj.conf.
2. libmicropython is built using them.
3. Zephyr is built and final link happens.
2017-03-30 00:08:27 +03:00
Paul Sokolovsky
e93c4ca181
zephyr/prj_base.conf: Enable TCP (and UDP explicitly).
2017-03-29 00:46:06 +03:00
Paul Sokolovsky
dbb2aea428
zephyr/prj_base.conf: Disable legacy kernel compatibility.
...
This keeps dependency on mdef, sysgen and other stuff which complicates
build integration.
2017-03-27 17:06:30 +03:00
Paul Sokolovsky
220df8544b
zephyr/zephyr_getchar: Use native k_sem instead of legacy nano_sem.
2017-03-27 00:41:58 +03:00
Paul Sokolovsky
99866a00a0
py/nlrx86: Better check for Zephyr (requires 1.7).
2017-03-26 00:33:23 +03:00
Damien George
180045bce9
zephyr/main: Move lexer constructor to within NLR handler block.
...
And raise an exception when mp_lexer_new_from_file is called.
2017-03-14 11:52:05 +11:00
Paul Sokolovsky
9c9674a325
zephyr/main: Remove unused __fatal_error().
2017-03-14 00:19:35 +03:00
Paul Sokolovsky
f5aac7d33f
zephyr/main: nlr_jump_fail: Fix noreturn warning.
2017-03-13 00:43:36 +03:00
Paul Sokolovsky
40e541063f
zephyr: Move "minimal" configuration building to a separate wrapper script.
...
Minimal config can be now build with:
./make-minimal BOARD=...
This is required because of Makefile.exports magic, which in its turn depends
on PROJ_CONF to be set correctly at the beginning of Makefile parsing at all
times. Instead of adding more and more workarounds for that, it's better to
just move minimal support to a separate wrapper.
Also, remove Zephyr 1.5 era cruft from Makefile, and add support for Zephyr's
"run" target which supercedes older "qemu" target in upstream.
2017-03-12 23:54:12 +03:00
Paul Sokolovsky
736a8a8ac7
zephyr: Make sure that generated prj.conf is updated only on content changes.
...
This is a typical problem with make: we want to trigger rebuilds only
if file actually changed, not if its timestamp changed. In this case,
it's aggravated by the fact that prj.conf depends on the value of
BOARD variable, so we need to do some tricks anyway. We still don't
try to detect if just BOARD changed, just try to generate new
prj.conf.tmp every time (quick), but do actual replacement of prj.conf
only if its content changed.
2017-03-12 22:28:45 +03:00
Paul Sokolovsky
e8d4527996
zephyr/modzephyr: Fix typo in identifier.
2017-03-09 10:18:21 +01:00
Paul Sokolovsky
a64a0276b3
zephyr/modzephyr: Add a module for Zephyr-specific things.
...
Mostly intended to ease experimentation, no particular plans for APIs
so far (far less their stability), is_preempt_thread() provided is
mostly an example.
2017-03-08 08:55:50 +01:00
Paul Sokolovsky
3d739eb398
zephyr/README: Network startup issues with frdm_k64f resolved.
...
But leave a generic warning that users should be aware of Zephyr's
limitations/issues for a board they use.
2017-02-17 22:08:42 +03:00
Paul Sokolovsky
453f98914e
zephyr/main: Don't unconditionally dump stats on each GC.
...
This was a debug output for initial porting, breaks tests.
2017-02-14 23:31:47 +03:00
Paul Sokolovsky
ce2703599f
zephyr: Add qemu_cortex_m3 config fragment.
...
Should work for QEMU networking with soon-to-merged upstream patch.
2017-02-14 17:01:26 +03:00
Paul Sokolovsky
64916436b2
zephyr: Enable IPv6 networking in addition to IPv4.
2017-02-14 16:23:54 +03:00
Paul Sokolovsky
00bd145398
zephyr/README: Describe many gotchas of networked builds.
2017-02-01 21:28:11 +03:00
Paul Sokolovsky
d335904666
zephyr/Makefile.zephyr: Support and default to networked (SLIP) QEMU.
...
Also works for non-networked builds (like minimal).
2017-01-30 21:27:29 +03:00
Paul Sokolovsky
300ecac336
zephyr/prj_frdm_k64f.conf: Add, enable Ethernet support.
2017-01-27 23:48:42 +03:00
Paul Sokolovsky
1df1642b70
zephyr: Allow to have per-board Zephyr config fragments.
...
To enable options which may be incompatible with other boards, etc.
2017-01-27 23:42:11 +03:00
Paul Sokolovsky
40e72e4a5c
zephyr: Make sure that correct Zephyr config is used for "minimal" build.
...
Overriding CONF_FILE in "minimal" target itself is too late due to include-
pinned $(Z_EXPORTS) target.
2017-01-27 21:43:13 +03:00
Damien George
77e0cee49e
zephyr: Convert to use builtin help function.
2017-01-22 11:56:16 +11:00
Paul Sokolovsky
5298472fee
zephyr: Enable SLIP networking for the default build.
...
This makes MicroPython app running in QEMU be pingable from the host (by
following QEMU networking setup instructions,
https://www.zephyrproject.org/doc/samples/net/qemu_setup.html ).
2017-01-21 17:16:35 +03:00
Paul Sokolovsky
1459f81429
zephyr: Add separate Zephyr config for "minimal" build.
...
In anticipation of enabling more features in the default build. Also, fix
compilation of minimal build.
2017-01-21 16:13:32 +03:00
Paul Sokolovsky
f1f2a3cebf
zephyr: Remove deprecated .mdef file.
2017-01-21 00:26:03 +03:00
Paul Sokolovsky
58722103e1
zephyr/help: Update n_args param type to size_t.
2017-01-20 23:58:42 +03:00
Paul Sokolovsky
bbd0d27a25
zephyr: Enable slice subscription.
...
Required for the testsuite.
2016-12-18 21:52:52 +03:00
Paul Sokolovsky
56a514c193
zephyr/uart_core: Access console UART directly instead of printk() hack.
...
This is required to avoid extra level of output "cooking" ("\r\r\n") and
make test infrastructure work. On the other hand, this breaks somewhat
Zephyr console abstraction.
2016-12-17 00:48:56 +03:00
Paul Sokolovsky
0c59c30fde
zephyr: Use core-provided keyboard exception object.
2016-12-16 01:07:28 +03:00
Paul Sokolovsky
724b82559d
zephyr/main: Initialize sys.path and sys.argv.
2016-12-16 00:33:33 +03:00
Paul Sokolovsky
c16e7eae5e
zephyr: Implement soft reset feature.
2016-12-15 01:10:08 +03:00
Paul Sokolovsky
95fe7a40b3
zephyr: Support raw REPL.
2016-12-15 00:58:08 +03:00
Paul Sokolovsky
1779a62085
zephyr: Switch to Zephyr 1.6 unified kernel API.
...
In 1.6, Zephyr switched to "unified kernel" and new API set. Older kernel
API is supported, but marked as deprecated and leads to warnings.
2016-12-04 00:47:20 +03:00
Paul Sokolovsky
295266178c
zephyr/zephyr_getchar: Update to Zephyr 1.6 unified kernel API.
2016-11-30 01:42:58 +03:00
Paul Sokolovsky
a6de451a13
zephyr: Add .gitignore to ignore Zephyr's "outdir" directory.
...
That's where Zephyr keeps object files and produced executables.
2016-11-30 00:26:31 +03:00
Paul Sokolovsky
2bf96612d2
zephyr/mphalport.h: Update for new "unified" kernal API (sleep functions).
2016-11-09 00:11:30 +03:00
Paul Sokolovsky
3ccdbf792c
zephyr/Makefile: Add -fomit-frame-pointer.
...
Somehow, Zephyr uses -fno-omit-frame-pointer, whch bloats code size
considerably (+5K for minimal ARM Thumb2 build).
2016-11-05 00:23:10 +03:00
Paul Sokolovsky
50e8e28f96
zephyr/Makefile: Add minimal port.
2016-11-05 00:22:37 +03:00
Paul Sokolovsky
f59465d763
zephyr/Makefile: Allow to override Zephyr config from make command line.
2016-11-04 19:42:43 +03:00
Paul Sokolovsky
919fc2dc47
zephyr/Makefile: Update comments to the current state of affairs.
2016-11-04 19:13:49 +03:00
Paul Sokolovsky
688cc79294
zephyr/Makefile: Allow to adjust heap size from make command line.
2016-11-04 19:09:39 +03:00
Paul Sokolovsky
13f7a7b86b
zephyr/mpconfigport.h: Move less important params to the bottom.
2016-11-04 18:56:04 +03:00
Paul Sokolovsky
d86cac4b82
extmod/utime_mphal: Implement ticks_add(), add to all maintained ports.
2016-10-29 17:30:05 +03:00
Paul Sokolovsky
aee6483536
zephyr/README: Update for the current featureset, add more info.
2016-10-28 21:51:18 +03:00
Paul Sokolovsky
938c693948
zephyr: Support time -> utime module "weaklink".
...
So, now it's possible to just do normal Python's "import time".
2016-10-28 21:38:52 +03:00
Paul Sokolovsky
b0feef7a57
zephyr/zephyr_getchar: Update for recent Zephyr refactor of console hooks.
...
uart_irq_input_hook_set() was renamed to uart_console_in_debug_hook_install()
and accepts different params.
2016-10-28 17:53:10 +03:00
Daniel Thompson
67b6d9d499
zephyr: Initial implementation of machine.Pin.
...
The integration with Zephyr is fairly clean but as MicroPython Hardware API
requires pin ID to be a single value, but Zephyr operates GPIO in terms of
ports and pins, not just pins, a "hierarchical" ID is required, using tuple
of (port, pin). Port is a string, effectively a device name of a GPIO port,
per Zephyr conventions these are "GPIO_0", "GPIO_1", etc.; pin is integer
number of pin with the port (supposed to be in range 0-31).
Example of pin initialization:
pin = Pin(("GPIO_1", 21), Pin.OUT)
(an LED on FRDM-K64F's Port B, Pin 21).
There is support for in/out pins and pull up/pull down but currently
there is no interrupt support.
Signed-off-by: Daniel Thompson <daniel.thompson@linaro.org>
Signed-off-by: Vincenzo Frascino <vincenzo.frascino@linaro.org>
Signed-off-by: Paul Sokolovsky <paul.sokolovsky@linaro.org>
2016-10-27 00:47:26 +03:00
Vincenzo Frascino
a3519332b6
zephyr: Use board/SoC values for startup banner based on Zephyr config.
...
This patch modifies the HW macro definition in order to let micropython
report correctly the BOARD and the SOC on which it is working on.
2016-10-26 19:00:16 +03:00
Paul Sokolovsky
3cdccb9b14
zephyr: Fix mp_hal_set_interrupt_char() declaration to be compatible.
...
With other ports. Other ports declare it in mphalport.h, it can be
inline or macro.
2016-10-26 17:53:28 +03:00
Daniel Thompson
479b961d39
zephyr: Implement utime module.
...
This provides time and sleep together with the usual ticks_us/_ms/_diff
and sleep_us/ms family.
We also provide access to Zephyr's high precision timer as ticks_cpu().
Signed-off-by: Daniel Thompson <daniel.thompson@linaro.org>
2016-10-22 20:15:26 +03:00
Paul Sokolovsky
b440307b4a
py/py.mk: Automatically add frozen.c to source list if FROZEN_DIR is defined.
...
Now frozen modules generation handled fully by py.mk and available for reuse
by any port.
2016-10-21 01:08:43 +03:00
Paul Sokolovsky
f17f3314d0
zephyr: Add copyright blurbs.
2016-10-12 22:51:17 +03:00
Paul Sokolovsky
1a01ed0d2a
zephyr/mpconfigport.h: Fix rebasing artifacts.
2016-10-12 19:42:55 +03:00
Daniel Thompson
b6a544b917
zephyr: Implement the help() function.
...
The boot issue text mentions a help() function and encourages
the user to run it. It is very disconcerting to find that the
function does not exist...
Signed-off-by: Daniel Thompson <daniel.thompson@linaro.org>
2016-10-12 19:31:39 +03:00
Paul Sokolovsky
06ee5e947f
zephyr/Makefile: Be sure to extra qstr's from port sources.
2016-10-12 19:15:32 +03:00
Paul Sokolovsky
93c76d2b06
zephyr: Add Ctrl+C handling.
2016-10-10 23:02:51 +03:00
Paul Sokolovsky
1b76f88e7a
zephyr/zephyr_getchar: Add support for Ctrl+C handling.
...
Patch on top of upstream Zephyr console helpers.
2016-10-10 23:02:36 +03:00
Paul Sokolovsky
aa7828f822
zephyr/main: Execute main.py frozen module on boot, if available.
2016-10-10 22:59:34 +03:00
Paul Sokolovsky
7e3b21ec54
zephyr: Enable frozen modules support.
2016-10-10 21:40:08 +03:00
Paul Sokolovsky
b3a65791b1
zephyr: Enable stack checking and micropython.mem_info().
2016-10-10 21:36:38 +03:00
Paul Sokolovsky
ac70119779
zephyr: Add README.
2016-10-10 21:23:58 +03:00
Daniel Thompson
5a699a7017
zephyr: Use recently added "make outputexports" Zephyr target.
...
The outputexpors target, which exports Zephyr environment variables, was
recently added to Zephyr. By exploiting this feature we can hugely simplify
the build system, improving robustness at the same time.
Signed-off-by: Daniel Thompson <daniel.thompson@linaro.org>
2016-10-10 02:47:32 +03:00
Paul Sokolovsky
244b02f744
zephyr/Makefile: Automatically derive target-specific CFLAGS.
...
By tricking Zephyt arch Makefiles compute them for us (not just for
Zephyr). This make potentially break as Zephyr evolves.
2016-10-10 02:06:06 +03:00
Daniel Thompson
cbc0bf6fec
zephyr: Support extra make targets
...
The two variables, GENERIC_TARGETS and CONFIG_TARGETS come, respectively,
from the the lists shown during "make help" and "make kconfig-help".
Signed-off-by: Daniel Thompson <daniel.thompson@linaro.org>
2016-10-10 02:02:50 +03:00
Daniel Thompson
2ea52cb045
zephyr: Automatically derive ARCH.
...
Currently to compile for anything that except ARCH=x86 we have to
provide ARCH via the environment or make arguments. We can do better
than that!
Signed-off-by: Daniel Thompson <daniel.thompson@linaro.org>
2016-10-10 01:44:23 +03:00
Paul Sokolovsky
7df9f313c6
zephyr: Switch to microkernel, required for network to work in background.
2016-10-10 01:41:38 +03:00
Paul Sokolovsky
9ad5032164
zephyr: Add zephyr_getchar module to handle console input.
...
From https://github.com/pfalcon/zephyr_getchar .
2016-10-10 01:35:39 +03:00
Paul Sokolovsky
9d9efc0c5a
zephyr: Initial Zephyr RTOS port, Zephyr part.
2016-10-10 01:35:24 +03:00
Paul Sokolovsky
cff9f02cd7
zephyr: Initial Zephyr RTOS port, MicroPython part.
2016-10-10 01:35:14 +03:00