HEADS-project / training

Training material to get started with the HEADS technologies
10 stars 16 forks source link

[Tuto 3 & 4][Arduino] Compilation Errors on arduino IDE #66

Closed nharrand closed 9 years ago

nharrand commented 9 years ago

When I try to compile the code generated by CPrinter.thingml or CTimer.thingml for C/C++ for Arduino it does'nt compile on the Arduino IDE (1.05 or 1.6.0).

Here are the logs:


Log

sketch_mar05b.ino: In function ‘void enqueue_CustomPrinterClient_send_Print_customPrint(CustomPrinterClientInstance, char_)’: sketch_mar05b.ino:291:1: error: ‘ptr_union_t’ was not declared in this scope sketch_mar05b.ino:291:13: error: expected ‘;’ before ‘ptrunion_myString’ sketch_mar05b.ino:292:1: error: ‘ptrunion_myString’ was not declared in this scope sketch_mar05b.ino: In function ‘void processMessageQueue()’: sketch_mar05b.ino:321:11: error: ‘ptr_union_t’ was not declared in this scope sketch_mar05b.ino:321:23: error: expected primary-expression before ‘)’ token


Log

CPrinter.thingml => C/C++ for Arduino => Arduino IDE 1.05 sketch_mar05b.ino: In function ‘void f_ClockLinux_sleep_ms(ClockLinuxInstance, int)’: sketch_mar05b.ino:181:16: error: aggregate ‘f_ClockLinux_sleep_ms(ClockLinuxInstance, int)::timeval tv’ has incomplete type and cannot be defined sketch_mar05b.ino:187:40: error: ‘select’ was not declared in this scope sketch_mar05b.ino: At global scope: sketch_mar05b.ino:197:3: error: ‘pthread_mutex_t’ does not name a type sketch_mar05b.ino:198:3: error: ‘pthread_cond_t’ does not name a type sketch_mar05b.ino: In function ‘void f_ClockLinux_start_clock_processproc(void)’: sketch_mar05b.ino:220:29: error: ‘struct f_ClockLinux_start_clock_process_struct’ has no member named ‘lock’ sketch_mar05b.ino:220:33: error: ‘pthread_mutex_lock’ was not declared in this scope sketch_mar05b.ino:221:30: error: ‘struct f_ClockLinux_start_clock_process_struct’ has no member named ‘cv’ sketch_mar05b.ino:221:32: error: ‘pthread_cond_signal’ was not declared in this scope sketch_mar05b.ino:222:31: error: ‘struct f_ClockLinux_start_clock_process_struct’ has no member named ‘lock’ sketch_mar05b.ino:222:35: error: ‘pthread_mutex_unlock’ was not declared in this scope sketch_mar05b.ino: In function ‘void f_ClockLinux_start_clock_process(ClockLinuxInstance)’: sketch_mar05b.ino:234:3: error: ‘pthread_mutex_t’ was not declared in this scope sketch_mar05b.ino:234:19: error: expected ‘;’ before ‘lock’ sketch_mar05b.ino:235:3: error: ‘pthread_cond_t’ was not declared in this scope sketch_mar05b.ino:235:18: error: expected ‘;’ before ‘cv’ sketch_mar05b.ino:236:10: error: ‘struct f_ClockLinux_start_clock_process_struct’ has no member named ‘lock’ sketch_mar05b.ino:236:18: error: ‘lock’ was not declared in this scope sketch_mar05b.ino:237:10: error: ‘struct f_ClockLinux_start_clock_process_struct’ has no member named ‘cv’ sketch_mar05b.ino:237:16: error: ‘cv’ was not declared in this scope sketch_mar05b.ino:240:29: error: ‘struct f_ClockLinux_start_clock_process_struct’ has no member named ‘lock’ sketch_mar05b.ino:240:39: error: ‘pthread_mutex_init’ was not declared in this scope sketch_mar05b.ino:241:28: error: ‘struct f_ClockLinux_start_clock_process_struct’ has no member named ‘cv’ sketch_mar05b.ino:241:36: error: ‘pthread_cond_init’ was not declared in this scope sketch_mar05b.ino:243:29: error: ‘struct f_ClockLinux_start_clock_process_struct’ has no member named ‘lock’ sketch_mar05b.ino:243:33: error: ‘pthread_mutex_lock’ was not declared in this scope sketch_mar05b.ino:244:3: error: ‘pthread_t’ was not declared in this scope sketch_mar05b.ino:244:13: error: expected ‘;’ before ‘thread’ sketch_mar05b.ino:245:20: error: ‘thread’ was not declared in this scope sketch_mar05b.ino:245:88: error: ‘pthread_create’ was not declared in this scope sketch_mar05b.ino:247:28: error: ‘struct f_ClockLinux_start_clock_process_struct’ has no member named ‘cv’ sketch_mar05b.ino:247:39: error: ‘struct f_ClockLinux_start_clock_process_struct’ has no member named ‘lock’ sketch_mar05b.ino:247:43: error: ‘pthread_cond_wait’ was not declared in this scope sketch_mar05b.ino:249:31: error: ‘struct f_ClockLinux_start_clock_process_struct’ has no member named ‘lock’ sketch_mar05b.ino:249:35: error: ‘pthread_mutex_unlock’ was not declared in this scope

brice-morin commented 9 years ago

Yes, the CTimer uses thread and some other stuff probably not available on Arduino.

Can you update the tutorial and provide an Arduino-specific version of the required components (e.g. using millis() to implement a timer, see e.g. https://github.com/SINTEF-9012/ThingML/blob/master/org.thingml.samples/src/main/thingml/core/_arduino/timer.thingml

nharrand commented 9 years ago

Both problems should be fixed now.