I upgraded my ATS compiler from 2.4 to 3.4 and now have a new compiler error that I have failed to fix, and need a few pointers.
This application is not using the run time, as the code is linked into a larger application using an RTOS in an FX3. The application was fully working before the compiler upgrade.
A file named frames.dats has the following code at the top:
staload _ = "prelude/DATS/pointer.dats"
staload _ = "prelude/DATS/array.dats"
staload _ = "prelude/DATS/arrayptr.dats"
staload _ = "prelude/DATS/arrayref.dats"
staload _ = "prelude/DATS/string.dats"
staload _ = "prelude/DATS/integer.dats"
staload _ = "prelude/DATS/integer_fixed.dats"
staload UN = "prelude/SATS/unsafe.sats"
staload _ = "prelude/DATS/unsafe.dats"
and this leads to the following compiler error:
In file included from DATS/frames_dats.c:15:0:
DATS/frames_dats.c: In function 'ATSLIB_056_prelude__ptr0_add_gint__12__1':
DATS/frames_dats.c:2341:22: error: 'PMVtmpltcstmat' undeclared (first use in this function)
ATSINSmove(tmp28__1, PMVtmpltcstmat[0](g0int2uint<S2Eextkind(atstype_int), S2Eextkind(atstype_size)>)(arg1)) ;
Looking at the generated code around line 2341:
/*
emit_instr: loc0 = /usr/local/lib/ats2-postiats-0.3.4/prelude/DATS/pointer.dats: 2125(line=81, offs=18) -- 2137(line=81, offs=30)
*/
ATSINSmove(tmp28__1, PMVtmpltcstmat[0](g0int2uint<S2Eextkind(atstype_int), S2Eextkind(atstype_size)>)(arg1)) ;
we can see the error came from compiling pointer.dats
which has this code at line 81:
implement
{a}{tk}
ptr0_add_gint(p, i) =
add_ptr_bsz(p, g0int2uint(i) * sizeof<a>)
implement
{a}{tk}
ptr0_sub_gint(p, i) =
sub_ptr_bsz(p, g0int2uint(i) * sizeof<a>)
I tried adding this at the top of frames.dats per other discussions in the group
#include "share/atspre_staload.hats"
but it does not help.
My make file does not use the ATS .mk files, so I am providing my makefile in case I missed something important.
Does anyone have any ideas on the root cause?
FX3FWROOT=/opt/share/cypress/cyfx3sdk
ATS = $(wildcard SATS/*.sats)
DATS = $(wildcard DATS/*.dats)
DATSC = $(patsubst %.dats,%_dats.c,$(DATS))
DATSOBJ = $(patsubst %.dats,%_dats.o,$(DATS))
ATS = patsopt
ATSCFLAGS = -std=c99 -D_XOPEN_SOURCE
ATSCFLAGS += -D_ATS_CCOMP_EXCEPTION_NONE_ -D_ATS_CCOMP_RUNTIME_NONE_
ATSCFLAGS += -Wno-unused-variable -Wno-unused-label -Wno-unused-but-set-variable
ATSCFLAGS += -I. -I${PATSHOME} -I${PATSHOME}/ccomp/runtime
ATSCFLAGS += -DATS_MEMALLOC_LIBC
USER_CFLAGS = $(ATSCFLAGS)
CYCONFOPT = fx3_profile_release
all:compile
include $(FX3FWROOT)/fw_build/fx3_fw/fx3_build_config.mak
MODULE = upuck
SOURCE= $(MODULE).c \
dscr.c \
cyfxtx.c \
smbus.c \
fetch.c \
apperror.c \
DATS/print_dats.c \
DATS/frames_dats.c \
DATS/numbers_dats.c \
DATS/polling_dats.c \
DATS/crc_dats.c \
DATS/smbus_dats.c \
DATS/process_dats.c
ifeq ($(CYFXBUILD),arm)
SOURCE_ASM=cyfx_startup.S
else
SOURCE_ASM=cyfx_gcc_startup.S
endif
C_OBJECT=$(SOURCE:%.c=./%.o)
A_OBJECT=$(SOURCE_ASM:%.S=./%.o)
EXES = $(MODULE).$(EXEEXT)
$(MODULE).$(EXEEXT): $(A_OBJECT) $(C_OBJECT)
$(LINK)
cyfxtx.c:
cp $(FX3FWROOT)/fw_build/fx3_fw/cyfxtx.c .
cyfx_startup.S:
cp $(FX3FWROOT)/fw_build/fx3_fw/cyfx_startup.S .
cyfx_gcc_startup.S:
cp $(FX3FWROOT)/fw_build/fx3_fw/cyfx_gcc_startup.S .
$(DATSC): %_dats.c: %.dats $(SATS)
$(ATS) -o $@.tmp -d $<
mv $@.tmp $@
$(C_OBJECT) : %.o : %.c
$(COMPILE)
$(A_OBJECT) : %.o : %.S
$(ASSEMBLE)
image:
-@echo 'Generate boot-loadable binary image'
-/opt/cypress/cyfx3sdk/util/elf2img/elf2img -i upuck.elf -o upuck.img -v
-@echo ' '
clean:
rm -f ./$(MODULE).$(EXEEXT)
rm -f ./$(MODULE).map
rm -f ./*.o DATS/*.o DATS/*.c
rm -f cyfxtx.c cyfx_startup.S cyfx_gcc_startup.S
compile: $(C_OBJECT) $(A_OBJECT) $(EXES)