Hello everybody!
I have a problem by using Hmote2430 and Keil compiler for my sensor network project. When I use Keil compiler to compile my NesC code, I have some error as follow:
vu_anh_dung@anhdung /opt/tinyos-2.x/apps/Battery3 $ ./AUTOMAKE.sh
C:\cygwin\opt\tinyos-2.x\apps\Battery3\build\hmote2430>echo off
A51 MACRO ASSEMBLER V8.01 - SN: K1MMC-0LE18C COPYRIGHT KEIL ELEKTRONIK GmbH 1987 - 2007
ASSEMBLY COMPLETE. 0 WARNING(S), 0 ERROR(S)
C51 COMPILER V8.12 - SN: K1MMC-0LE18C COPYRIGHT KEIL ELEKTRONIK GmbH 1987 - 2008 *** WARNING C219 IN LINE 1527 OF APP.C: long constant truncated *** ERROR C136 IN LINE 1596 OF APP.C: invalid dimension size: [0]
C51 COMPILATION COMPLETE. 1 WARNING(S), 1 ERROR(S)
LX51 LINKER/LOCATER V4.25 - SN: K1MMC-0LE18C COPYRIGHT KEIL ELEKTRONIK GmbH 1995 - 2007 startup.obj, app.obj TO app CLASSES( XDATA(X:0xE000-X:0xFF00), IDATA(I:0-I:0xFF)) REGFILE(app.reg)ma *** ERROR L210: I/O ERROR ON INPUT FILE: EXCEPTION 0021H: PATH OR FILE NOT FOUND FILE: APP.OBJ
Extended 8051/251 Object to Hex File Converter V1.36b COPYRIGHT KEIL ELEKTRONIK GmbH 2000 - 2006
*** ERROR: CAN'T OPEN FILE 'app' ********************************************************** ***** app.hex is created.. upload IMAGE to CC2430 !! ***** **** You can use SmartRF04 Flash Programmer (chipcon) **** ********************************************************** ls: app.hex: No such file or directory
- To implement on Hmote2430 device, I used app.hex file to implement on it. but Keil compiler can not generate hex file by this error. - If I copy the APP file generate from another program, Keil compiler can generate hex file but the result same to that another program. - I need some help, please!
Guess what?
People can't help you unless they have access to _all_ relevant symbols required to decode a source line.
The symbol AlarmToTimerC__0__fired is probably zero, which it most probably should not be. Time for you to check why.
The warning line (1526) uses a large number of symbols that I can not know the value/type of.
But the above problems are generic C problems. You do know C?
By the way: Why not format the code as code when posting? This is clearly described in the text just above the message box when you write a post.
- Sorry for my limited because I don't know C language.
My NesC code below:
configuration TestSensorC { } implementation { components MainC, TestSensorP; MainC.SoftwareInit -> TestSensorP.Init; MainC.Boot <- TestSensorP; components LedsC; TestSensorP.Leds -> LedsC; components new TimerMilliC() as TimerC; TestSensorP.Timer -> TimerC; components StdOutC; TestSensorP.StdOut -> StdOutC; components BattC; TestSensorP.BattControl -> BattC.StdControl; TestSensorP.Batt -> BattC.SimpleADC; }
module TestSensorP { provides interface Init; uses interface Boot; uses interface Timer<TMilli>; uses interface Leds; uses interface StdOut; uses interface StdControl as BattControl; uses interface SimpleADC as Batt; } implementation { float value; command error_t Init.init() { return SUCCESS; } event void Boot.booted() { call Leds.led1On(); call Leds.led0On(); call StdOut.print("*************************\n\r"); call StdOut.print("* Program initialized *\n\r"); call StdOut.print("* Exercise 7 : Voltage *\n\r"); call StdOut.print("*************************\n\r"); call BattControl.start(); call Timer.startPeriodic(300); } event error_t Batt.dataReady(uint16_t data, uint8_t status) { call StdOut.printBase10uint16(data); call StdOut.print(" : "); value = data*0.0183195; call StdOut.printBase10uint16(value); call StdOut.print("mV"); call StdOut.print("\n\r"); } event void Timer.fired() { call Leds.led1Toggle(); call Batt.getData(); } async event void StdOut.get(uint8_t data) { return; } }
***My process below***
Compile NesC code:
vu_anh_dung@anhdung /opt/tinyos-2.x/apps/Battery3 $ make hmote2430 mkdir -p build/hmote2430 ncc -S -Os -I/opt/tinyos-2.x/tos/platform/hmote2430 -D__hmote2430__=1 -Wall -Wshadow -DDEF_TOS_AM_GROUP=0x7d -Wnesc-all -conly -target=hmote2430 -fnesc-cfile=build/hmote2430/app.c -board=hy2430 TestSensorC.nc 2>&1 | \ grep -v "attribute directive ignored" /opt/tinyos-2.x/tos/chips/cc2430/ioCC2430.h:259: warning: non-atomic accesses to shared variable 'SLEEP': /opt/tinyos-2.x/tos/chips/cc2430/McuSleepC.nc:61: warning: non-atomic write /opt/tinyos-2.x/tos/chips/cc2430/McuSleepC.nc:61: warning: non-atomic read compiled TestSensorC to build/hmote2430/app.c cp /opt/tinyos-2.x/support/make/mcs51/startup.a51 build/hmote2430 cp /opt/tinyos-2.x/support/make/mcs51/startup.bat build/hmote2430 cp /opt/tinyos-2.x/support/make/mcs51/MAKEHEX.sh build/hmote2430 compiling TestSensorC to a hmote2430 binary mv build/hmote2430/app.c build/hmote2430/app.preMangle.c perl -w /opt/tinyos-2.x/support/make/mcs51/mangleAppC.pl --KEIL --file=build/hmote2430/app.preMangle.c > build/hmote2430 /app.c cp /opt/tinyos-2.x/support/make/mcs51/CC2430-F128.bat build/hmote2430 cp /opt/tinyos-2.x/support/make/mcs51/AUTOMAKE.sh . compiled TestSensorC to a hmote2430 binary **** Build Completed!!! ****
Generate Hex file:
vu_anh_dung@anhdung /opt/tinyos-2.x/apps/Battery3 $ ./AUTOMAKE.sh C:\cygwin\opt\tinyos-2.x\apps\Battery3\build\hmote2430>echo off A51 MACRO ASSEMBLER V8.01 - SN: K1MMC-0LE18C COPYRIGHT KEIL ELEKTRONIK GmbH 1987 - 2007 ASSEMBLY COMPLETE. 0 WARNING(S), 0 ERROR(S) C:\cygwin\opt\tinyos-2.x\apps\Battery3\build\hmote2430>echo off C51 COMPILER V8.12 - SN: K1MMC-0LE18C COPYRIGHT KEIL ELEKTRONIK GmbH 1987 - 2008 *** WARNING C219 IN LINE 1519 OF APP.C: long constant truncated *** ERROR C136 IN LINE 1588 OF APP.C: invalid dimension size: [0] C51 COMPILATION COMPLETE. 1 WARNING(S), 1 ERROR(S) LX51 LINKER/LOCATER V4.25 - SN: K1MMC-0LE18C COPYRIGHT KEIL ELEKTRONIK GmbH 1995 - 2007 startup.obj, app.obj TO app CLASSES( XDATA(X:0xE000-X:0xFF00), IDATA(I:0-I:0xFF)) REGFILE(app.reg)ma *** ERROR L210: I/O ERROR ON INPUT FILE: EXCEPTION 0021H: PATH OR FILE NOT FOUND FILE: APP.OBJ Extended 8051/251 Object to Hex File Converter V1.36b COPYRIGHT KEIL ELEKTRONIK GmbH 2000 - 2006 *** ERROR: CAN'T OPEN FILE 'app' ********************************************************** ***** app.hex is created.. upload IMAGE to CC2430 !! ***** **** You can use SmartRF04 Flash Programmer (chipcon) **** ********************************************************** ls: app.hex: No such file or directory
Because my app.c file has more than 4000 line, I upload on internet, please check it for me. this is a app.c file. www.box.net/.../ylq4gbjzdt
You did notice that the C51 compiler did complain about the contents of APP.C?
That means that the _C_ code must be examined. The nesC code will not contain the relevant constants - they are generated by the nesC to C converter.
Your problems _may_ be because you have a problem with the nesC code.
Your problems _may_ be because the nesC to C converter does not produce code that is compatible with the C51 compiler.
Thanks, I think my problem was not in NesC code, because when I compiled NesC code, there is no error and have some warning, and if I have something wrong in NesC, the compiler will give me the error message. But when I generated to Hex file by app.c file, I have had some errors what I don't know. So how to solve this problem, could you give me some advise? I really feel worried now.