fixed linux warnings, removed unused/unsed and set variales. Moved fshort-wchar to machine .mk files
parent
6afd2f50cc
commit
c9bbb90ed1
|
@ -30,5 +30,5 @@ include $(PRJ_ROOT)/make/compilers/gcc.mk
|
|||
MACHINE ?= -mthumb-interwork -mlittle-endian -mthumb
|
||||
|
||||
# Compiler flags
|
||||
CFLAGS += $(MACHINE)
|
||||
CFLAGS += $(MACHINE) -fshort-wchar
|
||||
LDFLAGS += $(MACHINE) -Wl,--no-wchar-size-warning
|
||||
|
|
|
@ -30,5 +30,5 @@ include $(PRJ_ROOT)/make/compilers/gcc.mk
|
|||
MACHINE ?= -mcpu=bf537
|
||||
|
||||
# Compiler flags
|
||||
CFLAGS += $(MACHINE)
|
||||
CFLAGS += $(MACHINE) -fshort-wchar
|
||||
LDFLAGS += $(MACHINE)
|
||||
|
|
|
@ -46,7 +46,7 @@ CC_INC_PATH = $(GCC_PATH)/$(CROSS_GCC)/include
|
|||
|
||||
# Compiler flags
|
||||
CFLAGS = -Wall -Wextra -Wno-unused-parameter #-Werror
|
||||
CFLAGS += -fomit-frame-pointer -fno-strict-aliasing -fshort-wchar
|
||||
CFLAGS += -fomit-frame-pointer -fno-strict-aliasing
|
||||
CFLAGS += -B$(GCC_PATH)/libexec/gcc
|
||||
|
||||
# Compiler C++ flags
|
||||
|
|
|
@ -34,6 +34,6 @@ include $(PRJ_ROOT)/make/compilers/gcc.mk
|
|||
MACHINE ?= -mbig -mregnames -mcpu=powerpc -mcall-sysv -meabi
|
||||
|
||||
# Compiler flags
|
||||
CFLAGS += $(MACHINE)
|
||||
CFLAGS += $(MACHINE) -fshort-wchar
|
||||
LDFLAGS += $(MACHINE)
|
||||
|
||||
|
|
|
@ -30,6 +30,6 @@ include $(PRJ_ROOT)/make/compilers/gcc.mk
|
|||
MACHINE ?= -mcpu=8540 -mregnames -mmultiple -mabi=spe
|
||||
|
||||
# Compiler flags
|
||||
CFLAGS += $(MACHINE)
|
||||
CFLAGS += $(MACHINE) -fshort-wchar
|
||||
LDFLAGS += $(MACHINE)
|
||||
|
||||
|
|
|
@ -281,14 +281,13 @@ void ecatthread( void *ptr )
|
|||
{
|
||||
struct timespec ts;
|
||||
struct timeval tp;
|
||||
int rc;
|
||||
int ht;
|
||||
int i;
|
||||
int pcounter = 0;
|
||||
int64 cycletime;
|
||||
|
||||
rc = pthread_mutex_lock(&mutex);
|
||||
rc = gettimeofday(&tp, NULL);
|
||||
pthread_mutex_lock(&mutex);
|
||||
gettimeofday(&tp, NULL);
|
||||
|
||||
/* Convert from timeval to timespec */
|
||||
ts.tv_sec = tp.tv_sec;
|
||||
|
@ -302,10 +301,10 @@ void ecatthread( void *ptr )
|
|||
/* calculate next cycle start */
|
||||
add_timespec(&ts, cycletime + toff);
|
||||
/* wait to cycle start */
|
||||
rc = pthread_cond_timedwait(&cond, &mutex, &ts);
|
||||
pthread_cond_timedwait(&cond, &mutex, &ts);
|
||||
if (dorun>0)
|
||||
{
|
||||
rc = gettimeofday(&tp, NULL);
|
||||
gettimeofday(&tp, NULL);
|
||||
|
||||
ec_send_processdata();
|
||||
|
||||
|
@ -345,7 +344,6 @@ void ecatthread( void *ptr )
|
|||
|
||||
int main(int argc, char *argv[])
|
||||
{
|
||||
int iret1;
|
||||
int ctime;
|
||||
struct sched_param param;
|
||||
int policy = SCHED_OTHER;
|
||||
|
@ -371,11 +369,11 @@ int main(int argc, char *argv[])
|
|||
else
|
||||
ctime = 1000; // 1ms cycle time
|
||||
/* create RT thread */
|
||||
iret1 = pthread_create( &thread1, NULL, (void *) &ecatthread, (void*) &ctime);
|
||||
pthread_create( &thread1, NULL, (void *) &ecatthread, (void*) &ctime);
|
||||
memset(¶m, 0, sizeof(param));
|
||||
/* give it higher priority */
|
||||
param.sched_priority = 40;
|
||||
iret1 = pthread_setschedparam(thread1, policy, ¶m);
|
||||
pthread_setschedparam(thread1, policy, ¶m);
|
||||
|
||||
/* start acyclic part */
|
||||
eboxtest(argv[1]);
|
||||
|
|
|
@ -211,7 +211,7 @@ int output_intelhex(char *fname, int length)
|
|||
|
||||
int eeprom_read(int slave, int start, int length)
|
||||
{
|
||||
int i, wkc, ainc = 4;
|
||||
int i, ainc = 4;
|
||||
uint16 estat, aiadr;
|
||||
uint32 b4;
|
||||
uint64 b8;
|
||||
|
@ -221,13 +221,13 @@ int eeprom_read(int slave, int start, int length)
|
|||
{
|
||||
aiadr = 1 - slave;
|
||||
eepctl = 2;
|
||||
wkc = ec_APWR(aiadr, ECT_REG_EEPCFG, sizeof(eepctl), &eepctl , EC_TIMEOUTRET); /* force Eeprom from PDI */
|
||||
ec_APWR(aiadr, ECT_REG_EEPCFG, sizeof(eepctl), &eepctl , EC_TIMEOUTRET); /* force Eeprom from PDI */
|
||||
eepctl = 0;
|
||||
wkc = ec_APWR(aiadr, ECT_REG_EEPCFG, sizeof(eepctl), &eepctl , EC_TIMEOUTRET); /* set Eeprom to master */
|
||||
ec_APWR(aiadr, ECT_REG_EEPCFG, sizeof(eepctl), &eepctl , EC_TIMEOUTRET); /* set Eeprom to master */
|
||||
|
||||
estat = 0x0000;
|
||||
aiadr = 1 - slave;
|
||||
wkc=ec_APRD(aiadr, ECT_REG_EEPSTAT, sizeof(estat), &estat, EC_TIMEOUTRET); /* read eeprom status */
|
||||
ec_APRD(aiadr, ECT_REG_EEPSTAT, sizeof(estat), &estat, EC_TIMEOUTRET); /* read eeprom status */
|
||||
estat = etohs(estat);
|
||||
if (estat & EC_ESTAT_R64)
|
||||
{
|
||||
|
@ -265,24 +265,23 @@ int eeprom_read(int slave, int start, int length)
|
|||
|
||||
int eeprom_write(int slave, int start, int length)
|
||||
{
|
||||
int i, wkc, dc = 0;
|
||||
int i, dc = 0;
|
||||
uint16 aiadr, *wbuf;
|
||||
uint8 eepctl;
|
||||
int ret;
|
||||
|
||||
if((ec_slavecount >= slave) && (slave > 0) && ((start + length) <= MAXBUF))
|
||||
{
|
||||
aiadr = 1 - slave;
|
||||
eepctl = 2;
|
||||
wkc = ec_APWR(aiadr, ECT_REG_EEPCFG, sizeof(eepctl), &eepctl , EC_TIMEOUTRET); /* force Eeprom from PDI */
|
||||
ec_APWR(aiadr, ECT_REG_EEPCFG, sizeof(eepctl), &eepctl , EC_TIMEOUTRET); /* force Eeprom from PDI */
|
||||
eepctl = 0;
|
||||
wkc = ec_APWR(aiadr, ECT_REG_EEPCFG, sizeof(eepctl), &eepctl , EC_TIMEOUTRET); /* set Eeprom to master */
|
||||
ec_APWR(aiadr, ECT_REG_EEPCFG, sizeof(eepctl), &eepctl , EC_TIMEOUTRET); /* set Eeprom to master */
|
||||
|
||||
aiadr = 1 - slave;
|
||||
wbuf = (uint16 *)&ebuf[0];
|
||||
for (i = start ; i < (start + length) ; i+=2)
|
||||
{
|
||||
ret = ec_writeeepromAP(aiadr, i >> 1 , *(wbuf + (i >> 1)), EC_TIMEOUTEEP);
|
||||
ec_writeeepromAP(aiadr, i >> 1 , *(wbuf + (i >> 1)), EC_TIMEOUTEEP);
|
||||
if (++dc >= 100)
|
||||
{
|
||||
dc = 0;
|
||||
|
@ -299,7 +298,6 @@ int eeprom_write(int slave, int start, int length)
|
|||
|
||||
int eeprom_writealias(int slave, int alias, uint16 crc)
|
||||
{
|
||||
int wkc;
|
||||
uint16 aiadr;
|
||||
uint8 eepctl;
|
||||
int ret;
|
||||
|
@ -308,9 +306,9 @@ int eeprom_writealias(int slave, int alias, uint16 crc)
|
|||
{
|
||||
aiadr = 1 - slave;
|
||||
eepctl = 2;
|
||||
wkc = ec_APWR(aiadr, ECT_REG_EEPCFG, sizeof(eepctl), &eepctl , EC_TIMEOUTRET); /* force Eeprom from PDI */
|
||||
ec_APWR(aiadr, ECT_REG_EEPCFG, sizeof(eepctl), &eepctl , EC_TIMEOUTRET); /* force Eeprom from PDI */
|
||||
eepctl = 0;
|
||||
wkc = ec_APWR(aiadr, ECT_REG_EEPCFG, sizeof(eepctl), &eepctl , EC_TIMEOUTRET); /* set Eeprom to master */
|
||||
ec_APWR(aiadr, ECT_REG_EEPCFG, sizeof(eepctl), &eepctl , EC_TIMEOUTRET); /* set Eeprom to master */
|
||||
|
||||
ret = ec_writeeepromAP(aiadr, 0x04 , alias, EC_TIMEOUTEEP);
|
||||
if (ret)
|
||||
|
|
|
@ -197,12 +197,10 @@ void ec_sync(int64 reftime, int64 cycletime , int64 *offsettime)
|
|||
OSAL_THREAD_FUNC_RT ecatthread(void *ptr)
|
||||
{
|
||||
struct timespec ts, tleft;
|
||||
struct timeval tp;
|
||||
int rc;
|
||||
int ht;
|
||||
int64 cycletime;
|
||||
|
||||
rc = clock_gettime(CLOCK_MONOTONIC, &ts);
|
||||
clock_gettime(CLOCK_MONOTONIC, &ts);
|
||||
ht = (ts.tv_nsec / 1000000) + 1; /* round to nearest ms */
|
||||
ts.tv_nsec = ht * 1000000;
|
||||
cycletime = *(int*)ptr * 1000; /* cycletime in ns */
|
||||
|
@ -214,7 +212,7 @@ OSAL_THREAD_FUNC_RT ecatthread(void *ptr)
|
|||
/* calculate next cycle start */
|
||||
add_timespec(&ts, cycletime + toff);
|
||||
/* wait to cycle start */
|
||||
rc = clock_nanosleep(CLOCK_MONOTONIC, TIMER_ABSTIME, &ts, &tleft);
|
||||
clock_nanosleep(CLOCK_MONOTONIC, TIMER_ABSTIME, &ts, &tleft);
|
||||
if (dorun>0)
|
||||
{
|
||||
wkc = ec_receive_processdata(EC_TIMEOUTRET);
|
||||
|
@ -313,7 +311,6 @@ OSAL_THREAD_FUNC ecatcheck( void *ptr )
|
|||
|
||||
int main(int argc, char *argv[])
|
||||
{
|
||||
int iret1, iret2;
|
||||
int ctime;
|
||||
|
||||
printf("SOEM (Simple Open EtherCAT Master)\nRedundancy test\n");
|
||||
|
@ -324,10 +321,10 @@ int main(int argc, char *argv[])
|
|||
ctime = atoi(argv[3]);
|
||||
|
||||
/* create RT thread */
|
||||
iret1 = osal_thread_create_rt(&thread1, stack64k * 2, &ecatthread, (void*) &ctime);
|
||||
osal_thread_create_rt(&thread1, stack64k * 2, &ecatthread, (void*) &ctime);
|
||||
|
||||
/* create thread to handle slave error handling in OP */
|
||||
iret2 = osal_thread_create(&thread2, stack64k * 4, &ecatcheck, NULL);
|
||||
osal_thread_create(&thread2, stack64k * 4, &ecatcheck, NULL);
|
||||
|
||||
/* start acyclic part */
|
||||
redtest(argv[1],argv[2]);
|
||||
|
|
|
@ -37,7 +37,7 @@ uint8 currentgroup = 0;
|
|||
|
||||
void simpletest(char *ifname)
|
||||
{
|
||||
int i, j, oloop, iloop, wkc_count, chk;
|
||||
int i, j, oloop, iloop, chk;
|
||||
needlf = FALSE;
|
||||
inOP = FALSE;
|
||||
|
||||
|
@ -92,7 +92,6 @@ void simpletest(char *ifname)
|
|||
if (ec_slave[0].state == EC_STATE_OPERATIONAL )
|
||||
{
|
||||
printf("Operational state reached for all slaves.\n");
|
||||
wkc_count = 0;
|
||||
inOP = TRUE;
|
||||
/* cyclic loop */
|
||||
for(i = 1; i <= 10000; i++)
|
||||
|
@ -232,13 +231,12 @@ OSAL_THREAD_FUNC ecatcheck( void *ptr )
|
|||
|
||||
int main(int argc, char *argv[])
|
||||
{
|
||||
int iret1;
|
||||
printf("SOEM (Simple Open EtherCAT Master)\nSimple test\n");
|
||||
|
||||
if (argc > 1)
|
||||
{
|
||||
/* create thread to handle slave error handling in OP */
|
||||
// iret1 = pthread_create( &thread1, NULL, (void *) &ecatcheck, (void*) &ctime);
|
||||
// pthread_create( &thread1, NULL, (void *) &ecatcheck, (void*) &ctime);
|
||||
osal_thread_create(&thread1, 128000, &ecatcheck, (void*) &ctime);
|
||||
/* start cyclic part */
|
||||
simpletest(argv[1]);
|
||||
|
|
Loading…
Reference in New Issue