Commit graph

249 commits

Author SHA1 Message Date
Andrew Boie
8deb09676d qemu_xtensa: enable stack sentinel
xtensa uses more stack than other arches, enable the sentinel since we
don't currently have HW-assisted stack checking on this arch.

Signed-off-by: Andrew Boie <andrew.p.boie@intel.com>
2017-09-12 22:31:18 -04:00
Anas Nashif
d4a0e88e37 boards: qemu_xtensa: add CONFIG_SIMULATOR_XTENS=y to defconfig
Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2017-09-11 16:29:55 -04:00
Anas Nashif
0a38ce0395 boards: xt-sim: make board depend on SIMULATOR_XTENSA
Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2017-09-11 16:29:55 -04:00
Anas Nashif
4857d03482 boards: esp32: make board depend on SOC
Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2017-09-11 16:29:55 -04:00
David B. Kinder
2341cc1ce3 doc: fix misspellings in board docs
Signed-off-by: David B. Kinder <david.b.kinder@intel.com>
2017-08-16 13:46:19 -04:00
Anas Nashif
39cc489e01 board: xt-sim: add as a default test platform
Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2017-08-16 13:05:54 -04:00
Anas Nashif
593f6d4a1b boards: qemu_xtensa: this is not supported by xcc
Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2017-08-16 13:05:54 -04:00
Anas Nashif
3b6e9092b3 boards: xt-sim: add definition for supported configurations
Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2017-08-16 13:05:54 -04:00
Anas Nashif
98f0e836b2 boards: esp32: add board definition file
Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2017-08-14 19:14:59 -04:00
Andy Ross
0fd9afd974 esp32: Fix board cycle frequency
The ESP-WROOM-32 board exits the bootloader at 40 MHz, not 160 MHz as
suggested by documentation.  The CCOUNT special register works as
advertised, but not at the expected rate.  This was verified by
timestamping (at the host) the output of a dependency-free loop that
looks like:

	int key = irq_lock();
	while(1) {
		u32_t i, count;
		volatile int dummy;

		for(i = 0; i < 5000000; i++) {
			dummy++;
		}

		__asm__ volatile ("rsr.ccount %0" : "=a"(count));
		printk("%d\n", count);
	}

The SoC has a fairly robust set of possible CPU clocking modes, but we
don't have a driver for that yet.  Until we do, set the single
configured CPU frequency to the one we get at runtime.

Signed-off-by: Andy Ross <andrew.j.ross@intel.com>
2017-08-09 19:57:40 -04:00
Leandro Pereira
27ea2d8eb7 arch: xtensa: Convert Xtensa port to use gen_isr_table
The Xtensa port was the only one remaining to be converted to the new
way of connecting interrupts in Zephyr.  Some things are still
unconverted, mainly the exception table, and this will be performed
another time.

Of note: _irq_priority_set() isn't called on _ARCH_IRQ_CONNECT(), since
IRQs can't change priority on Xtensa: while the architecture has the
concept of interrupt priority levels, each line has a fixed level and
can't be changed.

Signed-off-by: Leandro Pereira <leandro.pereira@intel.com>
2017-08-09 12:26:14 -07:00
Leandro Pereira
db6ff4da60 drivers: random: Add ESP32 random number generator driver
The random number generator from ESP32 uses noise from Wi-Fi and
Bluetooth radios.  If these are off, a pseudo-random number is
generated instead; this is currently the case, but even though it's a
black box, it's arguably better than returning a timestamp as a
pseudo-random number generator.

According to the ESP32 Technical Reference manual, the RNG passed the
Dieharder Random Number Test suite (version 3.31.1)[1], but nothing has
been said about the quality of the PRNG.

The RNG register is read directly; no effort is made to use its
contents to feed an entropy pool in a way that's similar to /dev/random
on POSIX systems, as no such subsystem exists on Zephyr at the moment.

[1] http://webhome.phy.duke.edu/~rgb/General/dieharder.php

Signed-off-by: Leandro Pereira <leandro.pereira@intel.com>
2017-08-09 12:26:14 -07:00
Leandro Pereira
c0c79a8041 drivers: gpio: esp32: Add ESP32 GPIO driver
This provides basic GPIO support, with interrupts, and the ability to
read and write to ports on a pin-by-pin basis.

Jira: ZEP-2286
Signed-off-by: Leandro Pereira <leandro.pereira@intel.com>
2017-08-09 12:26:14 -07:00
Leandro Pereira
f3b05c6a58 drivers: pinmux: Add pin multiplexer driver for ESP32
This implements a driver for the pin multiplexer as present in the ESP32
SoCs.

All APIs are supported.

Jira: ZEP-2297
Signed-off-by: Leandro Pereira <leandro.pereira@intel.com>
2017-08-09 12:26:14 -07:00
David B. Kinder
62a0cd246d doc: fix uses of back quotes in documentation
ReST defines interpreted text roles where text enclosed by single quotes
can be "intrepreted", for example :ref:`some name` becomes a link to
a label anywhere in the doc set named "some name", :c:func:`funcname()`
becomes a link to the API documentation for "funcname", and
:option:`CONFIG_NAME` becomes a link to, in our case, the documentation
for the generated Kconfig option.

This patch fixes uses of `some name` (without a role) by either adding
an explicit role, or changing to ``some name``, which indicates inline
code block formatting (most likely what was intended).

This is a precursor to changing the default behavior of interpreted
text to treat `some name` as :any:`some name` (as configured in
doc/conf.py), which would attempt to create a link to any available
definition of "some name".

We may not change this default role behavior, but it becomes an option
after the fixes in this patch.  In any case, this patch fixes incorrect
uses of single-quoted text (possibly introduced because GitHub's
markdown language uses single-quoted text for inline code formatting).

Jira: ZEP-2414

Signed-off-by: David B. Kinder <david.b.kinder@intel.com>
2017-08-03 11:08:23 -04:00
Leandro Pereira
6000c70ea0 boards: doc: Add ESP32 documentation
The documentation details how to install and configure all the
pre-requisites to build Zephyr for the ESP32 SoC, including using the
vendor SDK and toolchain, the flashing tool, and how to use JTAG.

Jira: ZEP-2109
Signed-off-by: Leandro Pereira <leandro.pereira@intel.com>
2017-07-28 19:35:55 -04:00
Anas Nashif
dd8fd72826 boards: mark qemu targets with a unified Kconfig
This will allow checking if we are building for QEMU globally, without
having to know the exact architecture and board name.

Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2017-07-26 07:40:45 -05:00
Anas Nashif
e8776f6b69 doc: add qemu_xtensa board instructions
Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2017-06-28 16:58:37 -04:00
David B. Kinder
abcb8d446e doc: fix sidebar nav issues with board docs
Sidebar navigation for supported boards is wonky: opens to show
all boards (making for lots of scrolling to see the sidebar) and
sidebar items aren't always clickable (as explained in the JIRA
issue).

Fix is to not use multiple toctree directives in boards.rst and
create intermediate architecture-specific supported board docs.

JIRA: INF-132

Signed-off-by: David B. Kinder <david.b.kinder@intel.com>
2017-06-27 19:21:29 -04:00
Anas Nashif
295897c191 boards: add board meta-data
Add board metadata to be consumed by the sanitycheck script to provide
better matching with testcases and to test based on features declated in
the board files.

Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2017-06-21 20:56:53 -04:00
Leandro Pereira
c78f55d0af boards: esp32: Do not use undefined CONFIG_BOARD_XTENSA
Signed-off-by: Leandro Pereira <leandro.pereira@intel.com>
2017-06-21 18:09:13 -04:00
Leandro Pereira
f0b4e174d7 esp32: Use esptool.py to flash with 'make flash'
This flashes Zephyr at 0x1000: that's where the first stage bootloader,
part of the ESP32 ROM, expects to find an "image header".

The second-stage bootloader, part of ESP-IDF, isn't used by the Zephyr
port.  However, the bootloader can be used if desired; please refer to
the ESP-IDF documentation on how to set up partitions tables and use
the bootloader.

The following environment variables will affect the ESP32 flashing
process:

  Variable              Default value
  ESP_DEVICE            /dev/ttyUSB0
  ESP_BAUD_RATE         921600
  ESP_FLASH_SIZE        detect
  ESP_FLASH_FREQ        40m
  ESP_FLASH_MODE        dio
  ESP_TOOL              espidf

It's impossible to determine which serial port the ESP32 board is
connected to, as it uses a generic RS232-USB converter.  The default of
/dev/ttyUSB0 is provided as that's often the assigned name on a Linux
machine without any other such converters.

The baud rate of 921600bps is recommended.  If experiencing issues when
flashing, try halving the value a few times (460800, 230400, 115200,
etc).  It might be necessary to change the flash frequency or the flash
mode; please refer to the esptool documentation for guidance on these
settings.

If ${ESP_TOOL} is set to "espidf", the esptool.py script found within
ESP-IDF will be used.  Otherwise, this variable is handled as a path to
the tool.

Signed-off-by: Leandro Pereira <leandro.pereira@intel.com>
2017-06-21 12:35:49 -04:00
Leandro Pereira
0e08b946de soc: esp32: Define __start as a C function
The first stage bootloader, part of the ESP32 ROM, already sets up
a stack that's sufficient to execute C programs.  So, instead of
implementing __stack() in assembly, do it in C to simplify things
slightly.

This ESP32-specific initialization will perform the following:

  - Disable the watchdog timer that's enabled by the bootloader
  - Move exception handlers to IRAM
  - Disable normal interrupts
  - Disable the second CPU
  - Zero out the BSS segment

Things that might be performed in the future include setting up the
CPU frequency, memory protection regions, and enabling the flash
cache.

Signed-off-by: Leandro Pereira <leandro.pereira@intel.com>
2017-06-21 12:35:49 -04:00
Leandro Pereira
4ca586e62d arch: xtensa: Use Zephyr configuration options
Unconditionally use CONFIG_SIMULATOR_XTENSA to determine if XT_SIMULATOR
or XT_BOARD should be defined.

If CONFIG_SYS_CLOCK_HW_CYCLES_PER_SEC, also define XT_CLOCK_FREQ.  This
isn't ideal as the clock frequency might be changed in runtime and this
effectively makes it a constant.

Until we can control the clock frequency in runtime, this will suffice.

Signed-off-by: Leandro Pereira <leandro.pereira@intel.com>
2017-06-21 12:35:49 -04:00
Leandro Pereira
37ea77173c drivers: esp32: Add minimal UART driver based on ROM routines
This is a minimal driver enabling console output during the port
bringup.  While the driver works, only one of the three UART devices
are supported, and there isn't any way to change any parameters or
use interrupts.  This will most likely be superceded by a proper
driver after the port has matured.

Signed-off-by: Leandro Pereira <leandro.pereira@intel.com>
2017-06-21 12:35:49 -04:00
Leandro Pereira
c13174935b boards: xtensa: Add ESP32 board
This is based on the work of Rajavardhan Gundi.

Signed-off-by: Leandro Pereira <leandro.pereira@intel.com>
2017-06-21 12:35:49 -04:00
David B. Kinder
9faa5f2033 doc: spelling fixes in Kconfig files
regular spelling check on Kconfig.* files

Signed-off-by: David B. Kinder <david.b.kinder@intel.com>
2017-06-12 19:40:51 -04:00
David B. Kinder
342bdda760 doc: spelling fixes in samples/ and boards/
regular spelling check on .rst files

Signed-off-by: David B. Kinder <david.b.kinder@intel.com>
2017-06-12 18:28:08 -04:00
Anas Nashif
5fc80dce61 xtensa: dont set variant with gcc
Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2017-05-20 07:04:33 -04:00
Andrew Boie
4f69bdaa0d sanitycheck: build more Xtensa SOCs
Now that we can specify what toolchain is intended for each
SOC, enable some more SOCs to be built.

A full sanitycheck run will require the installation of both
RF-2016.4 and RG-2016.4 releases.

Signed-off-by: Andrew Boie <andrew.p.boie@intel.com>
2017-05-18 07:18:36 -04:00
Andrew Boie
fe70b0876f xt-sim: don't depend on sample_controller SOC
The xtensa simulator can in fact simulate a variety of Xtensa SOCs.
Fixes build for alternate xt-sim_* defconfigs.

Signed-off-by: Andrew Boie <andrew.p.boie@intel.com>
2017-05-15 15:04:40 -04:00
Andrew Boie
3ddd7f274e xt-sim: fix board definition, rename
The xt-sim defconfigs were selecting CONFIG_SIMULATOR_XTENSA instead
of CONFIG_BOARD_SIMULATOR_XTENSA.

Fix defconfigs and rename to CONFIG_BOARD_XT_SIM to ease any future
confusion between these similarly named defconfigs.

CONFIG_SIMULATOR_XTENSA is automatically set by xt-sim's
Kconfig.defconfig, it doesn't need to be explicitly specified in the
defconfigs themselves.

Signed-off-by: Andrew Boie <andrew.p.boie@intel.com>
2017-05-15 15:04:40 -04:00
Anas Nashif
63efc5f4bb xtensa: qemu: set correct clock frequency
Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2017-05-12 07:00:04 -04:00
Anas Nashif
f628c12b04 xtensa: rename SOC_SAMPLE_CONTROLLER
SOC_SAMPLE_CONTROLLER option name is too generic, make it Xtensa
specific to avoid confusion.

Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2017-05-12 07:00:04 -04:00
Anas Nashif
2a0d16593a xtensa: qemu: add qemu_xtensa board definition
Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2017-05-11 16:51:56 -04:00
Anas Nashif
09b239102a xtensa: xt-sim: mark it as a board with simulator features
Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2017-05-11 16:51:56 -04:00
Andrew Boie
18c949c9c9 xtensa: remove xt-sim_XRC_D2PM
This core configuration was removed from the tree since it cannot
implement irq_offload().

Remove an orphaned block in xtesna.ini.

Signed-off-by: Andrew Boie <andrew.p.boie@intel.com>
2017-05-11 12:47:23 -04:00
David B. Kinder
2f41cb8329 doc: misspelling and UTF-8 fixes
More general spelling fixes, and cleaning up stray UTF-8 characters
such as curly-quotes, em- and en-dashes.  Use replacement strings
for |reg| and |trade|.

Signed-off-by: David B. Kinder <david.b.kinder@intel.com>
2017-05-09 20:15:49 -04:00
Mazen NEIFER
37352c809e xtensa port: Added documentation for xt-sim board.
Issue: ZEP-1899

Change-Id: I4cf2878468e8c1c9703a2af13d9c2b3ac6f78042
Signed-off-by: Mazen NEIFER <mazen@nestwave.com>
2017-04-20 21:07:15 +00:00
Andrew Boie
6311ede125 xtensa: remove hifi_mini sim target
The core build in the SDK does not have a timer, making it impossible
to use this core with most of the sanity checks. We are working on
getting a special package of cores for Zephyr which meet our build
requirments; until then, remove this core as it doesn't build.

Change-Id: I3fa201f3c6b5724501e8cb1e1b8ba631436ebc23
Signed-off-by: Andrew Boie <andrew.p.boie@intel.com>
2017-04-13 11:45:52 -07:00
Andrew Boie
6922a22c28 xtensa: add simulator targets for more SOCs
Change-Id: Ibceaf01ed71783c597b030bcc5778da6a03e5699
Signed-off-by: Andrew Boie <andrew.p.boie@intel.com>
2017-04-13 12:42:07 +00:00
Andrew Boie
d73641c50b xt-sim: remove extraneous C file
Change-Id: I8f2ac2e743e57e6a591b2f995fbef97ecfebf46e
Signed-off-by: Andrew Boie <andrew.p.boie@intel.com>
2017-04-13 12:42:06 +00:00
Andrew Boie
11ee791b32 xtensa: build similar to other Zephyr arches
* CONFIG_SOC is now properly set and we do not need a separate
  XTENSA_CORE build variable

* Some unnecessary macro -D CFLAGS in the Xtensa Makefile removed

* There is no default SOC selection, it is now done explicitly in
  the board's defconfig

* CONFIG_<board name> now renamed to CONFIG_SOC_<board name in
  uppercase> to conform to established style.

Issue: ZEP-1711
Change-Id: I88997530db09970b7fdd1c3e3d355bfca9d0be1a
Signed-off-by: Andrew Boie <andrew.p.boie@intel.com>
2017-04-13 12:42:06 +00:00
Andrew Boie
3a29b9cefa xt-sim: set default stack size for IPM console receiver
The default of 512 is insufficient.

Change-Id: I7dd1cca89d1f289ceb87aee8e8a80719846d139c
Signed-off-by: Andrew Boie <andrew.p.boie@intel.com>
2017-03-06 16:58:21 +00:00
Andrew Boie
eb50958266 xt-sim: add support for 'make debug'
Change-Id: I60b64c6b8c83e1e1c49d8cb2c5f857faee88a7a0
Signed-off-by: Andrew Boie <andrew.p.boie@intel.com>
2017-02-13 11:39:01 -08:00
Andrew Boie
55acd15cc8 xt-sim: enable use of xtensa simulator with 'make run'
Change-Id: I450f24de73dc710ab3875b010ecf48e44370cfc0
Signed-off-by: Andrew Boie <andrew.p.boie@intel.com>
2017-02-13 08:04:27 -08:00
Mazen NEIFER
03857ccb23 Xtensa port: Enable console when building for Xtensa simulator as board.
Change-Id: I48f25b7c7bb36bd7248e7d9e6718bf365eac56d9
Signed-off-by: Mazen NEIFER <mazen@nestwave.com>
2017-02-13 08:04:27 -08:00
Andrew Boie
aa3ab35c88 xtensa: fixup license identifiers
Master branch changed requirements for license headers while this
branch has been in development.

Change-Id: I9bce16ff275057a4bb664019628fc9b6de7aef7c
Signed-off-by: Andrew Boie <andrew.p.boie@intel.com>
2017-02-13 08:04:27 -08:00
Mazen NEIFER
4db0805ad0 Xtensa port: Added board config files for Xtensa simulator paltform
This platform is not a real board but let user handle the xtensa
simulator just like a board.
This is needed until a qemu like simulaotr is added to Xtensa.

Change-Id: I54ab28e86eea956cf85af3ee9b4a10f0d531e54d
Signed-off-by: Mazen NEIFER <mazen@nestwave.com>
2017-02-13 08:04:26 -08:00