Commit Graph

25 Commits

Author SHA1 Message Date
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