Commit 1111ecca authored by Cedric Roux's avatar Cedric Roux

T: isolate generated .h files when using make

When using the make system to generate T files, if you change
T_messages.txt you may have problems compiling the gnb with ninja.

If you want to see the problem:
First run: cd cmake_targets; ./build_oai --ninja --gNB
Then: cd common/utils/T
edit T_messages.txt, add a trace, for example:
---
ID = ENB_PHY_UL_TOCK
    DESC = eNodeB uplink tick - one tick per ms at start of uplink processing
    GROUP = ALL:PHY:GRAPHIC:ENB
    FORMAT = int,eNB_ID : int,frame : int,subframe
---
then run: make
then: cd cmake_targets/ran_build/build; ninja nr-softmodem
You should have an error looking like this:
---
[3/81] Checking validity of VCD files
FAILED: common/utils/T/CMakeFiles/check_vcd /tmp/develop/cmake_targets/ran_build/build/common/utils/T/CMakeFiles/check_vcd
cd /tmp/develop/cmake_targets/ran_build/build/common/utils/T && /tmp/develop/cmake_targets/ran_build/build/common/utils/T/_check_vcd /tmp/develop/common/utils/T/T_messages.txt /tmp/develop/common/utils/T/../LOG/vcd_signal_dumper.h
error: VCD_FIRST_VARIABLE is not correct in T_defs.h

You probably added a VCD trace (variable or function) but you did not
update T_messages.txt and/or T_defs.h in common/utils/T/
[...]
---

Let's first isolate the generated T .h files when using make because
we have two versions of T_IDs.h and T_messages.txt.h when mixing
make/cmake.

A next commit will regenerate T_IDs.h and T_messages.txt.h when
T_messages.txt chages for the cmake system, because this commit
does not solve the problem.
parent 82597e7e
*.o
*.a
T_IDs.h
T_messages.txt.h
genids
tracer/enb
tracer/gnb
......@@ -18,3 +16,4 @@ tracer/extract_output_subframe
tracer/extract
tracer/multi
tracee/tracee
incgen
CC=gcc
CFLAGS=-Wall -g
CFLAGS=-Wall -g -Iincgen
GENIDS=genids
GENIDS_OBJS=genids.o
all : $(GENIDS) T_messages.txt.h T_IDs.h
all : $(GENIDS) incgen/T_messages.txt.h incgen/T_IDs.h
$(GENIDS): $(GENIDS_OBJS)
$(CC) $(CFLAGS) -o $(GENIDS) $(GENIDS_OBJS)
......@@ -12,21 +12,24 @@ $(GENIDS): $(GENIDS_OBJS)
%.o: %.c
$(CC) $(CFLAGS) -c -o $@ $<
T_messages.txt.h: T_messages.txt
xxd -i T_messages.txt T_messages.txt.h
incgen/T_messages.txt.h: T_messages.txt
mkdir -p incgen
xxd -i T_messages.txt incgen/T_messages.txt.h
T_IDs.h: $(GENIDS) T_messages.txt
./$(GENIDS) T_messages.txt T_IDs.h
incgen/T_IDs.h: $(GENIDS) T_messages.txt
mkdir -p incgen
./$(GENIDS) T_messages.txt incgen/T_IDs.h
check_vcd: T_IDs.h T_messages.txt.h
check_vcd: incgen/T_IDs.h incgen/T_messages.txt.h
gcc -Wall -I. -I.. -I../itti -I../../../openair2/COMMON -Itracer -o _check_vcd check_vcd.c tracer/database.c tracer/utils.c -lm -pthread
./_check_vcd T_messages.txt ../LOG/vcd_signal_dumper.h || (rm -f ./_check_vcd ./T_IDs.h ./T_messages.txt.h && false)
./_check_vcd T_messages.txt ../LOG/vcd_signal_dumper.h || (rm -rf ./_check_vcd ./incgen && false)
rm -f ./_check_vcd
.PHONY: check_vcd
clean:
rm -f *.o $(GENIDS) core T_IDs.h T_messages.txt.h _check_vcd
rm -f *.o $(GENIDS) core _check_vcd
rm -rf incgen
cleanall: clean
cd tracer && $(MAKE) clean
CC=gcc
CFLAGS=-Wall -g -pthread -DT_TRACER -I.
CFLAGS=-Wall -g -pthread -DT_TRACER -I. -I../incgen
PROG=tracee
OBJS=tracee.o ../T.o ../local_tracer.o
OBJS=tracee.o T.o ../local_tracer.o
all: T_dep $(PROG)
$(PROG): $(OBJS)
$(CC) $(CFLAGS) -o $(PROG) $(OBJS) -lrt
......@@ -10,5 +12,11 @@ $(PROG): $(OBJS)
tracee.o: tracee.c
$(CC) $(CFLAGS) -c -o $@ $<
T.o: ../T.c
$(CC) $(CFLAGS) -c -o $@ $<
T_dep:
cd .. && make
clean:
rm -f *.o $(PROG) core
#ifndef _CONFIG_USERAPI_H_
#define _CONFIG_USERAPI_H_
typedef int paramdef_t;
#ifdef CMDLINE_TTRACEPARAMS_DESC
#undef CMDLINE_TTRACEPARAMS_DESC
#endif
#define CMDLINE_TTRACEPARAMS_DESC {}
#define config_get(dummy, ...) (void)(dummy)
#define config_process_cmdline(...) /**/
#endif /* _CONFIG_USERAPI_H_ */
......@@ -6,7 +6,8 @@
int main(void)
{
int frame = 0;
T_init(2021, 1, 0);
T_init(2021, 1);
T_stdout = 0;
while (1) {
getchar();
T(T_ENB_PHY_PUCCH_1AB_IQ, T_INT(0), T_INT(0), T_INT(frame), T_INT(0), T_INT(0), T_INT(0));
......
CC=gcc
CFLAGS=-Wall -g -pthread -DT_TRACER -I.
CFLAGS=-Wall -g -pthread -DT_TRACER -I. -I../incgen
#CFLAGS += -O3 -ffast-math -fomit-frame-pointer
......@@ -66,9 +66,9 @@ gnb: utils.o gnb.o database.o event.o handler.o configuration.o \
filter/filter.a
$(CC) $(CFLAGS) -o gnb $^ $(LIBS) $(XLIBS)
multi.o: ../T_IDs.h
multi.o: ../incgen/T_IDs.h
../T_IDs.h:
../incgen/T_IDs.h: ../T_messages.txt
cd .. && $(MAKE)
.PHONY: all gui/gui.a view/view.a logger/logger.a filter/filter.a
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment