how to run .sedona file

306 views
Skip to first unread message

cyshooter

unread,
Jun 15, 2012, 9:44:36 PM6/15/12
to Sedona Framework
i'm trying to let sedona to communicate with serial device in the
ubuntu, following guide of sedonadev, i'm coded the
serialportcomm.sedona which declares the field and some native
methods, and accomplished the native method of doInit and doClose.
there is some test code in the \test\SerialTest.sedona like this:

class SerialTest
extends Test
{
static inline SerialPortComm thePort

define int PORT = 1

static void testOpenClose()
{
Sys.out.print("SerialTest.testOpenClose()\n");
thePort.portNum = PORT

int rc = thePort.open()
assert(rc==0)
thePort.close();
}
}

how can i run the .sedona file and test the method doInit and doClose
is OK in the ubuntu? thanks a lot!
best regards

Patrick Cunningham

unread,
Jun 18, 2012, 9:18:07 AM6/18/12
to sedo...@googlegroups.com
If you're trying to use serial ports on Linux, first note that you have to write some native code to hook into termios.  Take a look at this thread:

https://groups.google.com/group/sedonadev/browse_thread/thread/76486c49dd6d3f6c#

Take a look at src\serial\native\win32\serial_serialPort_win32.c to see the native code for win32 serial ports.  You have to modify this code to use the termios.h API instead of serialWin32.h

cyshooter

unread,
Jun 18, 2012, 10:02:23 AM6/18/12
to Sedona Framework
thanks patrick
i write the native method, but when i run the app, the compiler says:
missing the native method in thehttp://groups.google.com/group/sedonadev/browse_thread/thread/62b4e6a841d7a8b4,
how can i do for this? thanks a lot


On 6月18日, 下午9时18分, Patrick Cunningham <patrick.sed...@gmail.com>
wrote:
> If you're trying to use serial ports on Linux, first note that you have to
> write some native code to hook into termios.  Take a look at this thread:
>
> https://groups.google.com/group/sedonadev/browse_thread/thread/76486c...
>
> Take a look at src\serial\native\win32\serial_serialPort_win32.c to see the
> native code for win32 serial ports.  You have to modify this code to use
> the termios.h API instead of serialWin32.h
>
>
>
> On Friday, June 15, 2012 9:44:36 PM UTC-4, cyshooter wrote:
>
> > i'm trying to let sedona to communicate with serial device in the
> > ubuntu, following guide of sedonadev, i'm coded the
> > serialportcomm.sedona which declares the field and some native
> > methods, and accomplished the native method of doInit and doClose.
> > there is some test code  in the \test\SerialTest.sedona like this:
>
> > class SerialTest
> >    extends Test
> > {
> >    static inline SerialPortComm thePort
>
> >    define int PORT = 1
>
> >    static void testOpenClose()
> >    {
> >       Sys.out.print("SerialTest.testOpenClose()\n");
> >       thePort.portNum = PORT
>
> >       int rc = thePort.open()
> >       assert(rc==0)
> >       thePort.close();
> >    }
> > }
>
> > how can i run the .sedona file and test the method doInit and doClose
> > is OK in the ubuntu? thanks a lot!
> > best regards- 隐藏被引用文字 -
>
> - 显示引用的文字 -

Patrick Cunningham

unread,
Jun 18, 2012, 11:26:15 AM6/18/12
to sedo...@googlegroups.com
What is in serialcomm_SerialCommu_qnx.c?

Does it have this method?

Cell serialcomm_SerialCommu_doInit(SedonaVM* vm, Cell* params)
{

Patrick Cunningham

unread,
Jun 18, 2012, 11:36:52 AM6/18/12
to sedo...@googlegroups.com
Also make sure that you've included the new source path in src/generic/unix/generic-unix.xml


On Monday, June 18, 2012 10:02:23 AM UTC-4, cyshooter wrote:

McKenney, Elizabeth (Tridium)

unread,
Jun 18, 2012, 12:16:34 PM6/18/12
to sedo...@googlegroups.com

Actually I think his platform defn file is unix-serial.xml

 

And if it were missing from the platform defn, I’m not sure the svm would compile?

He seems to have an svm that runs, but is missing a valid native table entry for 3::0.

 

.

emck

unread,
Jun 18, 2012, 2:05:01 PM6/18/12
to sedo...@googlegroups.com
Could you attach the nativetable.c file from the last time you compiled your svm executable?
I'm trying to figure out how your SVM could build, yet have an incomplete native table array.

cyshooter

unread,
Jun 18, 2012, 8:59:22 PM6/18/12
to Sedona Framework
thanks all of you very much, best regards for all of you.
there is my serialcomm_SerialCommu_qnx.c:
#include "sedona.h"
#include "serialQnx.h"

int psd[PORTSIZE];
struct termios newtio,oldtio;

Cell serialcomm_SerialCommu_doInit(SedonaVM * vm, Cell* params)
{
int fd;
int setflag;
int32_t portNum = params[1].ival;
int32_t baudRate = params[2].ival;
int32_t dataBits = params[3].ival;
int32_t stopBits = params[4].ival;
int32_t parity = params[5].ival;
int32_t rtsLevel = params[6].ival;

if (portNum==1)
{
fd=open(DEFAULTPORT,O_RDWR|O_NOCTTY);
if (-1==fd)
{
perror("can't open serial port");
return negOneCell;
}
else printf("open ttyUSB0.....\n");
}
else
{
printf("sorry,we only support ttyUSB0 now.....\n");
return negOneCell;
}

if(fcntl(fd,F_SETFL,0)<0)
printf("fcntl failed! \n");
else
printf("fcntl=%d\n",fcntl(fd,F_SETFL,0));
printf("fd-open=%d\n",fd);

psd[portNum]=fd;
if
((setflag=SetCommParams(fd,dataBits,stopBits,parity,rtsLevel,baudRate))<0)
{
perror("set params error");
return negOneCell;
}

return zeroCell;
}

Cell serialcomm_SerialCommu_doClose(SedonaVM* vm, Cell* params)
{
int fd;
int32_t portNum = params[1].ival;

fd=psd[portNum];
tcsetattr(fd,TCSANOW,&oldtio);
close(fd);
psd[portNum]=0;
return zeroCell;
}

Cell serialcomm_SerialCommu_doRead(SedonaVM* vm, Cell* params)
{

}

Cell serialcomm_SerialCommu_doWrite(SedonaVM* vm, Cell* params)
{

}

Cell serialcomm_SerialCommu_doReadBytes(SedonaVM* vm, Cell* params)
{

}

Cell serialcomm_SerialCommu_doWriteBytes(SedonaVM* vm, Cell* params)
{

}

int SetCommParams(int fd,
int dataBits,
int stopBits,
int parity,
int flowControl,
int baudRate)
{

//char flowbit;

if(tcgetattr(fd,&oldtio)!=0)
{
perror("setup serial1 error");
return -1;
}
bzero(&newtio,sizeof(newtio));
newtio.c_cflag |=CLOCAL | CREAD;
newtio.c_cflag &=~SIZE;

switch(dataBits)
{
case 7:newtio.c_cflag |=CS7;break;
case 8:newtio.c_cflag |=CS8;break;
}

switch(parity)
{
case 0:newtio.c_cflag &=~PARENB;break;
case 1:newtio.c_cflag |=PARENB;newtio.c_cflag |=PARODD;
newtio.c_iflag |=(INPCK | ISTRIP);break;
case 2:newtio.c_iflag |=(INPCK | ISTRIP);newtio.c_cflag |=PARENB;
newtio.c_cflag &=~PARODD;break;
}

switch(baudRate)
{
case
2400:cfsetispeed(&newtio,B2400);cfsetospeed(&newtio,B2400);break;
case
9600:cfsetispeed(&newtio,B9600);cfsetospeed(&newtio,B9600);break;
}

if(stopBits==1)
newtio.c_cflag &=~CSTOPB;
else if(stopBits==2)
newtio.c_cflag |=CSTOPB;

//flag=ioctl(fd,TIOCMGET,&flowControl)
newtio.c_cc[VTIME]=0;
newtio.c_cc[VMIN]=0;
newtio.c_iflag &=~(IXON|ICRNL);
tcflush(fd,TCIFLUSH);
if((tcsetattr(fd,TCSANOW,&newtio))!=0)
{
perror("serial port set error");
return -1;
}
printf("set done!\n");
return 0;
}

cyshooter

unread,
Jun 18, 2012, 9:01:40 PM6/18/12
to Sedona Framework
and there is my unix-serial.xml definding the platform definition:

<sedonaPlatform vendor="Tridium" id="tridium-generic-unix-$
{sedona.env.version}">

<compile endian="little" blockSize="4" refSize="4" debug="true"
test="true">

<!-- Native Kits -->
<nativeKit depend="sys 1.0" />
<nativeKit depend="inet 1.0" />
<nativeKit depend="datetimeStd 1.0" />
<nativeKit depend="platUnix 1.0" />
<nativeKit depend="serialcomm 1.0" />

<!-- Sources -->
<nativeSource path="/src/vm" />
<nativeSource path="/src/sys/native" />
<nativeSource path="/src/sys/native/std" />
<nativeSource path="/src/sys/native/unix" />
<nativeSource path="/src/inet/native" />
<nativeSource path="/src/inet/native/std" />
<nativeSource path="/src/inet/native/sha1" />
<nativeSource path="/src/datetimeStd/native/std" />
<nativeSource path="/platforms/src/generic/unix/native" />
<nativeSource path="/serialcomm/native/qnx" />
</compile>

</sedonaPlatform>

cyshooter

unread,
Jun 18, 2012, 9:11:17 PM6/18/12
to Sedona Framework
this is the nativetable.c my last compiled:
//
// Generated by sedonac 1.0.48
// 19-Jun-2012 09:06
//

#include "sedona.h"

////////////////////////////////////////////////////////////////
// sys (kitId=0)
////////////////////////////////////////////////////////////////

// sys::Str Sys.platformType()
Cell sys_Sys_platformType(SedonaVM* vm, Cell* params);

// void Sys.copy(byte[], int, byte[], int, int)
Cell sys_Sys_copy(SedonaVM* vm, Cell* params);

// byte[] Sys.malloc(int)
Cell sys_Sys_malloc(SedonaVM* vm, Cell* params);

// void Sys.free(sys::Obj)
Cell sys_Sys_free(SedonaVM* vm, Cell* params);

// sys::Str Sys.intStr(int)
Cell sys_Sys_intStr(SedonaVM* vm, Cell* params);

// sys::Str Sys.hexStr(int)
Cell sys_Sys_hexStr(SedonaVM* vm, Cell* params);

// sys::Str Sys.longStr(long)
Cell sys_Sys_longStr(SedonaVM* vm, Cell* params);

// sys::Str Sys.longHexStr(long)
Cell sys_Sys_longHexStr(SedonaVM* vm, Cell* params);

// sys::Str Sys.floatStr(float)
Cell sys_Sys_floatStr(SedonaVM* vm, Cell* params);

// sys::Str Sys.doubleStr(double)
Cell sys_Sys_doubleStr(SedonaVM* vm, Cell* params);

// int Sys.floatToBits(float)
Cell sys_Sys_floatToBits(SedonaVM* vm, Cell* params);

// long Sys.doubleToBits(double)
Cell sys_Sys_doubleToBits(SedonaVM* vm, Cell* params);

// float Sys.bitsToFloat(int)
Cell sys_Sys_bitsToFloat(SedonaVM* vm, Cell* params);

// double Sys.bitsToDouble(long)
Cell sys_Sys_bitsToDouble(SedonaVM* vm, Cell* params);

// long Sys.ticks()
Cell sys_Sys_ticks(SedonaVM* vm, Cell* params);

// void Sys.sleep(long)
Cell sys_Sys_sleep(SedonaVM* vm, Cell* params);

// int Sys.compareBytes(byte[], int, byte[], int, int)
Cell sys_Sys_compareBytes(SedonaVM* vm, Cell* params);

// void Sys.setBytes(int, byte[], int, int)
Cell sys_Sys_setBytes(SedonaVM* vm, Cell* params);

// void Sys.andBytes(int, byte[], int, int)
Cell sys_Sys_andBytes(SedonaVM* vm, Cell* params);

// void Sys.orBytes(int, byte[], int, int)
Cell sys_Sys_orBytes(SedonaVM* vm, Cell* params);

// byte[] Sys.scodeAddr()
Cell sys_Sys_scodeAddr(SedonaVM* vm, Cell* params);

// int Sys.rand()
Cell sys_Sys_rand(SedonaVM* vm, Cell* params);

// void Component.invokeVoid(sys::Slot)
Cell sys_Component_invokeVoid(SedonaVM* vm, Cell* params);

// void Component.invokeBool(sys::Slot, bool)
Cell sys_Component_invokeBool(SedonaVM* vm, Cell* params);

// void Component.invokeInt(sys::Slot, int)
Cell sys_Component_invokeInt(SedonaVM* vm, Cell* params);

// void Component.invokeLong(sys::Slot, long)
Cell sys_Component_invokeLong(SedonaVM* vm, Cell* params);

// void Component.invokeFloat(sys::Slot, float)
Cell sys_Component_invokeFloat(SedonaVM* vm, Cell* params);

// void Component.invokeDouble(sys::Slot, double)
Cell sys_Component_invokeDouble(SedonaVM* vm, Cell* params);

// void Component.invokeBuf(sys::Slot, sys::Buf)
Cell sys_Component_invokeBuf(SedonaVM* vm, Cell* params);

// bool Component.getBool(sys::Slot)
Cell sys_Component_getBool(SedonaVM* vm, Cell* params);

// int Component.getInt(sys::Slot)
Cell sys_Component_getInt(SedonaVM* vm, Cell* params);

// long Component.getLong(sys::Slot)
Cell sys_Component_getLong(SedonaVM* vm, Cell* params);

// float Component.getFloat(sys::Slot)
Cell sys_Component_getFloat(SedonaVM* vm, Cell* params);

// double Component.getDouble(sys::Slot)
Cell sys_Component_getDouble(SedonaVM* vm, Cell* params);

// sys::Buf Component.getBuf(sys::Slot)
Cell sys_Component_getBuf(SedonaVM* vm, Cell* params);

// bool Component.doSetBool(sys::Slot, bool)
Cell sys_Component_doSetBool(SedonaVM* vm, Cell* params);

// bool Component.doSetInt(sys::Slot, int)
Cell sys_Component_doSetInt(SedonaVM* vm, Cell* params);

// bool Component.doSetLong(sys::Slot, long)
Cell sys_Component_doSetLong(SedonaVM* vm, Cell* params);

// bool Component.doSetFloat(sys::Slot, float)
Cell sys_Component_doSetFloat(SedonaVM* vm, Cell* params);

// bool Component.doSetDouble(sys::Slot, double)
Cell sys_Component_doSetDouble(SedonaVM* vm, Cell* params);

// sys::Obj Type.malloc()
Cell sys_Type_malloc(SedonaVM* vm, Cell* params);

// bool StdOutStream.doWrite(int)
Cell sys_StdOutStream_doWrite(SedonaVM* vm, Cell* params);

// bool StdOutStream.doWriteBytes(byte[], int, int)
Cell sys_StdOutStream_doWriteBytes(SedonaVM* vm, Cell* params);

// void StdOutStream.doFlush()
Cell sys_StdOutStream_doFlush(SedonaVM* vm, Cell* params);

// int FileStore.doSize(sys::Str)
Cell sys_FileStore_doSize(SedonaVM* vm, Cell* params);

// sys::Obj FileStore.doOpen(sys::Str, sys::Str)
Cell sys_FileStore_doOpen(SedonaVM* vm, Cell* params);

// int FileStore.doRead(sys::Obj)
Cell sys_FileStore_doRead(SedonaVM* vm, Cell* params);

// int FileStore.doReadBytes(sys::Obj, byte[], int, int)
Cell sys_FileStore_doReadBytes(SedonaVM* vm, Cell* params);

// bool FileStore.doWrite(sys::Obj, int)
Cell sys_FileStore_doWrite(SedonaVM* vm, Cell* params);

// bool FileStore.doWriteBytes(sys::Obj, byte[], int, int)
Cell sys_FileStore_doWriteBytes(SedonaVM* vm, Cell* params);

// int FileStore.doTell(sys::Obj)
Cell sys_FileStore_doTell(SedonaVM* vm, Cell* params);

// bool FileStore.doSeek(sys::Obj, int)
Cell sys_FileStore_doSeek(SedonaVM* vm, Cell* params);

// void FileStore.doFlush(sys::Obj)
Cell sys_FileStore_doFlush(SedonaVM* vm, Cell* params);

// bool FileStore.doClose(sys::Obj)
Cell sys_FileStore_doClose(SedonaVM* vm, Cell* params);

// bool FileStore.rename(sys::Str, sys::Str)
Cell sys_FileStore_rename(SedonaVM* vm, Cell* params);

// int Test.doMain()
Cell sys_Test_doMain(SedonaVM* vm, Cell* params);

// sys::Str Str.fromBytes(byte[], int)
Cell sys_Str_fromBytes(SedonaVM* vm, Cell* params);

// native table for kit 0
NativeMethod kitNatives0[] =
{
sys_Sys_platformType, // 0::0
sys_Sys_copy, // 0::1
sys_Sys_malloc, // 0::2
sys_Sys_free, // 0::3
sys_Sys_intStr, // 0::4
sys_Sys_hexStr, // 0::5
sys_Sys_longStr, // 0::6
sys_Sys_longHexStr, // 0::7
sys_Sys_floatStr, // 0::8
sys_Sys_doubleStr, // 0::9
sys_Sys_floatToBits, // 0::10
sys_Sys_doubleToBits, // 0::11
sys_Sys_bitsToFloat, // 0::12
sys_Sys_bitsToDouble, // 0::13
sys_Sys_ticks, // 0::14
sys_Sys_sleep, // 0::15
sys_Sys_compareBytes, // 0::16
sys_Sys_setBytes, // 0::17
sys_Sys_andBytes, // 0::18
sys_Sys_orBytes, // 0::19
sys_Sys_scodeAddr, // 0::20
sys_Sys_rand, // 0::21
sys_Component_invokeVoid, // 0::22
sys_Component_invokeBool, // 0::23
sys_Component_invokeInt, // 0::24
sys_Component_invokeLong, // 0::25
sys_Component_invokeFloat, // 0::26
sys_Component_invokeDouble, // 0::27
sys_Component_invokeBuf, // 0::28
sys_Component_getBool, // 0::29
sys_Component_getInt, // 0::30
sys_Component_getLong, // 0::31
sys_Component_getFloat, // 0::32
sys_Component_getDouble, // 0::33
sys_Component_getBuf, // 0::34
sys_Component_doSetBool, // 0::35
sys_Component_doSetInt, // 0::36
sys_Component_doSetLong, // 0::37
sys_Component_doSetFloat, // 0::38
sys_Component_doSetDouble, // 0::39
sys_Type_malloc, // 0::40
sys_StdOutStream_doWrite, // 0::41
sys_StdOutStream_doWriteBytes, // 0::42
sys_StdOutStream_doFlush, // 0::43
sys_FileStore_doSize, // 0::44
sys_FileStore_doOpen, // 0::45
sys_FileStore_doRead, // 0::46
sys_FileStore_doReadBytes, // 0::47
sys_FileStore_doWrite, // 0::48
sys_FileStore_doWriteBytes, // 0::49
sys_FileStore_doTell, // 0::50
sys_FileStore_doSeek, // 0::51
sys_FileStore_doFlush, // 0::52
sys_FileStore_doClose, // 0::53
sys_FileStore_rename, // 0::54
sys_Test_doMain, // 0::55
sys_Str_fromBytes, // 0::56
};

////////////////////////////////////////////////////////////////
// platUnix (kitId=1)
////////////////////////////////////////////////////////////////

// sys::Str UnixPlatformService.doPlatformId()
Cell platUnix_UnixPlatformService_doPlatformId(SedonaVM* vm, Cell*
params);

// native table for kit 1
NativeMethod kitNatives1[] =
{
platUnix_UnixPlatformService_doPlatformId, // 1::0
};

////////////////////////////////////////////////////////////////
// inet (kitId=2)
////////////////////////////////////////////////////////////////

// bool TcpSocket.connect(inet::IpAddr, int)
Cell inet_TcpSocket_connect(SedonaVM* vm, Cell* params);

// bool TcpSocket.finishConnect()
Cell inet_TcpSocket_finishConnect(SedonaVM* vm, Cell* params);

// int TcpSocket.write(byte[], int, int)
Cell inet_TcpSocket_write(SedonaVM* vm, Cell* params);

// int TcpSocket.read(byte[], int, int)
Cell inet_TcpSocket_read(SedonaVM* vm, Cell* params);

// void TcpSocket.close()
Cell inet_TcpSocket_close(SedonaVM* vm, Cell* params);

// bool TcpServerSocket.bind(int)
Cell inet_TcpServerSocket_bind(SedonaVM* vm, Cell* params);

// bool TcpServerSocket.accept(inet::TcpSocket)
Cell inet_TcpServerSocket_accept(SedonaVM* vm, Cell* params);

// void TcpServerSocket.close()
Cell inet_TcpServerSocket_close(SedonaVM* vm, Cell* params);

// bool UdpSocket.open()
Cell inet_UdpSocket_open(SedonaVM* vm, Cell* params);

// bool UdpSocket.bind(int)
Cell inet_UdpSocket_bind(SedonaVM* vm, Cell* params);

// bool UdpSocket.send(inet::UdpDatagram)
Cell inet_UdpSocket_send(SedonaVM* vm, Cell* params);

// bool UdpSocket.receive(inet::UdpDatagram)
Cell inet_UdpSocket_receive(SedonaVM* vm, Cell* params);

// void UdpSocket.close()
Cell inet_UdpSocket_close(SedonaVM* vm, Cell* params);

// int UdpSocket.maxPacketSize()
Cell inet_UdpSocket_maxPacketSize(SedonaVM* vm, Cell* params);

// int UdpSocket.idealPacketSize()
Cell inet_UdpSocket_idealPacketSize(SedonaVM* vm, Cell* params);

// void Crypto.sha1(byte[], int, int, byte[], int)
Cell inet_Crypto_sha1(SedonaVM* vm, Cell* params);

// native table for kit 2
NativeMethod kitNatives2[] =
{
inet_TcpSocket_connect, // 2::0
inet_TcpSocket_finishConnect, // 2::1
inet_TcpSocket_write, // 2::2
inet_TcpSocket_read, // 2::3
inet_TcpSocket_close, // 2::4
inet_TcpServerSocket_bind, // 2::5
inet_TcpServerSocket_accept, // 2::6
inet_TcpServerSocket_close, // 2::7
inet_UdpSocket_open, // 2::8
inet_UdpSocket_bind, // 2::9
inet_UdpSocket_send, // 2::10
inet_UdpSocket_receive, // 2::11
inet_UdpSocket_close, // 2::12
inet_UdpSocket_maxPacketSize, // 2::13
inet_UdpSocket_idealPacketSize, // 2::14
inet_Crypto_sha1, // 2::15
};

////////////////////////////////////////////////////////////////
// serialcomm (kitId=3)
////////////////////////////////////////////////////////////////

// int SerialCommu.doInit(int, int, int, int, int, int)
Cell serialcomm_SerialCommu_doInit(SedonaVM* vm, Cell* params);

// int SerialCommu.doClose(int)
Cell serialcomm_SerialCommu_doClose(SedonaVM* vm, Cell* params);

// int SerialCommu.doRead(int)
Cell serialcomm_SerialCommu_doRead(SedonaVM* vm, Cell* params);

// int SerialCommu.doWrite(int, int)
Cell serialcomm_SerialCommu_doWrite(SedonaVM* vm, Cell* params);

// int SerialCommu.doReadBytes(int, byte[], int, int)
Cell serialcomm_SerialCommu_doReadBytes(SedonaVM* vm, Cell* params);

// int SerialCommu.doWriteBytes(int, byte[], int, int)
Cell serialcomm_SerialCommu_doWriteBytes(SedonaVM* vm, Cell* params);

// native table for kit 3
NativeMethod kitNatives3[] =
{
serialcomm_SerialCommu_doInit, // 3::0
serialcomm_SerialCommu_doClose, // 3::1
serialcomm_SerialCommu_doRead, // 3::2
serialcomm_SerialCommu_doWrite, // 3::3
serialcomm_SerialCommu_doReadBytes, // 3::4
serialcomm_SerialCommu_doWriteBytes, // 3::5
};

////////////////////////////////////////////////////////////////
// datetimeStd (kitId=9)
////////////////////////////////////////////////////////////////

// long DateTimeServiceStd.doNow()
Cell datetimeStd_DateTimeServiceStd_doNow(SedonaVM* vm, Cell* params);

// void DateTimeServiceStd.doSetClock(long)
Cell datetimeStd_DateTimeServiceStd_doSetClock(SedonaVM* vm, Cell*
params);

// int DateTimeServiceStd.doGetUtcOffset()
Cell datetimeStd_DateTimeServiceStd_doGetUtcOffset(SedonaVM* vm, Cell*
params);

// native table for kit 9
NativeMethod kitNatives9[] =
{
datetimeStd_DateTimeServiceStd_doNow, // 9::0
datetimeStd_DateTimeServiceStd_doSetClock, // 9::1
datetimeStd_DateTimeServiceStd_doGetUtcOffset, // 9::2
};

////////////////////////////////////////////////////////////////
// Native Table
////////////////////////////////////////////////////////////////

NativeMethod* nativeTable[] =
{
kitNatives0, // 0
kitNatives1, // 1
kitNatives2, // 2
kitNatives3, // 3
NULL, // 4
NULL, // 5
NULL, // 6
NULL, // 7
NULL, // 8
kitNatives9, // 9
};

////////////////////////////////////////////////////////////////
// Native Id Check
////////////////////////////////////////////////////////////////

#ifdef SCODE_DEBUG
int isNativeIdValid(int kitId, int methodId)
{
switch(kitId)
{
case 0:
if (methodId >= 57) return 0;
else return kitNatives0[methodId] != NULL;
case 1:
if (methodId >= 1) return 0;
else return kitNatives1[methodId] != NULL;
case 2:
if (methodId >= 16) return 0;
else return kitNatives2[methodId] != NULL;
case 3:
if (methodId >= 6) return 0;
else return kitNatives3[methodId] != NULL;
case 9:
if (methodId >= 3) return 0;
else return kitNatives9[methodId] != NULL;
default:
return 0;
}
}
#endif

cyshooter

unread,
Jun 18, 2012, 9:30:08 PM6/18/12
to Sedona Framework
and in the documentation of sedonadev, it says:"Note that sedonac does
not build the C code, it simply assembles the files together into a
single directory. The C code must then be built with the appropriate
toolchain for the target platform."
could i compile the serialcomm_SerialCommu_qnx.c firstly, when i try
to compile this file in ubuntu using gcc, it says "fatal
error:sedona.h: No such file or directory", thanks very much
best regards

emck

unread,
Jun 19, 2012, 8:58:44 AM6/19/12
to sedo...@googlegroups.com
sedona.h should have been copied into your tempStage folder when you ran sedonac on your platform definition XML file.
If it wasn't, then check your nativeSource paths in the XML file.
If it was, but the compiler isn't finding it, make sure you include "." in the include path for your compiler.

Patrick Cunningham

unread,
Jun 19, 2012, 9:32:52 AM6/19/12
to sedo...@googlegroups.com
Ive always used the makeunixvm script:

  bash --rcfile ~/sedonadev/adm/unix/init.sh
  makeunixvm

I think that it runs sedonac on the platform definition XML file and then runs gcc on the staged files. 

emck

unread,
Jun 19, 2012, 9:38:57 AM6/19/12
to sedo...@googlegroups.com
OK but which platform XML file does it use?  Isn't it hardcoded to be the generic unix one?
If so then it won't pick up the OP's XML file which has a different name & location.

Patrick Cunningham

unread,
Jun 19, 2012, 9:44:03 AM6/19/12
to sedo...@googlegroups.com
Good point.  I've always modified the generic unix platform XML rather than making a new one.  That's probably not the best choice for managing your own code repo, eh?  Making a copy of the python script and modifying it might be a good idea. 

emck

unread,
Jun 19, 2012, 10:40:18 AM6/19/12
to sedo...@googlegroups.com
Or making the platform XML file an optional argument to the script.


cyshooter

unread,
Jun 19, 2012, 11:26:40 PM6/19/12
to Sedona Framework
it works, i use gcc to compile the file in the tempstage directory,
then it done
thanks very much, i really appreciate your guys kindness
it looks like i will be a spam, i wish it don't let you feel
horrible........:)
best regards!
Reply all
Reply to author
Forward
0 new messages