Hi,
You are right. I have now correct that part but I have another problem. When
compiled with the mps430-gcc my code give this output:
rom...@romolo-laptop:/opt/tinyos-1.x/apps/Blink_functionC$ msp430-gcc
c_code.c
/opt/msp430/lib/gcc-lib/msp430/3.2.3/../../../../msp430/lib/crt430x110.o:gcrt0.S:72:
undefined reference to `_reset_vector__'
/tmp/ccYaaPUX.o: In function `stampa':
c_code.c:(.text+0x12): undefined reference to `printf'
and naturally with the make another error..
rom...@romolo-laptop:/opt/tinyos-1.x/apps/Blink_functionC$ make telosb
mkdir -p build/telosb
compiling Blink to a telosb binary
ncc -o build/telosb/main.exe -O -Wall -Wshadow -DDEF_TOS_AM_GROUP=0x7d
-Wnesc-all -target=telosb -fnesc-cfile=build/telosb/app.c -board=
-I%T/lib/Deluge
-Wl,--section-start=.text=0x4800,--defsym=_reset_vector__=0x4000
-DIDENT_PROGRAM_NAME=\"Blink\" -DIDENT_USER_ID=\"romolo\"
-DIDENT_HOSTNAME=\"romolo-laptop\" -DIDENT_USER_HASH=0xed3257d1L
-DIDENT_UNIX_TIME=0x4caf1d65L -DIDENT_UID_HASH=0xa4999627L -mdisable-hwmul
-I/opt/tinyos-1.x/tos/lib/CC2420Radio Blink.nc -lm
/tmp/ccaA9vDU.o: In function `TimerM$executeTimers':
app.c:(.text+0x4e4): undefined reference to `stampa'
make: *** [exe0] Error 1
I think I'm missing something very stupid but I don't understand what...
Luca
2010/10/8 Urs Hunkeler <[email protected]>
> Hi Luca,
>
> If you copy your answers also to the TinyOS mailing list (reply all), then
> others can see our discussions and might solve similar problems or could
> contribute their ideas.
>
> From the output that you provide it seems that you have compiled c_code.c
> separately, which gives you a c_code.o. This c_code.o seems to include a
> main method, which conflicts with the main method in the TinyOS program. A
> library or object file that is not the main program should not have a main
> method. It also appears that you compiled the c_code.c file for a different
> platform (most likely to run on your PC). The microcontroller on the telosb
> mote is not compatible with your PC, and the code needs to be compiled with
> a special version of gcc to generate binary code executable on the MSP430
> microcontroller. You could recompile the code with msp430-gcc, or you could
> simply copy the C function into the NesC file where you need it.
>
> Cheers,
> Urs
>
>
>
> On 10/08/2010 11:00 AM, Luca Pellanda wrote:
>
>> Hi urs,
>>
>> I wrote myself the function, it's the classic hello word..
>> I wanted to include in the Blink app to see if I can compile with c code
>> without problem.. I edit the c_code.h and the c_code.c and also included
>> the "c_code.h" on the top of BlinkM.nc...
>>
>> when I start make telosb this is the output...
>>
>> rom...@romolo-laptop:/opt/tinyos-1.x/apps/Blink_functionC$ make telosb
>> mkdir -p build/telosb
>> compiling Blink to a telosb binary
>> ncc -o build/telosb/main.exe -O -Wall -Wshadow -DDEF_TOS_AM_GROUP=0x7d
>> -Wnesc-all -target=telosb -fnesc-cfile=build/telosb/app.c -board=
>> -I%T/lib/Deluge
>> -Wl,--section-start=.text=0x4800,--defsym=_reset_vector__=0x4000
>> -DIDENT_PROGRAM_NAME=\"Blink\" -DIDENT_USER_ID=\"romolo\"
>> -DIDENT_HOSTNAME=\"romolo-laptop\" -DIDENT_USER_HASH=0xed3257d1L
>> -DIDENT_UNIX_TIME=0x4caedca7L -DIDENT_UID_HASH=0xe305626aL
>> -mdisable-hwmul -I/opt/tinyos-1.x/tos/lib/CC2420Radio Blink.nc -lm
>> c_code.o
>> c_code.o: In function `main':
>> (.text+0x98): multiple definition of `main'
>> /tmp/cc7iwT9s.o:app.c:(.text+0x60): first defined here
>> msp430-ld: Warning: size of symbol `main' changed from 314 in
>> /tmp/cc7iwT9s.o to 25 in c_code.o
>> msp430-ld: warning: unknown architecture of input file `c_code.o' is
>> incompatible with msp:16 output
>> msp430-ld: section .interp [000053cc -> 000053de] overlaps section .data
>> [000053cc -> 000053db]
>> make: *** [exe0] Error 1
>>
>>
>> Thanks for the help...
>>
>> luca
>>
>>
>> 2010/10/8 Urs Hunkeler <[email protected] <mailto:[email protected]
>> >>
>>
>>
>> Hi Luca,
>>
>> What kind of C-function do you refer to? Is it a library function
>> (which library?) or a function you wrote yourself? If you wrote the
>> function yourself, is it in a separate file? Maybe if you post the
>> exact output you get from trying to run Make we can better
>> understand what is causing your problems.
>>
>> Cheers,
>> Urs
>>
>>
>>
>> On 10/08/2010 10:31 AM, Luca Pellanda wrote:
>>
>> Hi guys,
>>
>> I'm new to the tinyOs word so I write here in search of help..
>>
>> I read all the previous post on the use of function C in nesc app.
>> I
>> have however some difficult to compile... (probabily because of my
>> inexperience in the edit of makefile).
>> So I want to ask if there is someone who have a example of a
>> little app
>> with the call to c funtion and post it (especially the make file
>> modified). I searched everywhere but I didn't find any.
>>
>> Thanks for the help
>>
>> Luca
>>
>>
>>
>
_______________________________________________
Tinyos-help mailing list
[email protected]
https://www.millennium.berkeley.edu/cgi-bin/mailman/listinfo/tinyos-help