summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorHyungwoo Yang <hyungwoo.yang@intel.corp-partner.google.com>2021-01-19 10:14:01 -0800
committerCommit Bot <commit-bot@chromium.org>2021-01-22 03:06:54 +0000
commit0a5c0b1060f8cd2a77741b064fd8471930c90059 (patch)
treef701bc50aea164ec79e9fb4f49a46e7421c536c6
parentbcbd95309cd41e68f4ce185093b81a0cc75c7b75 (diff)
downloadchrome-ec-0a5c0b1060f8cd2a77741b064fd8471930c90059.tar.gz
No init.rom section support in Zephyr
Building zephyr generates a warning on init.rom section. This change removes init.rom section declaration in Zephyr build. The change also added third_party into include folders so files in third_party now can be included in Zephyr build. BUG=b:173508071 BRANCH=none TEST=make BOARD=volteer -j8 build volteer on zephyr Change-Id: Ic86866e41d87d83c00a06a207a352a25fe57054b Signed-off-by: Hyungwoo Yang <hyungwoo.yang@intel.corp-partner.google.com> Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2638135 Reviewed-by: Keith Short <keithshort@chromium.org>
-rw-r--r--Makefile2
-rw-r--r--common/build.mk3
-rw-r--r--driver/accelgyro_bmi260.c2
-rw-r--r--include/common.h4
-rw-r--r--include/init_rom.h16
5 files changed, 24 insertions, 3 deletions
diff --git a/Makefile b/Makefile
index 43eae0bc0d..d00a5a5615 100644
--- a/Makefile
+++ b/Makefile
@@ -128,7 +128,7 @@ UC_PROJECT:=$(call uppercase,$(PROJECT))
# Transform the configuration into make variables. This must be done after
# the board/baseboard/project/chip/core variables are defined, since some of
# the configs are dependent on particular configurations.
-includes=include core/$(CORE)/include include/driver $(dirs) $(out) fuzz test
+includes=include core/$(CORE)/include include/driver $(dirs) $(out) fuzz test third_party
ifdef CTS_MODULE
includes+=cts/$(CTS_MODULE) cts
endif
diff --git a/common/build.mk b/common/build.mk
index c4ee00836c..2cab0bbf5e 100644
--- a/common/build.mk
+++ b/common/build.mk
@@ -53,6 +53,7 @@ common-$(CONFIG_CHARGE_MANAGER)+=charge_manager.o
endif
common-$(CONFIG_CHARGE_RAMP_HW)+=charge_ramp.o
common-$(CONFIG_CHARGE_RAMP_SW)+=charge_ramp.o charge_ramp_sw.o
+common-$(CONFIG_CHIP_INIT_ROM_REGION)+=init_rom.o
common-$(CONFIG_CMD_CHARGEN) += chargen.o
common-$(CONFIG_CHARGER)+=charger.o charge_state_v2.o
common-$(CONFIG_CHARGER_PROFILE_OVERRIDE_COMMON)+=charger_profile_override.o
@@ -60,7 +61,7 @@ common-$(CONFIG_CMD_I2CWEDGE)+=i2c_wedge.o
common-$(CONFIG_COMMON_GPIO)+=gpio.o gpio_commands.o
common-$(CONFIG_IO_EXPANDER)+=ioexpander.o
common-$(CONFIG_COMMON_PANIC_OUTPUT)+=panic_output.o
-common-$(CONFIG_COMMON_RUNTIME)+=hooks.o main.o system.o peripheral.o init_rom.o
+common-$(CONFIG_COMMON_RUNTIME)+=hooks.o main.o system.o peripheral.o
common-$(CONFIG_COMMON_TIMER)+=timer.o
common-$(CONFIG_CRC8)+= crc8.o
common-$(CONFIG_CURVE25519)+=curve25519.o
diff --git a/driver/accelgyro_bmi260.c b/driver/accelgyro_bmi260.c
index faac2f75a5..573f8ce288 100644
--- a/driver/accelgyro_bmi260.c
+++ b/driver/accelgyro_bmi260.c
@@ -12,6 +12,7 @@
#include "console.h"
#include "accelgyro_bmi_common.h"
#include "accelgyro_bmi260.h"
+#include "bmi260/accelgyro_bmi260_config_tbin.h"
#include "hwtimer.h"
#include "i2c.h"
#include "init_rom.h"
@@ -19,7 +20,6 @@
#include "motion_sense_fifo.h"
#include "spi.h"
#include "task.h"
-#include "third_party/bmi260/accelgyro_bmi260_config_tbin.h"
#include "timer.h"
#include "util.h"
#include "watchdog.h"
diff --git a/include/common.h b/include/common.h
index d08fa911a4..86c006d9e9 100644
--- a/include/common.h
+++ b/include/common.h
@@ -132,7 +132,11 @@
* linked into the .rodata section.
*/
#ifndef __init_rom
+#ifndef CONFIG_ZEPHYR
#define __init_rom __attribute__((section(".init.rom")))
+#else
+#define __init_rom
+#endif
#endif
/* gcc does not support __has_feature */
diff --git a/include/init_rom.h b/include/init_rom.h
index 6d54e6aec4..2c1ab33cd5 100644
--- a/include/init_rom.h
+++ b/include/init_rom.h
@@ -14,6 +14,7 @@
#include "stdbool.h"
+#ifdef CONFIG_CHIP_INIT_ROM_REGION
/**
* Get the memory mapped address of an .init_rom data object.
*
@@ -49,5 +50,20 @@ void init_rom_unmap(const void *addr, int size);
* @return 0 on success.
*/
int init_rom_copy(int offset, int size, char *data);
+#else
+static inline const void *init_rom_map(const void *addr, int size)
+{
+ return addr;
+}
+
+static inline void init_rom_unmap(const void *addr, int size)
+{
+}
+
+static inline int init_rom_copy(int offset, int size, char *data)
+{
+ return 0;
+}
+#endif
#endif /* __CROS_EC_INIT_ROM_H */