#
# OETMP is the same as TMPDIR as defined in ${OVEROTOP}/build/conf/site.conf
#
-
+OVEROTOP = /home/ntaka/dev/overo-yocto-2015/build
OETMP = ${OVEROTOP}/tmp
-# There were some OE toolchain path changes recently
-
-# OE prior to around 30July2010
-# TOOLDIR = ${OETMP}/cross/armv7a/bin
-# STAGEDIR = ${OETMP}/staging/armv7a-angstrom-linux-gnueabi/usr
-
-# OE after 30July2010
-#TOOLDIR = ${OETMP}/sysroots/`uname -m`-linux/usr/armv7a/bin
-TOOLDIR = ${OETMP}/sysroots/i686-linux/usr/armv7a/bin
-STAGEDIR = ${OETMP}/sysroots/armv7a-angstrom-linux-gnueabi/usr
-
-CC = ${TOOLDIR}/arm-angstrom-linux-gnueabi-gcc
-
-# for DEBUG
-#CFLAGS = -Wall -lm -lpthread -DDEBUG_FILE_MIN -DDEBUG_FILE_MIN_PERIOD=1
+TOOLDIR = ${OETMP}/sysroots/`uname -m`-linux/usr/bin/arm-poky-linux-gnueabi
+STAGEDIR = ${OETMP}/sysroots/overo
+#CC = ${TOOLDIR}/arm-poky-linux-gnueabi-gcc
+#LD = ${TOOLDIR}/arm-poky-linux-gnueabi-ld
CFLAGS = -Wall -lm -lpthread
+CFLAGS += -Wno-return-type -Werror=array-bounds -Warray-bounds
+CFLAGS += --sysroot=${STAGEDIR}
+CXXFLAGS += --sysroot=${STAGEDIR}
+# 警告をエラー扱いにする
+#CFLAGS += -Werror
+# for DEBUG
+#CFLAGS += -Wall -lm -lpthread -DDEBUG_FILE_MIN -DDEBUG_FILE_MIN_PERIOD=1
-LIBDIR = ${STAGEDIR}/lib
-
-INCDIR = ${STAGEDIR}/include
+#LIBDIR = ${STAGEDIR}/lib
+#INCDIR = ${STAGEDIR}/include
TARGET = scilog
HDRS = mes_print.h debug_print.h spi.h my_thread.h ring.h ad_ring.h thread_rec.h sts.h ad_file.h conf.h lcd.h
${TARGET} : $(OBJS) $(HDRS)
- ${CC} ${CFLAGS} ${OBJS} -L ${LIBDIR} -o ${TARGET}
+ ${CC} ${CFLAGS} ${OBJS} -o ${TARGET}
+# ${CC} ${CFLAGS} ${OBJS} -L ${LIBDIR} -I ${INCDIR} -o ${TARGET}
#meas.o: meas.c
# ${CC} ${CFLAGS} -I ${INCDIR} -c meas.c
ad->gps.year, ad->gps.month, ad->gps.day, ad->gps.hour, ad->gps.min, ad->gps.sec,
ad->gps.tacc, ad->gps.valid);
for(ch = 0; ch < AD_CHNUM; ch++) {
- sprintf(buf2, ",%+7ld", ad->data1sec[ch]);
+ sprintf(buf2, ",%+7d", ad->data1sec[ch]);
strcat(buf, buf2);
}
strcat(buf, "\n");
#define __AVG_RING_H__
#include <time.h>
+#include <stdint.h>
#include "spi.h"
// リングバッファサイズ 個数
UbloxNavTimeUtc gps; // GPSタイムスタンプ SPIで受信
struct tm t; // タイムスタンプ struct tmの月は(0〜11)なので注意 年は1900からのオフセット
int freq; // 平均周波数 Hz
- long data1sec[AD_CHNUM]; // 1sec平均値 SPIで受信
- long data[AD_CHNUM][AD_SAMPLE]; // AD_SAMPLE[Hz]の生データ SPIで受信
- long avg[AD_CHNUM][AD_SAMPLE]; // 平均後データ
+ int32_t data1sec[AD_CHNUM]; // 1sec平均値 SPIで受信
+ int32_t data[AD_CHNUM][AD_SAMPLE]; // AD_SAMPLE[Hz]の生データ SPIで受信
+ int32_t avg[AD_CHNUM][AD_SAMPLE]; // 平均後データ
unsigned int checksum; // SPI受信データのchecksumフィールド
} AdData;
#include "mes_print.h"
#include "lcd.h"
-#define DEV_LCD "/dev/i2c-3"
+#define DEV_LCD "/dev/i2c-2" // Kernel3.18から変わった 以前はi2c-3
static int fh = -1;
*
* Ver1.0.1
* conf_linux_time_set_XXX() add?
+ * thread_disp.cでGPS時刻をlinuxにset
*
* Ver1.0.2
* 2015/09/22
* lcd.c i2clcd_init() i2cLCD基板のConfig変更 LCD自動初期化ON
+ *
+ * Ver1.0.3
+ * Kernel 3.18.18 対応
+ * i2cデバイス名変更
+ * spiデバイス名変更 ->/dev/spikead spikeadデバイス側で変更したため
+ * ad_ring.h AdDataのADデータ型をlong->int32_tに変更
+ * data1sec[]
+ * data[][]
+ * avg[][]
+ * thread_rcv.c b3_to_long32() 返り値long->int32_tにした
+ *
+ * ●コンパイル方法
+ * . environment-setup-cortexa8hf-vfp-neon-poky-linux-gnueabi
+ * make
*
*/
#include <stdio.h>
// ダミーデータを自分で発生するときに定義
//#define DUMMY
-#define VERSION "1.0.2"
+#define VERSION "1.0.3"
-#define DEV_SPI "/dev/spike-ad"
+#define DEV_SPI "/dev/spikead"
/**** 設定デフォルト値
*/
signal(SIGTERM, sig_handler);
lcd_init();
- lcd_pos(6, 1);
- lcd_print("sciLogger");
+ lcd_pos(0, 1);
+ lcd_print("sciLogger ");
+ lcd_print(VERSION);
lcd_pos(0, 3);
ad_ring_init();
conf_read();
PDEBUG("freq=%d\n", conf_freq_get());
PDEBUG("gain=%d\n", conf_gain_get());
+ PDEBUG("linux_time_set=%d\n", conf_linux_time_set_get());
lcd_print("*");
PDEBUG("sciLogger %s START\n", VERSION);
+++ /dev/null
-\r
-#include <stdio.h>\r
-#include <CUnit/CUnit.h>\r
-#include <CUnit/Console.h>\r
-\r
-#include "my_thread.h"\r
-#include "spi.h"\r
-#include "ad_ring.h"\r
-\r
-int main (int argc, char *argv[])\r
-{\r
- CU_pSuite test_suite;\r
- CU_initialize_registry();\r
- test_suite = CU_add_suite("scilog", NULL, NULL);\r
-\r
- thread_rcv_test(test_suite);\r
- ad_ring_test(test_suite);\r
-\r
- CU_console_run_tests();\r
-\r
- CU_cleanup_registry();\r
-\r
-}\r
iLeft = 0;
iY = 1;
for(ch = 0; ch < 3; ch++) {
- sprintf(buf, "%d% 8ld", ch+1, d->data1sec[ch]);
+ sprintf(buf, "%d% 8d", ch+1, d->data1sec[ch]);
lcd_pos(iLeft, iY++);
lcd_print(buf);
}
iLeft = 10;
iY = 1;
for(ch = 3; ch < 6; ch++) {
- sprintf(buf, "%d% 8ld", ch+1, d->data1sec[ch]);
+ sprintf(buf, "%d% 8d", ch+1, d->data1sec[ch]);
lcd_pos(iLeft, iY++);
lcd_print(buf);
}
#include <syslog.h>
#include <sys/types.h>
#include <string.h>
+#include <stdint.h>
#include "debug_print.h"
#include "spi.h"
Little Endian
3byte -> signed long(4byte)
*/
-static long b3_to_long32(unsigned char *ptr)
+static int32_t b3_to_long32(unsigned char *ptr)
{
char buf[4];
} else {
buf[3] = 0;
}
- return *((long*)buf);
+ return *((int32_t*)buf);
}
static int decode(char *buf, AdData *ad)
{
ad->data1sec[ch] = *((int32_t*)ptr);
ptr += 4;
}
+/*
+u_int8_t *ptrsave = ptr;
+for(i = 0; i < AD_SAMPLE; i++) {
+ *ptr++ = i;
+ *ptr++ = 0;
+ *ptr++ = 0;
+}
+ptr = ptrsave;
+*/
// 50Hz data
for(ch = 0; ch < AD_CHNUM; ch++) {
for(i = 0; i < AD_SAMPLE; i++) {
ptr += 3;
}
}
+// DEBUG!!!!!!!!!!!!!!!!!!!!!!!
+//for(i = 0; i < AD_SAMPLE; i++) {
+// ad->data[0][i] = i;
+//}
+
// Checksum
ad->checksum = *((u_int16_t*)ptr);