diff options
author | Vadim Bendebury <vbendeb@chromium.org> | 2020-02-24 17:20:57 -0800 |
---|---|---|
committer | Commit Bot <commit-bot@chromium.org> | 2020-03-31 23:24:37 +0000 |
commit | 804d65e5fd86057e78c0d0b5f6139172d20b8207 (patch) | |
tree | 186908de441fd55d8a056a226188e63187b327fd /Makefile | |
parent | 3ab80b560a9b434fe9a3fa82c546009fca56cfd1 (diff) | |
download | chrome-ec-804d65e5fd86057e78c0d0b5f6139172d20b8207.tar.gz |
make: add preprocessor stage
For the upcoming introduction of transitioning Cr50 console
communications to packet mode, there is a need to be able to replace
all print function invocations in the code with calls to packet
sending function.
This replacement is easiest to make in C preprocessor outputs, as
there all macros are replaced with actual function invocations.
This patch adds a configuration option CONFIG_EXTRACT_PRINTF_STRINGS,
when enabled, building of the image object files starts happening in
three steps instead of one, instead of .c => .o transition, the steps
are .c => .E => .Ep => .o, where .E is the C preprocessor output, and
.Ep is result of post processing by ./util/util_precompile.py.
BUG=b:149964350
TEST=image layout does not change if CONFIG_EXTRACT_PRINTF_STRINGS is
not defined. With the rest of the patches applied defining the
above config option allows to build a Cr50 image supporting
packet console communications mode.
Signed-off-by: Vadim Bendebury <vbendeb@chromium.org>
Change-Id: I20b8ba7c5d13cb54ac6adbdbce856d92023ce997
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2113122
Reviewed-by: Randall Spangler <rspangler@chromium.org>
Diffstat (limited to 'Makefile')
-rw-r--r-- | Makefile | 19 |
1 files changed, 19 insertions, 0 deletions
@@ -339,7 +339,26 @@ ifeq ($(CONFIG_SHAREDLIB),y) ro-objs := $(filter-out %_sharedlib.o, $(ro-objs)) endif ro-deps := $(addsuffix .d, $(ro-objs)) +ifeq ($(CONFIG_EXTRACT_PRINTF_STRINGS),) rw-deps := $(addsuffix .d, $(rw-objs)) +else + +# See docs/packetized-console.md for details. + +s-src = chip/g/ite_sync.S core/cortex-m/init.S core/cortex-m/ldivmod.S \ + core/cortex-m/switch.S core/cortex-m/uldivmod.S +s-objs := $(patsubst %.S,$(out)/RW/%.o,$(s-src)) + +rw-ep-objs := $(filter-out $(s-objs), $(rw-objs)) +rw-es := $(patsubst %.o,%.E,$(rw-ep-objs)) +rw-eps := $(patsubst %.o,%.Ep,$(rw-ep-objs)) +rw-deps := $(patsubst %.o,%.E.d,$(rw-objs)) + +$(rw-eps) $(out)/RW/str_blob: $(rw-es) + ${Q}util/util_precompile.py -o $(out)/RW/str_blob $(rw-es) + +$(rw-objs): $(out)/RW/str_blob $(rw-eps) +endif deps := $(ro-deps) $(rw-deps) $(deps-y) |