Chrome EC: Difference between revisions

From coreboot
Jump to navigation Jump to search
Line 105: Line 105:
Targets not building
Targets not building


* cr50 (make issue)
* cr50 (make issue with -C)
* glados,kunimitsu,lars,oak: driver/pi3usb30532.h:11:22: fatal error: inttypes.h: No such file or directory
* glados,kunimitsu,wheatley: `memset' referenced in section `.text' of /tmp/cc3Dv6dh.ltrans2.ltrans.o: defined in discarded section `.text' of build/wheatley/RO/common/util.o (symbol from plugin)
* it8380dev: armv7-a-eabi-gcc: error: unrecognized argument in option '-march=v3m'
* it8380dev: armv7-a-eabi-gcc: error: unrecognized argument in option '-march=v3m'
* ryu: driver/als_si114x.c:269:5: error: 'ret' may be used uninitialized in this function [-Werror=maybe-uninitialized]
* Not real targets, but in board/: host, OWNERS
* Not real targets, but in board/: host, OWNERS

Revision as of 01:04, 16 January 2016

Chrome EC

The Chrome EC is used in almost all Chrome OS devices, and an increasing number of accessories, like Google's Type C chargers. It is based on the Chromium EC code base.

Building the Chrome EC

Building in the ChromiumOS environment

Getting started building EC images quickly

Building outside of the ChromiumOS chroot

Build requirements

You will need:

  • GNU Make 4.1 (older versions are having trouble with the Makefiles)
  • an ARM cross compiler (I used coreboot's armv7-a-eabi- toolchain)

Patches required

Patching up the code:

diff --git a/Makefile.toolchain b/Makefile.toolchain
index f015726..759dfb0 100644
--- a/Makefile.toolchain
+++ b/Makefile.toolchain
@@ -48,6 +48,9 @@ CFLAGS=$(CPPFLAGS) $(CFLAGS_CPU) $(CFLAGS_DEBUG) $(CFLAGS_WARN) $(CFLAGS_y)
 CFLAGS+= -ffunction-sections -fshort-wchar
 CFLAGS+= -fno-delete-null-pointer-checks -fconserve-stack
 
+CFLAGS+= -ffreestanding
+CPPFLAGS+= -ffreestanding
+
 FTDIVERSION=$(shell $(PKG_CONFIG) --modversion libftdi1 2>/dev/null)
 ifneq ($(FTDIVERSION),)
   LIBFTDI_NAME=ftdi1

and

diff --git a/include/timer.h b/include/timer.h
index 5f92207..1a43604 100644
--- a/include/timer.h
+++ b/include/timer.h
@@ -8,7 +8,7 @@
 #ifndef __CROS_EC_TIMER_H
 #define __CROS_EC_TIMER_H
 
-#include <sys/types.h>
+typedef long clock_t;
 
 #include "common.h"
 #include "task_id.h"

and

diff --git a/driver/pi3usb30532.h b/driver/pi3usb30532.h
index 96c9632..15a9241 100644
--- a/driver/pi3usb30532.h
+++ b/driver/pi3usb30532.h
@@ -8,8 +8,6 @@
 #ifndef __CROS_EC_PI3USB30532_H
 #define __CROS_EC_PI3USB30532_H
 
-#include <inttypes.h>
-
 #include "usb_pd.h"
 
 /* USB switch registers */

and

diff --git a/driver/als_si114x.c b/driver/als_si114x.c
index bdd39fa..5a64be9 100644
--- a/driver/als_si114x.c
+++ b/driver/als_si114x.c
@@ -219,7 +219,7 @@ static int irq_handler(struct motion_sensor_t *s, uint32_t *event)
 /* Just trigger a measurement */
 static int read(const struct motion_sensor_t *s, vector_3_t v)
 {
-       int ret;
+       int ret = 0;
        uint8_t cmd;
        struct si114x_drv_data_t *data = SI114X_GET_DATA(s);

Build instructions

Let's go:

$ sudo aptitude install libftdi-dev
$ git clone https://chromium.googlesource.com/chromiumos/platform/vboot_reference
$ cd vboot_reference
$ make
[..]
$ cp build/futility/futility ~/bin
$ cd ..
$ git clone https://chromium.googlesource.com/chromiumos/platform/ec
[..]
$ cd ec
$ CROSS_COMPILE=armv7-a-eabi- HOST_CROSS_COMPILE= make BOARD=chell
[..]
$

Issues

Targets not building

  • cr50 (make issue with -C)
  • glados,kunimitsu,wheatley: `memset' referenced in section `.text' of /tmp/cc3Dv6dh.ltrans2.ltrans.o: defined in discarded section `.text' of build/wheatley/RO/common/util.o (symbol from plugin)
  • it8380dev: armv7-a-eabi-gcc: error: unrecognized argument in option '-march=v3m'
  • Not real targets, but in board/: host, OWNERS