contiki-os / contiki

The official git repository for Contiki, the open source OS for the Internet of Things
http://www.contiki-os.org/
Other
3.71k stars 2.58k forks source link

mesh example - contiki #787

Closed exe99 closed 10 years ago

exe99 commented 10 years ago

Hello,

i have a HexaBus Plug Board with Contiki OS. At the moment i am trying to do the mesh routing.

i am trying to run the "example-mesh.c" file from Adam Dunkels It looks like this: //---------------------------------------------------------------------------------------------------------

include "contiki.h"

include "net/rime.h"

include "net/rime/mesh.h"

include "dev/button-sensor.h"

include "dev/leds.h"

include

include

define MESSAGE "Hello"

static struct meshconn mesh; /---------------------------------------------------------------------------_/ PROCESS(example_mesh_process, "Mesh example"); AUTOSTART_PROCESSES(&example_meshprocess); /---------------------------------------------------------------------------_/ static void sent(struct mesh_conn *c) { printf("packet sent\n"); }

static void timedout(struct mesh_conn *c) { printf("packet timedout\n"); }

static void recv(struct mesh_conn _c, const rimeaddr_t from, uint8_t hops) { printf("Data received from %d.%d: %._s (%d)\n", from->u8[0], from->u8[1], packetbuf_datalen(), (char )packetbuf_dataptr(), packetbuf_datalen());

packetbuf_copyfrom(MESSAGE, strlen(MESSAGE)); mesh_send(&mesh, from); }

const static struct meshcallbacks callbacks = {recv, sent, timedout}; /---------------------------------------------------------------------------_/ PROCESS_THREAD(example_mesh_process, ev, data) { PROCESS_EXITHANDLER(mesh_close(&mesh);) PROCESS_BEGIN();

mesh_open(&mesh, 132, &callbacks);

SENSORS_ACTIVATE(button_sensor);

while(1) { rimeaddr_t addr;

/* Wait for button click before sending the first message. */
PROCESS_WAIT_EVENT_UNTIL(ev == sensors_event && data == &button_sensor);

printf("Button clicked\n");

/* Send a message to node number 1. */

packetbuf_copyfrom(MESSAGE, strlen(MESSAGE));
addr.u8[0] = 1;
addr.u8[1] = 0;
mesh_send(&mesh, &addr);

} PROCESSEND(); } /---------------------------------------------------------------------------_/

But i can not start it. If i try to compile it under my Linux. It says:

" ... undefined reference to mesh_close' " " ... undefined reference tomesh_open' " " ... undefined reference to mesh_send' " " ... undefined reference tomesh_button_sensor' " " ... undefined reference to `mesh_button_event' "

I use the makefile von HexaBus and it looks like this: //---------------------------------------------------------------------------- all: ipso mv ipso.Hexabus-Socket Hexabus-Socket.elf avr-objcopy -O ihex -R .signature -R .fuse -R .eeprom Hexabus-Socket.elf Hexabus-Socket.hex avr-size -C --mcu=atmega1284P Hexabus-Socket.elf

avr-size -C --mcu=atmega2561 Hexabus-Socket.elf

avr-size -C --mcu=atxmega256d3 Hexabus-Socket.elf

APPS =hexabus-webserver udp_handler temperature button endpoint_registry APPS +=datetime_service shutter relay state_machine button_handlers hexapush APPS +=metering shutter relay provisioning value_broadcast hxb_broadcast_handler APPS +=presence_detector hexonoff analogread i2c humidity pressure APPS +=ir_receiver memory_debugger sm_upload epaper pt100 hexasense

UIP_CONF_IPV6=1

CONTIKI=../contiki-2.x

CONTIKI=../contiki-2.4

include $(CONTIKI)/Makefile.include CFLAGS += -Wall -Werror -Wno-unused -Wswitch-enum CFLAGS += -D"SHORT_FILE=\"basename $<\""

flash-jtag2: avrdude -c jtag2 -P usb -p atmega1284p -U flash:w:Hexabus-Socket.hex -F flash-jtag3: avrdude -c jtag3 -P usb -p atmega1284p -U flash:w:Hexabus-Socket.hex -F flash-dragon: avrdude -c dragon_jtag -P usb -p atmega1284p -U flash:w:Hexabus-Socket.hex -F

//--------------------------------------------------------------------------------------------------------

I hope someone can help me out. I dont know how to fix this Problem :/ everything goes well. Only the mesh_example doesnt want to work.

Thank you very much in advance.

nvt commented 10 years ago

The issues reported on this tracker are for the development of the official Contiki source code tree. Your question is for a user-specific setup, and is thus more appropriate for the contiki-developers mailing list.