Commit Graph

46 Commits

Author SHA1 Message Date
Damien George
647b27d028 zephyr/machine_i2c: Update to support new C-level I2C API. 2019-05-20 15:04:29 +10:00
Damiano Mazzella
3c9f78b048 zephyr/CMakeLists.txt: Set AR to point to the Zephyr toolchain exe. 2019-04-11 12:24:05 +10:00
Maureen Helm
2befcb8a9d zephyr/i2c: Add support for hardware i2c.
Adds support for hardware i2c to the zephyr port. Similar to other ports
such as stm32 and nrf, we only implement the i2c protocol functions
(readfrom and writeto) and defer memory operations (readfrom_mem,
readfrom_mem_into, and writeto_mem) to the software i2c implementation.
This may need to change in the future because zephyr is considering
deprecating its i2c_transfer function in favor of i2c_write_read; in this
case we would probably want to implement the memory operations directly
using i2c_write_read.

Tested with the accelerometer on frdm_k64f and bbc_microbit boards.
2019-03-26 16:16:26 +11:00
Maureen Helm
493ee7df18 zephyr/prj_frdm_kw41z.conf: Add new board configuration.
Adds a new board configuration for the frdm_kw41z board, including support
for the fxos8700 accelerometer/magnetometer/die temperature sensor.
2019-03-12 17:12:13 +11:00
Maureen Helm
7748375b6e zephyr/prj_frdm_k64f.conf: Add fxos8700 sensor.
Adds the fxos8700 accelerometer/magnetometer/die temperature sensor to the
frdm_k64f board configuration.
2019-03-12 17:12:00 +11:00
Paul Sokolovsky
6d82499a48 zephyr/Makefile: Proxy ram_report, rom_report targets from Zephyr. 2019-03-12 17:11:52 +11:00
Paul Sokolovsky
755b0b807b zephyr/prj_minimal.conf: Switch to CONFIG_STDOUT_CONSOLE.
Prompted by code size analysis, after arduino_101 build overflowing ROM.
2019-03-12 17:11:46 +11:00
Paul Sokolovsky
21fc0c448e zephyr/modzsensor: Rename "TEMP" sensor channel to "DIE_TEMP".
I.e. on-die temperature sensor.  Upstream made more fine-grained channels
for different kinds of temperature.
2019-03-12 17:11:30 +11:00
Paul Sokolovsky
a42c1d9fd5 zephyr/modzephyr: Revamp stacks_analyze() call.
Underlying k_call_stacks_analyze() was gone in Zephyr, reimplement using
k_thread_foreach().
2019-03-12 17:11:09 +11:00
Damien George
6e30f96b0b ports: Convert legacy uppercase macro names to lowercase. 2019-02-12 14:54:51 +11:00
Paul Sokolovsky
2f5d113fad py/warning: Support categories for warnings.
Python defines warnings as belonging to categories, where category is a
warning type (descending from exception type). This is useful, as e.g.
allows to disable warnings selectively and provide user-defined warning
types.  So, implement this in MicroPython, except that categories are
represented just with strings.  However, enough hooks are left to implement
categories differently per-port (e.g. as types), without need to patch each
and every usage.
2019-01-31 16:48:30 +11:00
Paul Sokolovsky
5a91fce9f8 py/objstr: Make str.count() method configurable.
Configurable via MICROPY_PY_BUILTINS_STR_COUNT.  Default is enabled.
Disabled for bare-arm, minimal, unix-minimal and zephyr ports.  Disabling
it saves 408 bytes on x86.
2018-10-22 22:49:05 +11:00
Paul Sokolovsky
0bce110872 zephyr/CMakeLists: Update for latest Zephyr CMake usage refactorings.
Added cmake_minimum_required and updated target_link_libraries directives.
2018-09-14 13:21:13 +10:00
Paul Sokolovsky
ed1a5bc88e zephyr/prj_base.conf: Update for net_config subsys refactor.
net_config subsystem was split off from net_app, and as a result, settings
need renaming from CONFIG_NET_APP_* to CONFIG_NET_CONFIG_*.
2018-09-14 13:21:13 +10:00
Damien George
05e0103e9e zephyr: Rename CONFIG_CONSOLE_PULL to CONFIG_CONSOLE_SUBSYS.
Following a similar change in the Zephyr Project.
2018-06-27 15:33:59 +10:00
Paul Sokolovsky
735358bcf4 zephyr/prj_qemu_x86.conf: Remove outdated CONFIG_RAM_SIZE.
Target RAM size is no longer set using Kconfig options, but instead using
DTS (device tree config). Fortunately, the default is now set to a high
value, so we don't need to use DTS fixup.
2018-06-27 14:59:17 +10:00
Paul Sokolovsky
543352ac21 zephyr/prj_base.conf: Remove outdated CONFIG_NET_NBUF_RX_COUNT option.
CONFIG_NET_NBUF_RX_COUNT no longer exists in Zephyr, for a while. That
means we build with the default RX buf count for a while too, and it works,
so just remove it (instead of switching to what it was renamed to,
CONFIG_NET_PKT_RX_COUNT).
2018-06-27 14:58:54 +10:00
Paul Sokolovsky
478410b409 zephyr/Makefile: Add kobj_types_h_target to Z_EXPORTS.
New generated Zephyr header file, without it build breaks.
2018-05-21 10:35:16 +10:00
Paul Sokolovsky
5a023372df zephyr: Add prj_disco_l475_iot1.conf with sensor drivers. 2018-05-21 10:35:16 +10:00
Paul Sokolovsky
7afbc49863 zephyr/prj_base.conf: Enable DHCP and group static IPs together.
Add CONFIG_NET_DHCPV4, which, after
https://github.com/zephyrproject-rtos/zephyr/pull/5750 works as follows:
static addresses are configured after boot, and DHCP requests are sent
at the same time. If valid DHCP reply is received, it overrides static
addresses.

This setup works out of the box for both direct connection to a
workstation (DHCP server usually is not available) and for connection
to a router (DHCP is available and required).
2018-05-21 10:35:16 +10:00
Paul Sokolovsky
0e52ee957d zephyr/modzsensor: Zephyr sensor subsystem bindings. 2018-05-21 10:35:16 +10:00
Paul Sokolovsky
080b0be1c8 zephyr/mpconfigport.h: Enable uhashlib and ubinascii modules.
To be able to use data integrity checks in various tests.
2018-05-21 10:35:16 +10:00
Paul Sokolovsky
9480c188e8 zephyr/main: After builtin testsuite, drop to REPL.
It makes sense to make even testsuite-enabled builds be suitable for
interactive use.
2018-05-21 10:35:16 +10:00
Paul Sokolovsky
1050045979 zephyr/README: Hint about existence of qemu_x86_nommu. 2018-05-21 10:35:16 +10:00
Damien George
cf31d384f1 py/stream: Switch stream close operation from method to ioctl.
This patch moves the implementation of stream closure from a dedicated
method to the ioctl of the stream protocol, for each type that implements
closing.  The benefits of this are:

1. Rounds out the stream ioctl function, which already includes flush,
   seek and poll (among other things).

2. Makes calling mp_stream_close() on an object slightly more efficient
   because it now no longer needs to lookup the close method and call it,
   rather it just delegates straight to the ioctl function (if it exists).

3. Reduces code size and allows future types that implement the stream
   protocol to be smaller because they don't need a dedicated close method.

Code size reduction is around 200 bytes smaller for x86 archs and around
30 bytes smaller for the bare-metal archs.
2018-04-10 13:41:32 +10:00
Paul Sokolovsky
7a9a73ee84 zephyr/main: Remove unused do_str() function.
The artifact of initial porting effort.
2017-12-26 20:16:08 +02:00
Paul Sokolovsky
d9977a8ad9 zephyr/Makefile: clean: Clean libmicropython.a too. 2017-12-26 14:46:16 +02:00
Paul Sokolovsky
dd35fe7ca0 zephyr/prj_base.conf: Bump MAIN_STACK_SIZE to let builtin testsuite run. 2017-12-15 18:17:00 +02:00
Paul Sokolovsky
6b19520a74 zephyr: Add support for binary with builtin testsuite.
If TEST is defined, file it refers to will be used as the testsuite
source (should be generated with tools/tinytest-codegen.py).

"make-bin-testsuite" script is introduce to build such a binary.
2017-12-15 12:10:39 +02:00
Paul Sokolovsky
55d33d5897 zephyr/main: Move var declarations to the top of file. 2017-12-08 12:39:57 +02:00
Paul Sokolovsky
ada1dc1c03 zephyr/CMakeLists.txt: Properly separate CFLAGS parts gotten from CMake.
Lack of spaces between them led to weird option artifacts like -Ifoo-Dbar.
2017-12-06 16:45:27 +02:00
Paul Sokolovsky
ccec4ee7ad zephyr/CMakeLists.txt: Update for latest Zephyr buildsys changes. 2017-12-06 15:31:07 +02:00
Paul Sokolovsky
bb047558da zephyr/Makefile: syscall_macros.h generation was moved from CMake to make.
Required for #include <zephyr.h> to work.
2017-12-01 13:45:03 +02:00
Paul Sokolovsky
b369c1bb96 zephyr/Makefile: Make prj_$(BOARD).conf optional, again.
This time hopefully should work reliably, using make $(wildcard) function,
which in this case either expands to existing prj_$(BOARD).conf file, or to
an empty string for non-existing one.
2017-11-28 18:19:48 +02:00
Paul Sokolovsky
a036554a77 zephyr/Makefile: Convert to new CMake-based Zephyr build system.
Zephyr 1.10 switches to CMake-based build system (already in master).
2017-11-28 16:37:51 +02:00
Paul Sokolovsky
25b7c7d7c6 zephyr/prj_base.conf: Force zephyr.bin build output.
As useful for CI systems. 1.10 doesn't build .bin for qemu_* for example.

Also, remove deprecated CONFIG_LEGACY_KERNEL option.
2017-11-28 14:11:46 +02:00
Paul Sokolovsky
53e06e05c9 zephyr/Makefile: clean: Remove generated prj_*_merged.conf. 2017-11-28 13:37:26 +02:00
Damien George
4601759bf5 py/objstr: Remove "make_qstr_if_not_already" arg from mp_obj_new_str.
This patch simplifies the str creation API to favour the common case of
creating a str object that is not forced to be interned.  To force
interning of a new str the new mp_obj_new_str_via_qstr function is added,
and should only be used if warranted.

Apart from simplifying the mp_obj_new_str function (and making it have the
same signature as mp_obj_new_bytes), this patch also reduces code size by a
bit (-16 bytes for bare-arm and roughly -40 bytes on the bare-metal archs).
2017-11-16 13:17:51 +11:00
Paul Sokolovsky
3a9b15fd79 zephyr/README: "make qemu" was replaced with "make run". 2017-11-01 15:16:01 +02:00
Paul Sokolovsky
4514f073c1 zephyr: Switch to interrupt-driven pull-style console.
While this console API improves handling on real hardware boards
(e.g. clipboard paste is much more reliable, as well as programmatic
communication), it vice-versa poses problems under QEMU, apparently
because it doesn't emulate UART interrupt handling faithfully. That
leads to inability to run the testsuite on QEMU at all. To work that
around, we have to suuport both old and new console routines, and use
the old ones under QEMU.
2017-10-07 17:36:16 +03:00
Paul Sokolovsky
58ea239510 zephyr: Use CONFIG_NET_APP_SETTINGS to setup initial network addresses.
Ideally, these should be configurable from Python (using network module),
but as that doesn't exist, we better off using Zephyr's native bootstrap
configuration facility.
2017-10-07 14:08:50 +03:00
Damien George
a3dc1b1957 all: Remove inclusion of internal py header files.
Header files that are considered internal to the py core and should not
normally be included directly are:
    py/nlr.h - internal nlr configuration and declarations
    py/bc0.h - contains bytecode macro definitions
    py/runtime0.h - contains basic runtime enums

Instead, the top-level header files to include are one of:
    py/obj.h - includes runtime0.h and defines everything to use the
        mp_obj_t type
    py/runtime.h - includes mpstate.h and hence nlr.h, obj.h, runtime0.h,
        and defines everything to use the general runtime support functions

Additional, specific headers (eg py/objlist.h) can be included if needed.
2017-10-04 12:37:50 +11:00
Damien George
da8c4c2653 py/builtinhelp: Change signature of help text var from pointer to array.
As a pointer (const char *) it takes up an extra word of storage which is
in RAM.
2017-09-12 16:03:52 +10:00
Paul Sokolovsky
c46d480adc zephyr/Makefile: Revamp "test" target after ports were moved to ports/. 2017-09-10 22:25:43 +03:00
Damien George
4a93801c12 all: Update Makefiles and others to build with new ports/ dir layout.
Also renames "stmhal" to "stm32" in documentation and everywhere else.
2017-09-06 14:09:13 +10:00
Damien George
01dd7804b8 ports: Make new ports/ sub-directory and move all ports there.
This is to keep the top-level directory clean, to make it clear what is
core and what is a port, and to allow the repository to grow with new ports
in a sustainable way.
2017-09-06 13:40:51 +10:00