undeclared error when defined in SATS

25 views
Skip to first unread message

Mike Jones

unread,
May 9, 2017, 4:53:11 PM5/9/17
to ats-lang-users
This is another problem related to moving from 2.4 to 3.4 compiler.

The compiler error:

DATS/process_dats.c: In function '_057_home_057_michael_057_share_057_design_057_code_057_uPuckFX3_057_DATS_057_frames_056_dats__validate_in_frame__38__1':
DATS
/process_dats.c:4185:145: error: 'packetInCount' undeclared (first use in this function)
 
ATSINSmove(tmp97__1, _057_home_057_michael_057_share_057_design_057_code_057_uPuckFX3_057_DATS_057_numbers_056_dats__n10_(ATSderef(ATSPMVextval(packetInCount), atstkind_t0ype(atstype_uint16)))) ;


Is used in the said file, with these includes:

#include "share/atspre_staload.hats"

staload CH
= "prelude/SATS/char.sats"
staload UN
= "prelude/SATS/unsafe.sats"
staload _
= "prelude/DATS/unsafe.dats"

...
staload
"SATS/frames.sats"
staload
"DATS/frames.dats"
...

In frames.sats:

staload "SATS/state.sats"

%{^
extern uint8_t packetInData[1024];
extern const uint8_t *packetIn;
extern const uint16_t *packetInCount;

In frames.dats:

#include "share/atspre_staload.hats"

staload UN
= "prelude/SATS/unsafe.sats"
staload _
= "prelude/DATS/unsafe.dats"

%{^
uint8_t packetInData
[1024] __attribute__ ((aligned (32)));
const uint8_t  *packetIn             = packetInData;
const uint16_t *packetInCount        = (uint16_t*)packetInData;

Looking in frames_dats.c, the variables are defined, but nothing creates a frames_dats.h file with externs.

Looks like I need to do something to create headers that would be included?

Hongwei Xi

unread,
May 9, 2017, 4:55:40 PM5/9/17
to ats-lan...@googlegroups.com
In frame.sats, please relpace

%{^


with

%{#


--
You received this message because you are subscribed to the Google Groups "ats-lang-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to ats-lang-users+unsubscribe@googlegroups.com.
To post to this group, send email to ats-lang-users@googlegroups.com.
Visit this group at https://groups.google.com/group/ats-lang-users.
To view this discussion on the web visit https://groups.google.com/d/msgid/ats-lang-users/9d2b9dba-14da-4149-9d3c-a05cf6fc89ba%40googlegroups.com.

Mike Jones

unread,
May 9, 2017, 5:44:14 PM5/9/17
to ats-lang-users
I get this exception:

patsopt -o DATS/process_dats.c.tmp -d DATS/process.dats
/home/michael/share/design/code/uPuckFX3/SATS/frames.sats: 28(line=3, offs=1) -- 32(line=3, offs=5): error(parsing): the token is discarded.
exit(ATS): uncaught exception: _2home_2hwxi_2Research_2ATS_2dPostiats_2src_2pats_error_2esats__FatalErrorExn(1025)
makefile
:79: recipe for target 'DATS/process_dats.c' failed
make
: *** [DATS/process_dats.c] Error 1

with code:

%{#
// The max size of an In Frame is 1024 bytes.

extern uint8_t packetInData[1024];
extern const uint8_t *packetIn;
extern const uint16_t *packetInCount;
extern const uint8_t *packetInHeader;
extern const uint8_t *packetInContents;
extern const uint8_t *smbusInControl;
extern const uint8_t *smbusInProtocol;
extern const uint8_t *smbusInAddress;
extern const uint8_t *smbusInCommand;
extern const uint8_t *smbusInData0;
extern const uint8_t *smbusInData1;

// The max size of an Out Frame is 1024 bytes;
extern uint8_t packetOutData[1024];
extern const uint8_t *packetOut;
extern const uint16_t *packetOutCount;
extern const uint8_t *packetOutHeader;
extern const uint8_t *packetOutContents;
extern const uint8_t *smbusOutProtocol;
extern const uint8_t *smbusOutBlock;

%}

Perhaps something in the closing bracket needs change?

Mike Jones

unread,
May 9, 2017, 5:46:08 PM5/9/17
to ats-lang-users
Ok, I was dumb to include "with"

It compiles now.

Is there some doc explaining the meaning of the changed bracketing?

Hongwei Xi

unread,
May 9, 2017, 6:04:27 PM5/9/17
to ats-lan...@googlegroups.com

--
You received this message because you are subscribed to the Google Groups "ats-lang-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to ats-lang-users+unsubscribe@googlegroups.com.
To post to this group, send email to ats-lang-users@googlegroups.com.
Visit this group at https://groups.google.com/group/ats-lang-users.
Reply all
Reply to author
Forward
0 new messages