Commit graph

2546 commits

Author SHA1 Message Date
Antonio Lignan a6c30b4e09 Fixed missing static keyword in both zoul-demo and weather meter driver 2016-01-19 22:24:53 +01:00
Antonio Lignan 366f11d5df Uncrustified weather meter driver and example 2016-01-19 18:03:16 +01:00
Antonio Lignan 81bec49a40 Changed fixed 2 minute integration period to allow overriding 2016-01-19 18:00:18 +01:00
Antonio Lignan 0902e0fc6d Added degree converted value for the wind vane sensor.
Also added a 2-minutes average wind direction value, replaced the 240 bytes buffer from the reference example, but probably there's room for efficiency improvement
2016-01-19 17:47:46 +01:00
Antonio Lignan 61f1516369 Reworked instant wind speed calculation and extended the available wind speed return values 2016-01-19 17:47:46 +01:00
Antonio Lignan 0cb80b0605 Prevent calculations if tick is zero 2016-01-19 17:47:46 +01:00
Antonio Lignan aacbcd904f Added interrupt configuration for the weather meter 2016-01-19 17:47:46 +01:00
Antonio Lignan 103911f619 Added driver for the Sparkfun's weather meter station 2016-01-19 17:47:46 +01:00
Joakim Eriksson d4dc45e096 updated sicslowpan documentation and platform configurations 2016-01-19 15:27:14 +01:00
Antonio Lignan 2295ecdbd9 Renamed adc-sensors/adc-wrapper to adc-zoul/adc-sensors, to have a better wording reflecting the intented use 2016-01-17 23:04:34 +01:00
Antonio Lignan 503abb4415 ADC wrapper for the Zoul-based platforms, allows to add analogue sensors over the existing adc interface 2016-01-17 22:40:06 +01:00
Antonio Lignan ac07e848b7 Minor fixes to file descriptions and disable DEBUG switches 2016-01-17 21:52:34 +01:00
Antonio Lignan 2bb7ac9cc0 Merge pull request #1451 from g-oikonomou/bugfix/sensortag/select
Rename select() in various sensortag sensor drivers
2016-01-17 00:08:37 +01:00
Antonio Lignan 99f0c9f19b Merge pull request #1457 from alignan/pull/motion-sensor
Add support for digital motion/presence sensors
2016-01-11 20:30:09 +01:00
Antonio Lignan 57f4134c9e Merge pull request #1454 from alignan/pull/sht25-sensor
Fixes and enhancements for the SHT25 sensor
2016-01-11 20:29:14 +01:00
Antonio Lignan 94657b7a72 Merge pull request #1449 from alignan/pull/bmp085-sensor
BMP085 barometric sensor for the RE-Mote platform
2016-01-11 20:28:35 +01:00
Antonio Lignan c644a32dc7 Added support for digital presence/motion sensors 2016-01-11 18:36:31 +01:00
Antonio Lignan fefb84596e Fixed filter value preventing from initializing the ADC 2016-01-11 17:21:23 +01:00
George Oikonomou c394302c44 Merge pull request #1446 from alignan/pull/tsl2563-sensor
Enhanced TSL2563 driver for the Zoul module (RE-Mote/Firefly)
2016-01-11 11:21:51 +00:00
Antonio Lignan 48eb2a4fe2 Uncrustify changes 2016-01-10 23:36:00 +01:00
Antonio Lignan d53a62187d Added extra features of the SHT25 sensor 2016-01-10 23:33:33 +01:00
Antonio Lignan 97a7e98ac5 Fixed SHT25 sensor 2016-01-10 23:33:33 +01:00
Antonio Lignan 564c3a9d28 Fixed pressure calculation as previous temperature compensation was missing 2016-01-10 21:37:03 +01:00
George Oikonomou 6933b35bb5 Rename select() in various sensortag sensor drivers
This is to prevent a compile error caused by function prototype conflict between a function called `select()` (present in a number of sensortag peripheral drivers) and the one in `sys/select.h`. The error manifests itself with gcc-arm-embedded version 5.2.1 20151202 (2015-q4).

To fix the error we simply rename our function.

Fixes #1434
2016-01-10 15:47:34 +00:00
George Oikonomou fa40d2b1fc Remove documentation references to the Sensinode platform
This is part of a set of commits that will obsolete the Sensinode platform
2016-01-10 15:09:31 +00:00
George Oikonomou 707353f71b Remove Sensinode platform, cpu, example and tools files
This is part of a set of commits that will obsolete the Sensinode platform
2016-01-10 15:01:58 +00:00
Antonio Lignan 7b953091e5 Added BMP085 barometric sensor for the Zoul platform 2016-01-10 04:17:26 +01:00
Antonio Lignan 7abee394cb Initialized interrupt thresholds and added missing check 2016-01-10 04:09:07 +01:00
Antonio Lignan a8a1ebf8b5 Added interruption feature to the TSL2563 driver 2016-01-08 15:14:37 +01:00
Benoît Thébaudeau 0eab95ec4c Merge pull request #1443 from bthebaudeau/cc2538-new-aes-modes
cc2538: Complete support of hardware AES modes of operation
2016-01-07 23:27:06 +01:00
Simon Duquennoy edf85dc1f2 Merge pull request #1445 from TeVeDe/master
Changed NXP maintainers for JN516x platform
2016-01-07 14:45:24 +01:00
Antonio Lignan 881e78cb60 Rewamped TSL2563 light sensor 2016-01-07 12:53:31 +01:00
Theo van Daele 94143f93ff Changed NXP maintainers for JN516x platform 2016-01-07 09:47:29 +01:00
Benoît Thébaudeau ccceb63e88 cc2538: Add crypto driver and example for AES-GCM
Signed-off-by: Benoît Thébaudeau <benoit.thebaudeau.dev@gmail.com>
2016-01-06 23:22:54 +01:00
Benoît Thébaudeau e77e9861fe cc2538: Add crypto driver and example for AES-CBC-MAC
Signed-off-by: Benoît Thébaudeau <benoit.thebaudeau.dev@gmail.com>
2016-01-06 23:22:53 +01:00
Benoît Thébaudeau 47c24cab11 cc2538: Add crypto driver and example for AES-CTR
Signed-off-by: Benoît Thébaudeau <benoit.thebaudeau.dev@gmail.com>
2016-01-06 23:22:53 +01:00
Benoît Thébaudeau cf5e9557f8 cc2538: Add crypto driver and example for AES-CBC
Signed-off-by: Benoît Thébaudeau <benoit.thebaudeau.dev@gmail.com>
2016-01-06 22:01:41 +01:00
Benoît Thébaudeau 69eacbddbe cc2538: Add AES-CCM* driver
Signed-off-by: Benoît Thébaudeau <benoit.thebaudeau.dev@gmail.com>
2016-01-04 00:28:27 +01:00
kkrentz 24cb05059a CC2538: Add AES-128 driver 2016-01-04 00:28:27 +01:00
Benoît Thébaudeau 3dbe4c9403 cc2538: Add crypto driver and example for AES-ECB
Signed-off-by: Benoît Thébaudeau <benoit.thebaudeau.dev@gmail.com>
2016-01-04 00:28:26 +01:00
Antonio Lignan ca919ab0b0 Merge pull request #1196 from otcshare/x86
New platform: Intel Galileo Board
2015-12-23 12:33:47 +01:00
Antonio Lignan d9546991df Merge pull request #1424 from alignan/pull/remote-power-mgmt
RE-Mote power management support
2015-12-23 12:27:16 +01:00
Michael LeMay b4523b9130 galileo: Fix broken link in README.md
This patch fixes a broken link in README.md to serial cable connection
instructions.
2015-12-21 08:06:14 -02:00
Michael LeMay 13be942d40 galileo: Fix code style violations 2015-12-21 08:06:14 -02:00
Michael LeMay e14761c26b galileo: Document prerequisites for building on Ubuntu Linux
This patch documents the prerequisites for building on Ubuntu Linux in
the Galileo platform README.
2015-12-21 08:06:14 -02:00
Michael LeMay 09d168da04 galileo: Add support for old versions of GNU Make
This patch revises a Makefile to avoid using a feature that is
incompatible with GNU Make v.3.81.
2015-12-21 08:06:14 -02:00
Michael LeMay c75e9466f6 galileo: Fix bug in newlib build script
This patch fixes a bug in the newlib build script that causes it to
not delete an old source directory as intended prior to rebuilding the
library.
2015-12-21 08:06:14 -02:00
Michael LeMay f85654a82f x86, galileo: Add UEFI support
This patch adds support for optionally building EFI binaries in
addition to Multiboot ELF binaries.  It includes a script,
build_uefi.sh, that downloads tool and library sources from the EDK II
project, builds the GenFw tool that is used to create UEFI binaries,
and creates a makefile that is included from the main x86 common
makefile and enables UEFI support in the Contiki build system.  If the
script is not run prior to building Contiki, then an informational
message will be displayed with instructions for running build_uefi.sh
if UEFI support is desired.  This patch also adds the path to the
auto-generated makefile to .gitignore.

This patch modifies the linker script for the Intel Quark X1000 to
account for the output file section offsets and alignment expectations
of the EDK II GenFw project.

This patch also adds a newlib patch to remove the weak symbol
attribute from floating point stdio support routines.  See
<newlib>/newlib/README for an explanation of how the newlib developers
intended for _printf_float and _scanf_float to be linked.  Newlib
declares them as weak symbols with the intention that developers would
force them to be linked only when needed using a linker command line
option.  However, some but not all Contiki programs require them, so
we cannot simply always include or exclude them.  Instead, we remove
the weak symbol attributes and rely on the linker to automatically
determine whether or not they should be linked.  This avoids an issue
in which weak symbols were undefined in the intermediate DLL generated
as part of the UEFI build process.  That resulted in the GenFw program
emitting "ERROR 3000" messages when it encountered relocations
referencing such an undefined symbol.

Finally, this patch updates README.md to both make some revisions to
account for the UART support introduced in previous patches as well as
to provide instructions for using the UEFI support.
2015-12-21 08:06:14 -02:00
Michael LeMay b915e7d5e3 galileo: Omit exception handling unwind tables
This patch modifies the newlib and Contiki C and C++ compiler flags to
omit exception handling unwind tables (see
http://wiki.dwarfstd.org/index.php?title=Exception_Handling).
Removing these tables saves space in debug builds and has not caused
any readily-apparent functional changes.

Here is the size listing for an example program built without this
patch:
   text	   data	    bss	    dec	    hex	filename
  76002	   1508	  21224	  98734	  181ae	all-timers.galileo

Here is the size listing for the same program with this patch:
   text	   data	    bss	    dec	    hex	filename
  72918	   1508	  21224	  95650	  175a2	all-timers.galileo

The primary motivation for this patch is to help enable UEFI support.
The .eh_frame and .eh_frame_hdr sections that are otherwise generated
are treated as code sections by the EDK2 GenFw program, since they are
read-only alloc sections.  They get grouped with the actual code
sections, ahead of the data sections.  This perturbs symbols and
complicates debugging.
2015-12-21 08:06:14 -02:00
Michael LeMay 38206e3980 galileo: Add Ethernet support
This patch adds support for Ethernet to the Intel Galileo port.  It
uses the Intel Quark X1000 Ethernet driver.  It initializes the first
Ethernet interface and starts some common network services.  By
default, it uses the following addresses:
 - Host: 192.0.2.2
 - Netmask: 255.255.255.0
 - Default gateway: 192.0.2.1
 - DNS server: (same as default gateway)
These settings can be changed by editing eth-conf.c.
2015-12-21 08:06:14 -02:00
Ricardo de Almeida Gonzaga 93c7988069 x86: Add Galileo pinmux support
This patch adds the galileo-pinmux.c and galileo-pinmux.h files,
which support access to pinmux configuration through a function
interface.

This is not 100% supported yet due to some pinmux paths
need Quark X1000 GPIO (legacy and non-legacy) configurations.

After we finish to implement Quark X1000 GPIO driver we'll add
support for this.
2015-12-21 08:06:14 -02:00
Ricardo de Almeida Gonzaga 781375f1d1 x86: Add PCA9685 support
This patch adds pwm-pca9685.c and pwm-pca9685.h files,
which support access to I2C-based PCA9685 PWM controller
configuration register through a function interface.

The PCA9685 is an I2C-bus controlled 16-channel LED controller
optimized for Red/Green/Blue/Amber (RGBA) color backlighting
applications. Each LED output has its own 12-bit resolution
(4096 steps) fixed frequency individual PWM controller that
operates at a programmable frequency from a typical of 24 Hz to
1526 Hz with a duty cycle that is adjustable from 0 % to 100 %
to allow the LED to be set to a specific brightness value.
More about PCA9685 can be found in its datasheet[1].

This driver is needed in order to configure Galileo pinmux.

[1] - http://www.nxp.com/documents/data_sheet/PCA9685.pdf
2015-12-21 08:06:14 -02:00
Ricardo de Almeida Gonzaga 495dcd659a x86: Add PCAL9535A support
This patch adds gpio-pcal9535a.c and gpio-pcal9535a.h files,
which support access to I2C-based PCAL9535A GPIO controller
configuration register through a function interface.

The PCAL9535A is a low-voltage 16-bit GPIO expander with interrupt
and reset for I2C-bus/SMBus applications. It contains the PCA9535
register set of four pairs of 8-bit Configuration, Input, Output,
and Polarity Inversion registers, and additionally, the PCAL9535A has
Agile I/O, which are additional features specifically designed to
enhance the I/O. More about PCAL9535A can be found in its datasheet[1].

This driver is needed in order to configure Galileo pinmux.

[1] - http://www.nxp.com/documents/data_sheet/PCAL9535A.pdf
2015-12-21 08:06:14 -02:00
Andre Guedes 6b433aede1 x86: Improve release binary size
This patch adds -ffunction-sections and -fdata-sections to the
'release' CFLAGS so each function and data is place into its
own section in the output file. It also adds --gc-section to
the 'release' LDFLAGS so the linker removes the sections which
are not referenced.

This patch also adds -ffunction-sections and -fdata-sections
options to CFLAGS from build_newlib.sh. This increases newlib
static libraries size, however, the Contiki image shrinks even
more since --gc-section removes "dead code" from newlib.

As a practical effect, all unused function and data (as well as
sections such as .eh_frame) are striped out from the final elf
binary. This shrinks our release binary drastically.

Finally, to prevent --gc-section from removing .multiboot section,
this patch adds KEEP(*(.multiboot)) to quarkX1000.ld.
2015-12-21 08:06:14 -02:00
Michael LeMay 0dcd5e9b5a x86: Revise CFLAGS and LDFLAGS for LLVM Clang compatibility
This patch slightly revises CFLAGS and LDFLAGS to specify the
optimization and debugging options and linker script in a way that is
compatible with using Clang as the C compiler and to invoke the linker
(i.e. CC = clang and LD = clang).
2015-12-21 08:06:14 -02:00
Michael LeMay 17b855aac9 galileo: Replace non-halting core implementation of assert with the halting one from newlib
This patch modifies the include order to include headers from newlib
ahead of those from the core of Contiki.  The only header file names
that are common between Contiki and newlib are assert.h and config.h,
but the config.h files in Contiki are only located in ports for other
CPUs so they are irrelevant to this patch.  The motivation for this
patch is to cause files that include assert.h to include the one from
newlib that halts when an assertion fails.  The assert implementation
in the core of Contiki does not halt when an assertion fails.

This patch also adds newlib syscall stubs that are required by the
newlib assert implementation and the _exit syscall function that halts
the system.

Finally, this patch updates some other newlib syscall stubs to
properly indicate their status as unsupported syscalls.
2015-12-21 08:06:14 -02:00
Michael LeMay 06e25c487a galileo: Correct README.md to explain how to verify boot with UART
This patch revises README.md to mention the UART support introduced by
earlier patches in the section about verifying that Contiki is
running.  It also revises the serial console setup instructions to
focus on the more thoroughly tested option.
2015-12-21 08:06:14 -02:00
Andre Guedes e41bed319f galileo: Revise stdlib static linking
This patch does some refactoring so we are able to statically link
against standard libraries in a more usual way.
2015-12-21 08:06:14 -02:00
Andre Guedes 7043aa41b3 galileo: Fix newlib-syscalls issue in Makefile
This patch removes 'newlib-syscalls.c' from CONTIKI_SOURCEFILES variable
and appends it to PROJECT_SOURCEFILES. This way the buildsystem will
automatically consider the newlib-syscalls object code during linking
time.
2015-12-21 08:06:14 -02:00
Andre Guedes c9020d95e7 x86: Build release image
This patch adds support for building release images. The main difference
between release images and default images is that the former is optimized
for size while the latter is "optimized" for debugging. To build a release
image, the BUILD_RELEASE variable should be set to 1. For instance, the
following command build a release image from the hello-world application:
$ cd examples/hello-world && make TARGET=galileo BUILD_RELEASE=1

To optimize for size we use the '-Os' option from gcc. This option also
enables the strict aliasing optimization. This generates lots of warning
messages since we use the '-Wall' option and lots of code in core/net/
break the strict-aliasing rules. Some test have shown that the strict
aliasing optimization it not taking effect in the final binary. For that
reasons, this patch manually disables the optimization. Also, the release
image is stripped.

For the sake of comparison, below follows the output from 'wc' and 'size'
for both debugging (default) and release images.

Default image:
$  wc -c hello-world.galileo
71112 hello-world.galileo
$ size hello-world.galileo
   text    data     bss     dec     hex filename
  20379    1188   12808   34375    8647 hello-world.galileo

Release image:
$ wc -c hello-world.galileo
26320 hello-world.galileo
$ size hello-world.galileo
   text    data     bss     dec     hex filename
  18146    1156   12808   32110    7d6e hello-world.galileo
2015-12-21 08:06:14 -02:00
Andre Guedes 6c9ab4eb6c galileo: Remove unneeded syscall stubs
This patch removes _kill_r and _getpid_r stubs since they are not
required by newlib at this moment. These stubs should not be in
the commit that introduced the initial newlib-syscalls.c file.
2015-12-21 08:06:14 -02:00
Andre Guedes d3d2b51fa2 galileo: Initial stdio support
This patch introduces the initial support for stdio library in Galileo
platform. For now, only standard output and error are supported. Both
streams use the UART1 device.

Newlib doesn't call open() for stdin, stdout, and stderr which means
that the _write_r call is the first activity the stub will see on
those streams. For that reason, we initialize the UART1 device in
Galileo's platform main() function instead of in open() system call.
2015-12-21 08:06:14 -02:00
Andre Guedes ee82304211 galileo: Implement _sbrk_r syscall
This patch implements the _sbrk_r() system call for Galileo platform. This
system call is required by newlib's malloc() implementation. Next patch
will introduce the initial support for stdio library which requires a
working malloc() function for proper operation.

We are not sure about the heap size we should use. Preliminary tests
have shown that stdio library requests 1032 bytes heap. So, as an initial
guess, a 2Kb heap size should be enough for now.
2015-12-21 08:06:14 -02:00
Michael LeMay 9b6b5ce5b0 galileo: Instruct developer to build C library prior to building Contiki
This patch enhances build_newlib.sh to create Makefile.libc so that
the main Galileo makefile can attempt to include Makefile.libc and
instruct the developer to run build_newlib.sh first if the definition
within Makefile.libc is not detected.
2015-12-21 08:06:14 -02:00
Michael LeMay b2e4786187 galileo: Stylistic changes to make build_newlib.sh less repetitive
This script defines new variables to represent common paths and
filenames.  It does not introduce any functional changes.
2015-12-21 08:06:14 -02:00
Michael LeMay c8cdc0c157 galileo: Check for errors after downloading newlib tarball
Repeat the file existence and MD5 checks in build_newlib.sh after the
newlib tarball is downloaded and exit if either of the checks fail.
2015-12-21 08:06:14 -02:00
Andre Guedes 96e50ec2c4 galileo: Fix Makefile.galileo
This patch moves the compiler and linking options related to QuarkX1000
SoC to Makefile.x86_quarkX1000 since it is more suitable. For instance,
'-m32' should be used in any platform based on QuarkX1000, not only
Galileo. The same rationale applies for the others options (e.g. -march,
mtune).
2015-12-21 08:06:14 -02:00
Michael LeMay 2b5efdfbe7 galileo: Revise C compiler flags for consistency.
The CFLAGS setting used for the newlib build process includes
"-mtune=i586" as does the ASFLAGS setting used for the Contiki build
process.  However, the CFLAGS setting used for the Contiki build
process did not include that flag.  This patch adds it for
consistency.
2015-12-21 08:06:14 -02:00
Michael LeMay b79fcaa7d8 galileo: Override Ubuntu's default GCC flags to avoid link errors
Ubuntu enables GCC's stack protector by default (see
https://wiki.ubuntu.com/Security/Features).  This causes link errors
like the following:

 ...undefined reference to `__stack_chk_fail'

To avoid these errors, this patch adds the "-fno-stack-protector" flag
to both the CFLAGS used by the Contiki build process and the CFLAGS
used by the newlib build process.
2015-12-21 08:06:14 -02:00
Andre Guedes a8849b2909 x86: Move bootstrap code and linker script to cpu/x86
This is a refactoring patch, no functionality is changed. It moves
loader.S and galileo.ld from platform/galileo/ to cpu/x86/ directory
since they seem to be more SoC-specific than platform-specific.

It also renames galileo.ld to quarkX1000.ld since it can be used by
any platform based on Quark X1000 SoC, not only Galileo.

Furthermore, this patch also renames loader.S to bootstrap_quarkX1000.S
since it is pretty much a bootstrap code to any platform based on Quark
X1000 SoC.
2015-12-21 08:06:14 -02:00
Jesus Sanchez-Palencia b2fa72bb98 x86: Break Makefile.x86 into common and pc specific ones
Now the cpu/x86/ provides a Makefile.x86_common and a
Makefile.x86_pc. The former includes the common Makefile
and adds legacy pc specific implementations (currently,
drivers only) into the building context, while the latter
has everything that defines the bootstrap of a x86 CPU.

This commit also fixes platform/galileo/ so it includes the
correct makefile - Makefile.x86_quarkX1000. Galileo uses
a Quark X1000 SoC which is not an IBM Generic PC-like CPU,
but it does provide most of a PCs peripherals through
its "Legacy Bridge". Thus, it makes sense that QuarkX1000's
Makefile includes code from the legacy_pc x86 cpu.
2015-12-21 08:06:14 -02:00
Jesus Sanchez-Palencia 23e8090257 x86: Move available drivers into drivers/legacy_pc/
All drivers implemented so far are for chips which are only available
on legacy x86 PCs. This commit moves them into a more appropriate folder,
also making the cpu/x86/drivers/ folder ready for other x86 based SoCs.
2015-12-21 08:06:14 -02:00
Jesus Sanchez-Palencia 9d3b9cadc4 galileo: Concentrate core implementations in platform/galileo/core/
Currently, it is common to see Contiki's core/ interfaces implementations
spread in both cpu/ and platform/. We here take one step further starting
an effort to centralize all of these in platform's code instead.

This commit starts this by adding platform/galileo/core/ and its sys/
subfolder, adding a stubbed mtarch.h and moving clock and rtimer
implementations to this new folder. From now on we should concentrate
implementation from Contiki's core/ interfaces into the appropriate
subfolder in platform/galileo/core/.

Note that this is not the current fashion followed on other platforms
and cpus folders, as most of them add the core interface implementation
into its subfolder directly. For instance, on CC2538DK,
core/dev/button-sensor.h is implemented in platform/cc2538dk/dev/
directly, while on Galileo it would sit at platform/galileo/core/dev/.
We believe ours is a better approach to organize and escalate a
platform's code base.

We also remove previous x86 mtarch.h and mtarch.c since they weren't used
at all - both native and cooja platforms have their own mtarch
implementations.
2015-12-21 08:06:14 -02:00
Andre Guedes 568f565b3d galileo: Update README.md file
This patch updates the README.md file, including information about the
current device drivers implementations as well as the Contiki APIs
supported.
2015-12-21 08:06:14 -02:00
Andre Guedes e4ff61ff6c galileo: Support for rtimer library
This patch adds support for rtimer library on Galileo's platform.

We use the PIT to implement the rtimer platform dependent
functionalities. We chose the PIT for mainly two reason: I) its
configuration is very simple II) it has a high frequency which
provides us a good clock resolution (requirement from rtimer
library).

Since we keep track of the number of ticks in software, we define
rtimer_clock_t type as uint64_t. This gives us a good amount of time
til the variable overflows. For instance, a 32-bit type would overflow
in about one hour for high clock resolution (~ 1us).

The rtimer clock frequency (RTIMER_ARCH_SECOND) is setup to 1 kHz.
There is no technical matter regarding this value. It is just an
initial guess.

Just for the record, we might want to use HPET in future to
implement the rtimer library since it seems to be more appropriate.
The reason why we don't use it at this moment is that, in order to
configure it, we need support for ACPI 2.0 which we don't. Once we
have use-cases for the rtimer library we'll probably replace PIT
by HPET or any other timer more suitable for the job.
2015-12-21 08:06:14 -02:00
Jesus Sanchez-Palencia 7c871871de galileo: Add support for Etimer and Ctimer libraries
This patch adds support for the Etimer and Ctimer libraries. To support
the Etimer library, we should poll the etimer process every time the
system clock is updated. To do this more efficiently, by taking advantage
of etimer_next_expiration_time() API, we poll the etimer process only
when an 'Event Timer' has expired.

We don't need any platform specific support in order to enable the Ctimer
library since it relies completely on Etimer.

The others timer libraries (Timer and Stime) don't required any specific
platform support as well since they rely on the system Clock module only.
2015-12-21 08:06:14 -02:00
Jesus Sanchez-Palencia eafcba5e7a galileo: Add support for Clock module
This patch adds support for Contiki's clock module. All functions from
core/sys/clock.h are implemented, except clock_set_seconds() and clock_
delay_usec(). The CLOCK_CONF_SECOND macro is set to 128. This value
seems to be good enough since several platforms used it. Finally, we
use the RTC driver to track the number of ticks from the system clock.
2015-12-21 08:06:14 -02:00
Jesus Sanchez-Palencia 11098501d8 x86: Initialize the 8259 PIC
The Programmable Interrupt Controller is a chip responsible for
translating hardware interrupts to system interrupts. When it
receives an Interrupt Request (IRQ), it triggers the appropriate
interrupt line reaching the appropriate IDT gate, following a
previously setup offset.

There are 2 daisy-chained PICs. PIC1 handles IRQs 0-7 and PIC2
handles IRQs 8-15. If no vector offset is set, an IRQ0, for instance,
would trigger the interrupt 0, clashing with the "Division by zero exception"
handler. Thus the IRQs must be remapped.

This patch implements the PICs initialization through their 4
Initialization Command Words (ICWs) in a very "canonical" way:
- ICW1: the initializing command;
- ICW2: the vector offset for the PIC1 and PIC2 (we add an offset of 32 positions);
- ICW3: the inter-PICs wiring setup (we connect PIC2 to PIC1's IRQ2);
- ICW4: extra systems information (we set PIC1 as Master and PIC2 as slave).

It then masks the Interrupt Mask Register, blocking all IRQs but #2 initially.
These must be unmasked on demand. The IMR is 8-bits long, so setting the n^th bit to 1
would DISABLE the IRQ n while setting it to 0 would ENABLE IRQ n.

As stated, this is an implementation of the legacy 8259 PIC. More
investigation is needed so we decide if it is enough or if we need
the (newer) APIC implementation instead.

This patch also adds the outb() helper function to helpers.h. The helpers
is a wrapper for assembly 'out' instruction.

Finally, since we now properly support hardware interrupts, this patch
also enables IRQs in platform main().

More information:
- Quark X1000 Datasheet, section 21.12, page 898.
- http://wiki.osdev.org/8259_PIC
- http://stanislavs.org/helppc/8259.html
2015-12-21 08:06:14 -02:00
Andre Guedes f6644d9208 x86: CPU Initialization
This patch defines the cpu_init() function which should encapsulate
all code related to x86 CPU initialization. For now, this function
initializes GDT and IDT.
2015-12-21 08:06:14 -02:00
Andre Guedes b8feaea30d x86: Add helpers.h
This patch adds the helpers.h. This file should contain only x86-related
helper functions and macros. For now, we define the BIT macro and halt()
helpers which will be used in upcoming patches.

Additionally, this patch also changes loader.S to call the halt().
2015-12-21 08:06:14 -02:00
Andre Guedes 6ecc4a7371 galileo: Implement main() function
This patch implements the main() function for Galileo platform. At this
moment, only Processes subsystem is enabled. After this patch we are
able to some rudimentary debugging to ensure that process thread from
applications are being indeed executed.

Once we properly support more Contiki subsystems, such as clock, ctimer,
etimer, and rtimer, we will add them to Galileo platform's main() as well.
2015-12-21 08:06:14 -02:00
Jesus Sanchez-Palencia 595088be09 galileo: Add a bootstrap stack for C runtime
All we need to provide to C at this point is a region in memory dedicated to
its stack. This is done by allocating a region in .bss and pushing its start
address to esp. Since the multiboot spec says it is not safe to rely on the
initial stack provided by the bootloader, this patch provides our own stack.

Galileo boards have 512Kb of SRAM and 256Mb of DDR3 RAM, so providing 8kb as
a start seems safe. Moreover, stack sizes are very application-oriented
so it may be too early to provide a bigger (or smaller) stack.
2015-12-21 08:06:14 -02:00
Andre Guedes 7a1898f73e galileo: Halt if main() returns
This patch adds extra intrunctions to loader.S so we halt if main()
returns.
2015-12-21 08:06:14 -02:00
Andre Guedes 7e13081776 galileo: Print elf sections sizes after build
This patch changes Galileo's buildsystem to print the elf sections
sizes after a new image is built. This way we can easily track how
these sections increase or decrease after any change.

To achieve that, we define a custom linking rule which is pretty much
the same as the default linking rule define in Makefile.include, but
we run 'size' command after the image is built.
2015-12-21 08:06:14 -02:00
Andre Guedes e820a8b03b galileo: Add README file
This patch adds a README file which contains general information about
the Intel Galileo board support. The file provides information about
supported features as well as instructions on how to build, run and debug
applications for this platform.
2015-12-21 08:06:14 -02:00
Andre Guedes 1fb7800110 galileo: Add 'debug' rule
This patch the 'debug' rule to simplify the debugging process. This new
rule runs OpenOCD and gdb with the right parameters. OpenOCD runs in
background and its output will be redirected to a log file in the
application's path called LOG_OPENOCD. Once gdb client is detached,
OpenOCD is terminated.

The 'debug' rule is defined in Makefile.customrules-galileo file (create
by this patch) which is included by the Contiki's buildsystem. So to
debug a Contiki application for Galileo board, run the following command:
$ make TARGET=galileo debug

If you use a gdb front-end, you can define the "GDB" environment variable
and your gdb front-end will be used instead of default gdb. For instance,
if you want to use cgdb front-end, just run the command:
$ make BOARD=galileo debug GDB=cgdb
2015-12-21 08:06:14 -02:00
Jesus Sanchez-Palencia f14f9aba41 galileo: Initial support for Intel Galileo Platform
This patch adds the initial support for Intel Galileo Platform. It
contains the minimum set of code required to boot a dummy Contiki
image.

For Galileo initial support, we implemented a linker script, a minimal
bootstrap code, a set of stubbed functions required by newlib, and a
very simple main() function. Moreover, we also define some header files
and macros required by Contiki.

To build applications for this platform you should first build newlib
(in case it wasn't already built). To build newlib you can run the
following command:
$ platform/galileo/bsp/libc/build_newlib.sh

Once newlib is built, you can build applications. To build applications
for Galileo platform you should set TARGET variable to 'galileo'. For
instance, building the hello-world application should look like this:
$ cd examples/hello-world/ && make TARGET=galileo

This will generate the 'hello-world.galileo' file which is a multiboot-
compliant [1] ELF image. This image can be booted by any multiboot-
complaint bootloader such as Grub.

Finally, this patch should be used as a guideline to add the initial
support for others platforms based on x86 SoCs.

[1] https://www.gnu.org/software/grub/manual/multiboot/multiboot.html
2015-12-21 08:06:14 -02:00
Jesus Sanchez-Palencia c9897fe9b0 galileo: Add BSP files
This patch creates the platform/galileo/bsp directory. This directory
contain all files related to Galileo's Board Support Package (BSP). For
now, the BSP consists of libc and bootloader.

Within the BSP directory, we have the scripts build_newlib.sh and build_
grub.sh. These scripts provide an easy and quick way to build the newlib
and the grub for the Galileo platform.
2015-12-21 08:06:14 -02:00
Jesus Sanchez-Palencia 3a26d9dbc7 x86: Only add elfloader-x86.c to the platforms using it
Currently there are only one platform using CPU x86: Cooja. The
elfloader-x86.c is rather a POSIX implementation, so the Galileo port
won't use it for now. This patch fixes this by moving this source file to
be included by the platforms using it instead of the cpu's Makefile.
2015-12-21 08:06:14 -02:00
Joakim Eriksson e4744d1e59 fixed make login for Zoul on MAC 2015-12-19 10:28:30 +01:00
Antonio Lignan 5e14c22c98 Add support for the RE-Mote on-board power management feature 2015-12-18 16:20:30 +01:00
Antonio Lignan 834f965c95 Added support for the RE-Mote on-board Real Time Clock Calendar (RTCC) 2015-12-16 18:43:33 +01:00
Simon Duquennoy cc58384b40 jn516x: remove temporary adjustements for compilation in a 802.15.4e-free Contiki 2015-12-07 11:51:50 +01:00
Atis Elsts d79ce957a1 Adaptive time synchronization for TSCH 2015-12-07 11:51:41 +01:00
Simon Duquennoy 20c97367a9 Adding definitions required for TSCH to the sky and z1 platforms 2015-12-04 15:21:53 +01:00
Simon Duquennoy bc17cdca2c Merge pull request #1408 from simonduq/pr/jn516x-update
JN516x: tickless clock, power saving update, 32 kHz rtimer
2015-12-03 14:59:53 +01:00
Simon Duquennoy 3ff44f77b9 jn516x: added sleep modes, support for 32kHz rtimer, and tickless clock 2015-12-03 13:57:19 +01:00
George Oikonomou 27835eee2c Merge pull request #1399 from alignan/pull/pwm-driver
Added PWM driver for the Zolertia Zoul module and CC2538 platforms
2015-12-02 15:39:52 +00:00
Simon Duquennoy ebc8d9fb1c Merge pull request #1344 from tsparber/fix-doxygen
doxygen: Fixed all warnings
2015-11-30 22:07:15 +01:00
Cristiano De Alti 2e78558964 AVR platforms: use 32 bit clock_time_t. 2015-11-28 10:18:22 +01:00