mruby-arduino
mruby-arduino copied to clipboard
Compilation fails when compiling mruby-arduino.cpp
compilation fails with this output. I'm compiling for stm32f4Discovery compatible board.
CC build/mrbgems/mruby-arduino/src/mruby-arduino.cpp -> build/host/mrbgems/mruby-arduino/src/mruby-arduino.o build/mrbgems/mruby-arduino/src/mruby-arduino.cpp:10:23: fatal error: WProgram.h: File o directory non esistente compilation terminated. rake aborted! Command Failed: ["gcc" -g -O3 -Wall -Werror-implicit-function-declaration -I"/home/eugenio/git/mruby/include" -I"build/mrbgems/mruby-bin-mirb-hostbased/include" -I"build/mrbgems/mruby-arduino/include" -MMD -o "/home/eugenio/git/mruby/build/host/mrbgems/mruby-arduino/src/mruby-arduino.o" -c "build/mrbgems/mruby-arduino/src/mruby-arduino.cpp"] make: *** [all] Errore 1 make: uscita dalla directory "/home/eugenio/git/mruby"
my build_config.rb is this:
http://pastebin.com/8rmKqeec I'm using a Maple (http://leaflabs.com/) compatible board with a custom libmaple version from https://github.com/AeroQuad/AeroQuad
edited to replace the pastebin link to build_config.rb
Seems like you missed WProgram.h. please check and add include path which contains WProgram.h or Arduino.h in you environment.
I could consult more if I could setup build environment for AeroQuad. I downloaded https://github.com/AeroQuad/AeroQuad but dont know how to proceed. (But found WProgram.h in AeroQuad32/MapleCompatibility)
What version of Arduino IDE should I install(1.0.5?) Should I install compiler separately?
And also tell me what board you are using.
AeroQuad32 Flight Control Board? http://www.aeroquadstore.com/AeroQuad_32_Flight_Control_Board_p/aq32-001.htm
I too thought i forgot to include the path to WProgram.h but i did, if you look at my build_config.rb the path is included as
"/home/eugenio/git/AeroQuad/Libmaple/libmaple/wirish"
in build_config.rb. This post in leaflab forum should explain how to use the libmaple version for stm32f4 based boards. The board I use is the fez_cerb40 from GHI electronics and is based on stm32f4XX a st cortex-m4 series microcontroller. There are a few post about fez_cerb40 on leaflab forum this is one. You should also grab the MapleIDE from leaflabs website.
Thanks for info.
I noticed you specified g.cc.include_paths
but mruby-arduino is written in C++, so you should use g.cxx.include_paths
You can check full command line by ./minirake -v on mruby top dir. BTW, http://pastebin.com/8rmKqeec looks confused(500 lines over and some duplicates). It's ok to paste here.
I got this far :
GNU C++ (GNU Tools for ARM Embedded Processors) version 4.7.3 20121207 (release) ARM/embedded-4_7-branch revision 194305 compiled by GNU C version 4.3.6, GMP version 4.3.2, MPFR version 2.4.2, MPC version 0.8.1 GGC heuristics: --param ggc-min-expand=100 --param ggc-min-heapsize=131072 Compiler executable checksum: adee437fad9936e057626ce888dcd43c build/mrbgems/mruby-arduino/src/mruby-arduino.cpp: In function 'mrb_value mrb_serial_available(mrb_state_, mrb_value)': build/mrbgems/mruby-arduino/src/mruby-arduino.cpp:16:27: error: 'Serial' was not declared in this scope build/mrbgems/mruby-arduino/src/mruby-arduino.cpp: In function 'mrb_value mrb_serial_begin(mrb_state_, mrb_value)': build/mrbgems/mruby-arduino/src/mruby-arduino.cpp:22:3: error: 'Serial' was not declared in this scope build/mrbgems/mruby-arduino/src/mruby-arduino.cpp:21:7: warning: unused variable 'n' [-Wunused-variable] build/mrbgems/mruby-arduino/src/mruby-arduino.cpp: In function 'mrb_value mrb_serial_println(mrb_state_, mrb_value)': build/mrbgems/mruby-arduino/src/mruby-arduino.cpp:30:3: error: 'Serial' was not declared in this scope build/mrbgems/mruby-arduino/src/mruby-arduino.cpp: In function 'mrb_value mrb_servo_attach(mrb_state_, mrb_value)': build/mrbgems/mruby-arduino/src/mruby-arduino.cpp:51:7: warning: unused variable 'n' [-Wunused-variable] build/mrbgems/mruby-arduino/src/mruby-arduino.cpp: In function 'mrb_value mrb_servo_write(mrb_state_, mrb_value)': build/mrbgems/mruby-arduino/src/mruby-arduino.cpp:59:7: warning: unused variable 'n' [-Wunused-variable] build/mrbgems/mruby-arduino/src/mruby-arduino.cpp: In function 'mrb_value mrb_arduino_pinMode(mrb_state_, mrb_value)': build/mrbgems/mruby-arduino/src/mruby-arduino.cpp:74:20: error: invalid conversion from 'mrb_int {aka long int}' to 'WiringPinMode' [-fpermissive] In file included from /home/eugenio/git/AeroQuad/Libmaple/libmaple/wirish/wirish.h:40:0, from /home/eugenio/git/AeroQuad/Libmaple/libmaple/wirish/WProgram.h:27, from build/mrbgems/mruby-arduino/src/mruby-arduino.cpp:10: /home/eugenio/git/AeroQuad/Libmaple/libmaple/wirish/io.h:113:6: error: initializing argument 2 of 'void pinMode(uint8, WiringPinMode)' [-fpermissive] build/mrbgems/mruby-arduino/src/mruby-arduino.cpp:73:7: warning: unused variable 'n' [-Wunused-variable] build/mrbgems/mruby-arduino/src/mruby-arduino.cpp: In function 'mrb_value mrb_arduino_digitalWrite(mrb_state_, mrb_value)': build/mrbgems/mruby-arduino/src/mruby-arduino.cpp:80:7: warning: unused variable 'n' [-Wunused-variable] build/mrbgems/mruby-arduino/src/mruby-arduino.cpp: In function 'mrb_value mrb_arduino_digitalRead(mrb_state_, mrb_value)': build/mrbgems/mruby-arduino/src/mruby-arduino.cpp:87:7: warning: unused variable 'n' [-Wunused-variable] build/mrbgems/mruby-arduino/src/mruby-arduino.cpp: In function 'mrb_value mrb_arduino_analogReference(mrb_state_, mrb_value)': build/mrbgems/mruby-arduino/src/mruby-arduino.cpp:99:20: error: 'eAnalogReference' was not declared in this scope build/mrbgems/mruby-arduino/src/mruby-arduino.cpp:99:41: error: 'analogReference' was not declared in this scope build/mrbgems/mruby-arduino/src/mruby-arduino.cpp:94:7: warning: unused variable 'n' [-Wunused-variable] build/mrbgems/mruby-arduino/src/mruby-arduino.cpp: In function 'mrb_value mrb_arduino_analogWrite(mrb_state_, mrb_value)': build/mrbgems/mruby-arduino/src/mruby-arduino.cpp:107:7: warning: unused variable 'n' [-Wunused-variable] build/mrbgems/mruby-arduino/src/mruby-arduino.cpp: In function 'mrb_value mrb_arduino_analogRead(mrb_state_, mrb_value)': build/mrbgems/mruby-arduino/src/mruby-arduino.cpp:114:7: warning: unused variable 'n' [-Wunused-variable] build/mrbgems/mruby-arduino/src/mruby-arduino.cpp: In function 'mrb_value mrb_arduino_shiftOut(mrb_state_, mrb_value)': build/mrbgems/mruby-arduino/src/mruby-arduino.cpp:142:7: warning: unused variable 'n' [-Wunused-variable] build/mrbgems/mruby-arduino/src/mruby-arduino.cpp: In function 'mrb_value mrb_arduino_shiftIn(mrb_state_, mrb_value)': build/mrbgems/mruby-arduino/src/mruby-arduino.cpp:155:62: error: 'shiftIn' was not declared in this scope build/mrbgems/mruby-arduino/src/mruby-arduino.cpp:154:7: warning: unused variable 'n' [-Wunused-variable] build/mrbgems/mruby-arduino/src/mruby-arduino.cpp: In function 'mrb_value mrb_arduino_pulseIn(mrb_state_, mrb_value)': build/mrbgems/mruby-arduino/src/mruby-arduino.cpp:164:29: error: 'pulseIn' was not declared in this scope build/mrbgems/mruby-arduino/src/mruby-arduino.cpp:166:38: error: 'pulseIn' was not declared in this scope build/mrbgems/mruby-arduino/src/mruby-arduino.cpp: In function 'mrb_value mrb_arduino_delay(mrb_state_, mrb_value)': build/mrbgems/mruby-arduino/src/mruby-arduino.cpp:182:7: warning: unused variable 'n' [-Wunused-variable] build/mrbgems/mruby-arduino/src/mruby-arduino.cpp: In function 'mrb_value mrb_arduino_delayMicroseconds(mrb_state_, mrb_value)': build/mrbgems/mruby-arduino/src/mruby-arduino.cpp:189:7: warning: unused variable 'n' [-Wunused-variable] build/mrbgems/mruby-arduino/src/mruby-arduino.cpp: In function 'mrb_value mrb_arduino_map(mrb_state_, mrb_value)': build/mrbgems/mruby-arduino/src/mruby-arduino.cpp:197:7: warning: unused variable 'n' [-Wunused-variable] build/mrbgems/mruby-arduino/src/mruby-arduino.cpp: In function 'mrb_value mrb_arduino_randomSeed(mrb_state_, mrb_value)': build/mrbgems/mruby-arduino/src/mruby-arduino.cpp:204:7: warning: unused variable 'n' [-Wunused-variable] build/mrbgems/mruby-arduino/src/mruby-arduino.cpp: In function 'void mrb_mruby_arduino_gem_init(mrb_state_)': build/mrbgems/mruby-arduino/src/mruby-arduino.cpp:277:68: error: 'DEFAULT' was not declared in this scope build/mrbgems/mruby-arduino/src/mruby-arduino.cpp:282:69: error: 'EXTERNAL' was not declared in this scope build/mrbgems/mruby-arduino/src/mruby-arduino.cpp: In function 'mrb_value mrb_arduino_shiftIn(mrb_state_, mrb_value)': build/mrbgems/mruby-arduino/src/mruby-arduino.cpp:156:1: warning: control reaches end of non-void function [-Wreturn-type] build/mrbgems/mruby-arduino/src/mruby-arduino.cpp: In function 'mrb_value mrb_serial_available(mrb_state*, mrb_value)': build/mrbgems/mruby-arduino/src/mruby-arduino.cpp:17:1: warning: control reaches end of non-void function [-Wreturn-type] rake aborted! Command failed with status (1): ["arm-none-eabi-gcc" -g -O3 -Wall -Werror-i...]
Tasks: TOP => all => /home/eugenio/git/mruby/bin/mirb-hostbased => /home/eugenio/git/mruby/build/host/bin/mirb-hostbased => /home/eugenio/git/mruby/build/host/lib/libmruby.a => /home/eugenio/git/mruby/build/host/mrbgems/mruby-arduino/src/mruby-arduino.o (See full trace by running task with --trace)
I refactored the build_config.rb trying to make it more readable and removed repeated sections.
MRuby::Build.new do |conf|
STM32_PROJ_PATH = '/home/eugenio/workspace/STM32F4_Sample'
STM32_LIB_PATH = "#{STM32_PROJ_PATH}/Libraries"
STM32_UTIL_PATH = "#{STM32_PROJ_PATH}/Utilities"
AEROQUAD_PATH = "/home/eugenio/git/AeroQuad"
@@crosscompilation_include_paths = [
"#{STM32_PROJ_PATH}/inc/",
"#{STM32_LIB_PATH}/CMSIS/Include",
"#{STM32_LIB_PATH}/STM32F4xx_StdPeriph_Driver/inc",
"#{STM32_LIB_PATH}/STM32_USB_Device_Library/Class/hid/inc",
"#{STM32_LIB_PATH}/STM32_USB_Device_Library/Core/inc",
"#{STM32_LIB_PATH}/STM32_USB_OTG_Driver/inc",
"#{STM32_UTIL_PATH}/STM32F4-Discovery",
"#{MRUBY_ROOT}/include",
"#{AEROQUAD_PATH}/Libmaple/libmaple/wirish",
"#{AEROQUAD_PATH}/Libmaple/libmaple/libmaple",
"#{AEROQUAD_PATH}/Libmaple/libmaple/libraries",
"#{AEROQUAD_PATH}/Libmaple/libmaple/wirish/boards",
"#{AEROQUAD_PATH}/Libmaple/libmaple/wirish/comm"]
@@compilation_include_paths = [
"/usr/include",
"#{STM32_PROJ_PATH}/inc/",
"#{STM32_LIB_PATH}/CMSIS/Include",
"#{STM32_LIB_PATH}/STM32F4xx_StdPeriph_Driver/inc",
"#{STM32_LIB_PATH}/STM32_USB_Device_Library/Class/hid/inc",
"#{STM32_LIB_PATH}/STM32_USB_Device_Library/Core/inc",
"#{STM32_LIB_PATH}/STM32_USB_OTG_Driver/inc",
"#{STM32_UTIL_PATH}/STM32F4-Discovery",
"#{MRUBY_ROOT}/include",
"#{AEROQUAD_PATH}/Libmaple/libmaple/wirish",
"#{AEROQUAD_PATH}/Libmaple/libmaple/libmaple",
"#{AEROQUAD_PATH}/Libmaple/libmaple/libraries",
"#{AEROQUAD_PATH}/Libmaple/libmaple/wirish/boards",
"#{AEROQUAD_PATH}/Libmaple/libmaple/wirish/comm"]
CFLAGS = "-v -std=gnu99 -mthumb -mcpu=cortex-m4 -mfloat-abi=hard -mfpu=fpv4-sp-d16 -D__FPU_USED=1 -DMCU_STM32F406VG -DBOARD_discovery_f4 -DSTM32_HIGH_DENSITY -g -Os -gdwarf-2 -fverbose-asm -ffunction-sections -fdata-sections -DRUN_FROM_FLASH=1"
CROSSCOMPILATION_CXXFLAGS = "-v -std=gnu99 -mthumb -mcpu=cortex-m4 -mfloat-abi=hard -mfpu=fpv4-sp-d16 -D__FPU_USED=1 -DBOARD_discovery_f4 -DMCU_STM32F406VG -DSTM32_HIGH_DENSITY -g -Os -gdwarf-2 -fverbose-asm -ffunction-sections -fdata-sections -DRUN_FROM_FLASH=1"
# load specific toolchain settings
conf.gem :git => 'kyab/mruby-bin-mirb-hostbased', :branch => 'master',:options => '-v -iquote -I%s' do |g|
g.cxx.include_paths = @@compilation_include_paths
end
conf.gem :git => "https://github.com/kyab/mruby-arduino.git", :branch => "master" ,:options => '-v -iquote -I%s' do |g|
g.cxx.command = 'arm-none-eabi-gcc'
g.cxx.include_paths = @@crosscompilation_include_paths
g.cxx.flags << "#{CROSSCOMPILATION_CXXFLAGS}"
end
# load specific toolchain settings
toolchain :gcc
## Use mrbgems
# conf.gem 'examples/mrbgems/ruby_extension_example'
# conf.gem 'examples/mrbgems/c_extension_example' do |g|
# g.cc.flags << '-g' # append cflags in this gem
# end
# conf.gem 'examples/mrbgems/c_and_ruby_extension_example'
# conf.gem :github => 'masuidrive/mrbgems-example', :branch => 'master'
# conf.gem :git => '[email protected]:masuidrive/mrbgems-example.git', :branch => 'master', :options => '-v'
# include the default GEMs
conf.gembox 'default'
# C compiler settings
conf.cc do |cc|
cc.command = ENV['CC'] || 'gcc'
cc.flags = [ENV['CFLAGS'] || %w(-std=gnu99 )]
cc.include_paths = @@compilation_include_paths
cc.defines = %w(ENABLE_GEMS)
cc.option_include_path = '-I%s '
cc.option_define = '-D%s'
cc.compile_options = "%{flags} -MMD -o %{outfile} -c %{infile}"
end
# mrbc settings
# conf.mrbc do |mrbc|
# mrbc.compile_options = "-g -B%{funcname} -o-" # The -g option is required for line numbers
# end
# Linker settings
# conf.linker do |linker|
# linker.command = ENV['LD'] || 'gcc'
# linker.flags = [ENV['LDFLAGS'] || ["-lreadline"]]
# linker.flags_before_libraries = []
# linker.libraries = %w()
# linker.flags_after_libraries = []
# linker.library_paths = ["/usr/include"]
# linker.option_library = '-l%s'
# linker.option_library_path = '-L%s'
# linker.link_options = "%{flags} -o %{outfile} %{objs} %{libs}"
# end
# Archiver settings
# conf.archiver do |archiver|
# archiver.command = ENV['AR'] || 'ar'
# archiver.archive_options = 'rs %{outfile} %{objs}'
# end
# Parser generator settings
# conf.yacc do |yacc|
# yacc.command = ENV['YACC'] || 'bison'
# yacc.compile_options = '-o %{outfile} %{infile}'
# end
# gperf settings
# conf.gperf do |gperf|
# gperf.command = 'gperf'
# gperf.compile_options = '-L ANSI-C -C -p -j1 -i 1 -g -o -t -N mrb_reserved_word -k"1,3,$" %{infile} > %{outfile}'
# end
# file extensions
# conf.exts do |exts|
# exts.object = '.o'
# exts.executable = '' # '.exe' if Windows
# exts.library = '.a'
# end
# file separetor
# conf.file_separator = '/'
end
# Define cross build settings
MRuby::CrossBuild.new('STM32F4') do |conf|
# Use led class 他のページで説明しているLEDのクラスを使用する場合はコメントを外してください
# conf.gem 'mrbgems/mruby-led'
conf.gem :git => "https://github.com/kyab/mruby-arduino.git", :branch => "master", :options => '-v -iquote -I%s' do |g|
g.cxx.command= ENV['CC'] ||'arm-none-eabi-gcc'
g.cxx.include_paths = @@crosscompilation_include_paths
g.cxx.flags << "#{CROSSCOMPILATION_CXXFLAGS}"
end
conf.cc do |cc|
cc.command= ENV['CC'] ||'arm-none-eabi-gcc'
cc.include_paths = @@crosscompilation_include_paths
cc.option_include_path = '-I%s '
cc.flags << "#{CFLAGS}"
cc.flags << "#{CROSSCOMPILATION_CXXFLAGS}"
cc.compile_options = '%{flags} -MMD -o %{outfile} -c %{infile}'
end
LDSCRIPT = '/home/eugenio/workspace/STM32F4_Sample/stm32_flash.ld'
conf.linker do |linker|
linker.command ='arm-none-eabi-gcc'
linker.link_options = '-std=gnu99 -mthumb -mcpu=cortex-m4 -mfloat-abi=hard -mfpu=fpv4-sp-d16 -std=c99 -D__FPU_USED=1 -DMCU_STM32F407VG -DSTM32_HIGH_DENSITY -g -Os -gdwarf-2 -fverbose-asm -ffunction-sections -fdata-sections -DRUN_FROM_FLASH=1 ,--script=#{LDSCRIPT}'
end
# # file extensions
# conf.exts do |exts|
# exts.object = '.o'
# exts.executable = '' # '.exe' if Windows
# exts.library = '.a'
# end
end
It says Serial class is not found, Do you have Serial class available in your environment? If not, remove all related function or use #ifdef in mruby-arduino.cpp.
I don't have it available directly. I couldn't find the Serial.h or serial.h file anywhere in my home directory nor in other places. I do have though a HardwareSerial.h file in libmaples directory /Libmaple/libraries/wirish/comm but wasn't able to correctly modify mruby-arduino.cpp to make it work. Anyway even if i comment out all the part regarding serial, it still doesn't compile throwing some of the errors as before.
OK, replace mruby-arduino.cpp with below, disable -Wunused-variable
temporaly, and try again.
Then show me all compile error and build_config.rb(if changed).
#include <new>
#include "mruby.h"
#include "mruby/class.h"
#include "mruby/string.h"
#include "mruby/data.h"
#if (ARDUINO >= 152)
#include <Arduino.h>
#else
#include <WProgram.h>
#endif
#include <Servo/Servo.h>
void mrb_servo_free(mrb_state *mrb, void *ptr){
Servo *servo = (Servo *)ptr;
servo->~Servo();
mrb_free(mrb, servo);
}
struct mrb_data_type mrb_servo_type = {"Servo", mrb_servo_free};
mrb_value mrb_servo_initialize(mrb_state *mrb, mrb_value self){
void *p = mrb_malloc(mrb, sizeof(Servo));
Servo *newServo = new(p) Servo();
DATA_PTR(self) = newServo;
DATA_TYPE(self) = &mrb_servo_type;
return self;
}
mrb_value mrb_servo_attach(mrb_state *mrb, mrb_value self){
Servo *servo = (Servo *)mrb_get_datatype(mrb, self, &mrb_servo_type);
mrb_int pin = 0;
int n = mrb_get_args(mrb, "i", &pin);
servo->attach(pin);
return mrb_nil_value();
}
mrb_value mrb_servo_write(mrb_state *mrb, mrb_value self){
Servo *servo = (Servo *)mrb_get_datatype(mrb, self, &mrb_servo_type);
mrb_int angle = 0;
int n = mrb_get_args(mrb, "i", &angle);
servo->write(angle);
return mrb_nil_value();
}
mrb_value mrb_servo_detach(mrb_state *mrb, mrb_value self){
Servo *servo = (Servo *)mrb_get_datatype(mrb, self, &mrb_servo_type);
servo->detach();
return mrb_nil_value();
}
mrb_value mrb_arduino_pinMode(mrb_state *mrb, mrb_value self){
mrb_int pin, mode;
int n = mrb_get_args(mrb, "ii", &pin, &mode);
pinMode(pin, mode);
return mrb_nil_value();
}
mrb_value mrb_arduino_digitalWrite(mrb_state *mrb, mrb_value self){
mrb_int pin, value;
int n = mrb_get_args(mrb, "ii", &pin, &value);
digitalWrite(pin, value);
return mrb_nil_value();
}
mrb_value mrb_arduino_digitalRead(mrb_state *mrb, mrb_value self){
mrb_int pin;
int n = mrb_get_args(mrb, "i", &pin);
int val = digitalRead(pin);
return mrb_fixnum_value(val);
}
mrb_value mrb_arduino_analogReference(mrb_state *mrb, mrb_value self){
mrb_int type;
int n = mrb_get_args(mrb, "i", &type);
#if defined(ARDUINO)
#if ARDUINO>=152
analogReference((eAnalogReference)type);
#endif
#else
analogReference(type);
#endif
return mrb_nil_value();
}
mrb_value mrb_arduino_analogWrite(mrb_state *mrb, mrb_value self){
mrb_int pin, value;
int n = mrb_get_args(mrb, "ii", &pin, &value);
analogWrite(pin, value);
return mrb_nil_value();
}
mrb_value mrb_arduino_analogRead(mrb_state *mrb, mrb_value self){
mrb_int pin;
int n = mrb_get_args(mrb, "i", &pin);
int val = analogRead(pin);
return mrb_fixnum_value(val);
}
#if defined(MPIDE)
mrb_value mrb_arduino_tone(mrb_state *mrb, mrb_value self){
mrb_int pin, frequency, duration;
int n = mrb_get_args(mrb, "ii|i", &pin, &frequency, &duration);
if (n == 2){
tone(pin, frequency);
}else if(n == 3){
tone(pin, frequency, duration);
}
return mrb_nil_value();
}
mrb_value mrb_arduino_noTone(mrb_state *mrb, mrb_value self){
mrb_int pin;
int n = mrb_get_args(mrb, "i", &pin);
noTone(pin);
return mrb_nil_value();
}
#endif
mrb_value mrb_arduino_shiftOut(mrb_state *mrb, mrb_value self){
mrb_int dataPin, clockPin, bitOrder, value;
int n = mrb_get_args(mrb, "iiii", &dataPin, &clockPin, &bitOrder, &value);
shiftOut(dataPin, clockPin, bitOrder, (byte)value);
return mrb_nil_value();
}
#if defined(MPIDE) && MPIDE <= 23
//seems like MPIDE does not define shiftIn.
extern uint8_t shiftIn(uint8_t dataPin, uint8_t clockPin, uint8_t bitOrder);
#endif
mrb_value mrb_arduino_shiftIn(mrb_state *mrb, mrb_value self){
mrb_int dataPin, clockPin, bitOrder;
int n = mrb_get_args(mrb, "iii", &dataPin, &clockPin, &bitOrder);
return mrb_fixnum_value(shiftIn(dataPin, clockPin, bitOrder));
}
mrb_value mrb_arduino_millis(mrb_state *mrb, mrb_value self){
return mrb_fixnum_value(millis());
}
mrb_value mrb_arduino_micros(mrb_state *mrb, mrb_value self){
return mrb_fixnum_value(micros());
}
mrb_value mrb_arduino_delay(mrb_state *mrb, mrb_value self){
mrb_int ms;
int n = mrb_get_args(mrb, "i", &ms);
delay(ms);
return mrb_nil_value();
}
mrb_value mrb_arduino_delayMicroseconds(mrb_state *mrb, mrb_value self){
mrb_int us;
int n = mrb_get_args(mrb, "i", &us);
delayMicroseconds(us);
return mrb_nil_value();
}
mrb_value mrb_arduino_map(mrb_state *mrb, mrb_value self){
mrb_int value, fromLow, fromHigh, toLow, toHigh;
int n = mrb_get_args(mrb, "iiiii", &value, &fromLow, &fromHigh, &toLow, &toHigh);
mrb_int ret = map(value, fromLow, fromHigh, toLow, toHigh);
return mrb_fixnum_value(ret);
}
mrb_value mrb_arduino_randomSeed(mrb_state *mrb, mrb_value self){
mrb_int seed;
int n = mrb_get_args(mrb, "i", &seed);
randomSeed(seed);
return mrb_nil_value();
}
mrb_value mrb_arduino_random(mrb_state *mrb, mrb_value self){
mrb_int arg1, arg2;
int n = mrb_get_args(mrb, "i|i", &arg1, &arg2 );
if (n == 1){
return mrb_fixnum_value(random(arg1));
}else{
return mrb_fixnum_value(random(arg1, arg2));
}
}
mrb_value mrb_arduino_interrupts(mrb_state *mrb, mrb_value self){
interrupts();
return mrb_nil_value();
}
mrb_value mrb_arduino_noInterrupts(mrb_state *mrb, mrb_value self){
noInterrupts();
return mrb_nil_value();
}
extern "C"
void
mrb_mruby_arduino_gem_init(mrb_state* mrb) {
RClass *servoClass = mrb_define_class(mrb, "Servo", mrb->object_class);
MRB_SET_INSTANCE_TT(servoClass, MRB_TT_DATA);
mrb_define_method(mrb, servoClass, "initialize", mrb_servo_initialize, ARGS_NONE());
mrb_define_method(mrb, servoClass, "attach", mrb_servo_attach, ARGS_REQ(1));
mrb_define_method(mrb, servoClass, "write", mrb_servo_write, ARGS_REQ(1));
mrb_define_method(mrb, servoClass, "detach", mrb_servo_detach, ARGS_NONE());
RClass *arduinoModule = mrb_define_module(mrb, "Arduino");
mrb_define_module_function(mrb, arduinoModule, "pinMode", mrb_arduino_pinMode, ARGS_REQ(2));
mrb_define_module_function(mrb, arduinoModule, "digitalWrite", mrb_arduino_digitalWrite, ARGS_REQ(2));
mrb_define_module_function(mrb, arduinoModule, "digitalRead", mrb_arduino_digitalRead, ARGS_REQ(1));
mrb_define_module_function(mrb, arduinoModule, "analogReference", mrb_arduino_analogReference, ARGS_REQ(1));
mrb_define_module_function(mrb, arduinoModule, "analogWrite", mrb_arduino_analogWrite, ARGS_REQ(2));
mrb_define_module_function(mrb, arduinoModule, "analogRead", mrb_arduino_analogRead, ARGS_REQ(1));
#if defined(MPIDE)
mrb_define_module_function(mrb, arduinoModule, "tone", mrb_arduino_tone, ARGS_REQ(2) | ARGS_OPT(1));
mrb_define_module_function(mrb, arduinoModule, "noTone", mrb_arduino_noTone, ARGS_REQ(1));
#endif
mrb_define_module_function(mrb, arduinoModule, "shiftOut", mrb_arduino_shiftOut, ARGS_REQ(4));
mrb_define_module_function(mrb, arduinoModule, "shiftIn", mrb_arduino_shiftOut, ARGS_REQ(3));
mrb_define_module_function(mrb, arduinoModule, "millis", mrb_arduino_millis, ARGS_NONE());
mrb_define_module_function(mrb, arduinoModule, "micros", mrb_arduino_micros, ARGS_NONE());
mrb_define_module_function(mrb, arduinoModule, "delay", mrb_arduino_delay, ARGS_REQ(1));
mrb_define_module_function(mrb, arduinoModule, "delayMicroseconds", mrb_arduino_delayMicroseconds, ARGS_REQ(1));
mrb_define_module_function(mrb, arduinoModule, "map", mrb_arduino_map, ARGS_REQ(5));
mrb_define_module_function(mrb, arduinoModule, "randomSeed", mrb_arduino_randomSeed, ARGS_REQ(1));
mrb_define_module_function(mrb, arduinoModule, "random", mrb_arduino_random, ARGS_REQ(1) | ARGS_OPT(1));
mrb_define_module_function(mrb, arduinoModule, "interrupts", mrb_arduino_interrupts, ARGS_NONE());
mrb_define_module_function(mrb, arduinoModule, "noInterrupts", mrb_arduino_noInterrupts, ARGS_NONE());
mrb_define_const(mrb, arduinoModule, "HIGH", mrb_fixnum_value(HIGH));
mrb_define_const(mrb, arduinoModule, "LOW", mrb_fixnum_value(LOW));
mrb_define_const(mrb, arduinoModule, "INPUT", mrb_fixnum_value(INPUT));
mrb_define_const(mrb, arduinoModule, "OUTPUT", mrb_fixnum_value(OUTPUT));
#ifdef INPUT_PULLUP
mrb_define_const(mrb, arduinoModule, "INPUT_PULLUP", mrb_fixnum_value(INPUT_PULLUP));
#endif
#ifdef DEFAULT
mrb_define_const(mrb, arduinoModule, "DEFAULT", mrb_fixnum_value(DEFAULT));
#endif
#ifdef INTERNAL
mrb_define_const(mrb, arduinoModule, "INTERNAL", mrb_fixnum_value(INTERNAL));
#endif
#ifdef EXTERNAL
mrb_define_const(mrb, arduinoModule, "EXTERNAL", mrb_fixnum_value(EXTERNAL));
#endif
//for chipKit, below are not defined.
#ifdef INTERNAL1V1
mrb_define_const(mrb, arduinoModule, "INTERNAL1V1", mrb_fixnum_value(INTERNAL1V1));
#endif
#ifdef INTERNAL2V56
mrb_define_const(mrb, arduinoModule, "INTERNAL2V56", mrb_fixnum_value(INTERNAL2V56));
#endif
#ifdef MSBFIRST
mrb_define_const(mrb, arduinoModule, "MSBFIRST", mrb_fixnum_value(MSBFIRST));
#endif
#ifdef LSBFIRST
mrb_define_const(mrb, arduinoModule, "LSBFIRST", mrb_fixnum_value(LSBFIRST));
#endif
}
extern "C"
void
mrb_mruby_arduino_gem_final(mrb_state* mrb) {
}
I'm stranded here right now. Perhaps I went back :( . I did swap mruby_arduino.cpp content with the one above but with no luck :/
AR build/host/lib/libmruby_core.a ar: creazione di /home/eugenio/git/mruby/build/host/lib/libmruby_core.a LD build/host/bin/mrbc /home/eugenio/git/mruby/build/host/lib/libmruby_core.a(numeric.o): nella funzione "flo_floor": numeric.c:(.text+0x170): riferimento non definito a "floor" /home/eugenio/git/mruby/build/host/lib/libmruby_core.a(numeric.o): nella funzione "flo_truncate": numeric.c:(.text+0x1da): riferimento non definito a "floor" numeric.c:(.text+0x239): riferimento non definito a "ceil" /home/eugenio/git/mruby/build/host/lib/libmruby_core.a(numeric.o): nella funzione "flo_ceil": numeric.c:(.text+0x250): riferimento non definito a "ceil" /home/eugenio/git/mruby/build/host/lib/libmruby_core.a(numeric.o): nella funzione "flo_round": numeric.c:(.text+0x3d6): riferimento non definito a "floor" numeric.c:(.text+0x468): riferimento non definito a "ceil" /home/eugenio/git/mruby/build/host/lib/libmruby_core.a(numeric.o): nella funzione "num_pow": numeric.c:(.text+0xca4): riferimento non definito a "pow" /home/eugenio/git/mruby/build/host/lib/libmruby_core.a(numeric.o): nella funzione "flo_mod": numeric.c:(.text+0x150b): riferimento non definito a "fmod" /home/eugenio/git/mruby/build/host/lib/libmruby_core.a(numeric.o): nella funzione "fix_mod": numeric.c:(.text+0x16b4): riferimento non definito a "fmod" /home/eugenio/git/mruby/build/host/lib/libmruby_core.a(numeric.o): nella funzione "fix_divmod": numeric.c:(.text+0x1f0b): riferimento non definito a "fmod" /home/eugenio/git/mruby/build/host/lib/libmruby_core.a(numeric.o): nella funzione "mrb_flo_to_str": numeric.c:(.text+0x20b1): riferimento non definito a "log10" numeric.c:(.text+0x211b): riferimento non definito a "pow" numeric.c:(.text+0x213b): riferimento non definito a "floor" numeric.c:(.text+0x22b2): riferimento non definito a "pow" collect2: error: ld returned 1 exit status rake aborted! Command Failed: ["gcc" -o "/home/eugenio/git/mruby/build/host/bin/mrbc" "/home/eugenio/git/mruby/build/host/tools/mrbc/mrbc.o" "/home/eugeni o/git/mruby/build/host/lib/libmruby_core.a" ]
My current build_config is this:
MRuby::Build.new do |conf| STM32_PROJ_PATH = '/home/eugenio/workspace/STM32F4_Sample' STM32_LIB_PATH = "#{STM32_PROJ_PATH}/Libraries" STM32_UTIL_PATH = "#{STM32_PROJ_PATH}/Utilities" AEROQUAD_PATH = "/home/eugenio/git/AeroQuad"
@@crosscompilation_include_paths = [
"/usr/include",
"#{STM32_PROJ_PATH}/inc/",
"#{STM32_LIB_PATH}/CMSIS/Include",
"#{STM32_LIB_PATH}/STM32F4xx_StdPeriph_Driver/inc",
"#{STM32_LIB_PATH}/STM32_USB_Device_Library/Class/hid/inc",
"#{STM32_LIB_PATH}/STM32_USB_Device_Library/Core/inc",
"#{STM32_LIB_PATH}/STM32_USB_OTG_Driver/inc",
"#{STM32_UTIL_PATH}/STM32F4-Discovery",
"#{MRUBY_ROOT}/include",
"#{AEROQUAD_PATH}/Libmaple/libmaple/wirish",
"#{AEROQUAD_PATH}/Libmaple/libmaple/libmaple",
"#{AEROQUAD_PATH}/Libmaple/libmaple/libraries",
"#{AEROQUAD_PATH}/Libmaple/libmaple/wirish/boards",
"#{AEROQUAD_PATH}/Libmaple/libmaple/wirish/comm"]
@@compilation_include_paths = [
"/usr/include",
"#{STM32_PROJ_PATH}/inc/",
"#{STM32_LIB_PATH}/CMSIS/Include",
"#{STM32_LIB_PATH}/STM32F4xx_StdPeriph_Driver/inc",
"#{STM32_LIB_PATH}/STM32_USB_Device_Library/Class/hid/inc",
"#{STM32_LIB_PATH}/STM32_USB_Device_Library/Core/inc",
"#{STM32_LIB_PATH}/STM32_USB_OTG_Driver/inc",
"#{STM32_UTIL_PATH}/STM32F4-Discovery",
"#{MRUBY_ROOT}/include",
"#{AEROQUAD_PATH}/Libmaple/libmaple/wirish",
"#{AEROQUAD_PATH}/Libmaple/libmaple/libmaple",
"#{AEROQUAD_PATH}/Libmaple/libmaple/libraries",
"#{AEROQUAD_PATH}/Libmaple/libmaple/wirish/boards",
"#{AEROQUAD_PATH}/Libmaple/libmaple/wirish/comm"]
CFLAGS_CROSSCOMPILE = "-v -iquote -fpermissive -std=gnu99 -mthumb -mcpu=cortex-m4 -mfloat-abi=hard -mfpu=fpv4-sp-d16 -D__FPU_USED=1 -DMCU_STM32F406VG -DBOARD_discovery_f4 -DSTM32_HIGH_DENSITY -g -Os -gdwarf-2 -DRUN_FROM_FLASH=1"
CROSSCOMPILATION_CXXFLAGS = "-v -iquote -fpermissive -mthumb -mcpu=cortex-m4 -mfloat-abi=hard -mfpu=fpv4-sp-d16 -D__FPU_USED=1 -DBOARD_discovery_f4 -DMCU_STM32F406VG -DSTM32_HIGH_DENSITY -g -Os -gdwarf-2 -DRUN_FROM_FLASH=1"
CFLAGS = " -O3 -iquote -fpermissive -std=gnu99"
LINKFLAGS = "-lc -lm"
conf.gem :git => 'https://github.com/kyab/mruby-bin-mirb-hostbased', :branch => 'master' do |g|
g.cc.include_paths = @@compilation_include_paths
g.cc.flags << "#{CFLAGS}"
g.cc.option_include_path = '-I%s '
end
conf.gem :git => "https://github.com/kyab/mruby-arduino.git", :branch => "master" do |g|
g.cc.command = 'arm-none-eabi-gcc'
g.cc.include_paths = @@crosscompilation_include_paths
g.cc.flags << "#{CROSSCOMPILATION_CXXFLAGS}"
g.cc.option_include_path = '-I%s '
end
# load specific toolchain settings
#toolchain :gcc
## Use mrbgems
# conf.gem 'examples/mrbgems/ruby_extension_example'
# conf.gem 'examples/mrbgems/c_extension_example' do |g|
# g.cc.flags << '-g' # append cflags in this gem
# end
# conf.gem 'examples/mrbgems/c_and_ruby_extension_example'
# conf.gem :github => 'masuidrive/mrbgems-example', :branch => 'master'
# conf.gem :git => '[email protected]:masuidrive/mrbgems-example.git', :branch => 'master', :options => '-v'
# include the default GEMs
conf.gembox 'default'
# C compiler settings
conf.cc do |cc|
cc.command = ENV['CC'] || 'gcc'
cc.flags << "#{CFLAGS}"
cc.include_paths = @@compilation_include_paths
cc.defines = %w(ENABLE_GEMS)
cc.option_include_path = '-I%s '
cc.option_define = '-D%s'
cc.compile_options = "%{flags} -MMD -o %{outfile} -c %{infile}"
end
# mrbc settings
# conf.mrbc do |mrbc|
# mrbc.compile_options = "-g -B%{funcname} -o-" # The -g option is required for line numbers
# end
conf.linker do |linker|
linker.command = ENV['LD'] || 'gcc'
linker.flags << "#{LINKFLAGS}"
linker.flags_before_libraries << "#{LINKFLAGS}"
linker.libraries = %w()
linker.flags_after_libraries << "#{LINKFLAGS}"
linker.library_paths = @@compilation_include_paths
linker.option_library = '-l%s'
linker.option_library_path = '-L%s'
linker.link_options = "-o %{outfile} %{objs} %{libs} "
end
# Archiver settings
# conf.archiver do |archiver|
# archiver.command = ENV['AR'] || 'ar'
# archiver.archive_options = 'rs %{outfile} %{objs}'
# end
# Parser generator settings
# conf.yacc do |yacc|
# yacc.command = ENV['YACC'] || 'bison'
# yacc.compile_options = '-o %{outfile} %{infile}'
# end
# gperf settings
# conf.gperf do |gperf|
# gperf.command = 'gperf'
# gperf.compile_options = '-L ANSI-C -C -p -j1 -i 1 -g -o -t -N mrb_reserved_word -k"1,3,$" %{infile} > %{outfile}'
# end
# file extensions
# conf.exts do |exts|
# exts.object = '.o'
# exts.executable = '' # '.exe' if Windows
# exts.library = '.a'
# end
# file separetor
# conf.file_separator = '/'
end
# Define cross build settings
MRuby::CrossBuild.new('STM32F4') do |conf|
# Use led class 他のページで説明しているLEDのクラスを使用する場合はコメントを外してください
# conf.gem 'mrbgems/mruby-led'
conf.gem :git => "https://github.com/kyab/mruby-arduino.git", :branch => "master" do |g|
g.cc.command = 'arm-none-eabi-gcc'
g.cc.include_paths = @@crosscompilation_include_paths
g.cc.flags << "#{CROSSCOMPILATION_CXXFLAGS}"
end
conf.cc do |cc|
cc.command = ENV['CC'] ||'arm-none-eabi-gcc'
cc.include_paths = @@crosscompilation_include_paths
cc.option_include_path = '-I%s '
cc.flags << "#{CFLAGS_CROSSCOMPILE}"
cc.compile_options = '%{flags} -MMD -o %{outfile} -c %{infile}'
end
conf.cxx do |cc|
cc.command = 'arm-none-eabi-gcc'
cc.flags << "#{CROSSCOMPILATION_CXXFLAGS}"
end
# Linker settings
conf.linker do |linker|
linker.command = 'arm-none-eabi-gcc'
linker.flags = ["-T/home/eugenio/workspace/STM32F4_Sample/stm32_flash.ld"]
linker.flags_before_libraries = []
linker.libraries = %w()
linker.flags_after_libraries = []
linker.library_paths = @@compilation_include_paths
linker.option_library = '-l%s'
linker.option_library_path = '-L%s'
linker.link_options = "-o %{outfile} %{objs} %{libs} "
end
# file extensions
# conf.exts do |exts|
# exts.object = '.o'
# exts.executable = '' # '.exe' if Windows
# exts.library = '.a'
# end
end
Compilation look like fine so we are proceeding :-). Next is linking.
Some math functions are cause of errors. You don't specify libm for linker,
so set linker.libraries = %w(m)
in build config and try.
BTW, Your error messages seems like Italy,LC_MESSAGES=C make
will produce in english and help me.
I'm really sorry, I didn't know how to put the message in English. Now I do. This is as far as I get with the compiling process. I hope it helps.
** Execute /home/eugenio/git/mruby/build/host/mrblib/mrblib.o "gcc" -O3 -iquote -fpermissive -std=gnu99 -DENABLE_GEMS -I"/usr/include" -I"/home/eugenio/workspace/STM32F4_Sample/inc/" -I"/home/eugenio/workspace/STM32F4_Sample/Libraries/CMSIS/Include" -I"/home/eugenio/workspace/STM32F4_Sample/Libraries/ST M32F4xx_StdPeriph_Driver/inc" -I"/home/eugenio/workspace/STM32F4_Sample/Libraries/STM32_USB_Device_Library/Class/hid/inc" -I"/home/eugenio/workspace/STM32F4_Sample/Libraries/STM32_USB_Device_Library/Core/inc" -I"/home/eugenio/workspace/STM32F4 _Sample/Libraries/STM32_USB_OTG_Driver/inc" -I"/home/eugenio/workspace/STM32F4_Sample/Utilities/STM32F4-Discovery" -I"/ho me/eugenio/git/mruby/include" -I"/home/eugenio/git/AeroQuad/Libmaple/libmaple/wirish" -I"/home/eugenio/git/AeroQuad/Libma ple/libmaple/libmaple" -I"/home/eugenio/git/AeroQuad/Libmaple/libmaple/libraries" -I"/home/eugenio/git/AeroQuad/Libmaple/ libmaple/wirish/boards" -I"/home/eugenio/git/AeroQuad/Libmaple/libmaple/wirish/comm" -I"build/mrbgems/mruby-bin-mirb-host based/include" -I"build/mrbgems/mruby-arduino/include" -I"/home/eugenio/git/mruby/mrbgems/mruby-sprintf/include" -I"/hom e/eugenio/git/mruby/mrbgems/mruby-print/include" -I"/home/eugenio/git/mruby/mrbgems/mruby-math/include" -I"/home/eugenio/ git/mruby/mrbgems/mruby-time/include" -I"/home/eugenio/git/mruby/mrbgems/mruby-struct/include" -I"/home/eugenio/git/mruby /mrbgems/mruby-enum-ext/include" -I"/home/eugenio/git/mruby/mrbgems/mruby-string-ext/include" -I"/home/eugenio/git/mruby/ mrbgems/mruby-numeric-ext/include" -I"/home/eugenio/git/mruby/mrbgems/mruby-array-ext/include" -I"/home/eugenio/git/mruby /mrbgems/mruby-hash-ext/include" -I"/home/eugenio/git/mruby/mrbgems/mruby-range-ext/include" -I"/home/eugenio/git/mruby/m rbgems/mruby-proc-ext/include" -I"/home/eugenio/git/mruby/mrbgems/mruby-symbol-ext/include" -I"/home/eugenio/git/mruby/mr bgems/mruby-random/include" -I"/home/eugenio/git/mruby/mrbgems/mruby-object-ext/include" -I"/home/eugenio/git/mruby/mrbge ms/mruby-objectspace/include" -I"/home/eugenio/git/mruby/mrbgems/mruby-fiber/include" -I"/home/eugenio/git/mruby/mrbgems/ mruby-bin-mirb/include" -I"/home/eugenio/git/mruby/mrbgems/mruby-bin-mruby/include" -MMD -o "/home/eugenio/git/mruby/buil d/host/mrblib/mrblib.o" -c "/home/eugenio/git/mruby/build/host/mrblib/mrblib.c" ** Invoke /home/eugenio/git/mruby/build/host/mrbgems/mruby-bin-mirb-hostbased/gem_init.o (first_time) ** Invoke /home/eugenio/git/mruby/build/host/mrbgems/mruby-bin-mirb-hostbased/gem_init.c (first_time) ** Invoke /home/eugenio/git/mruby/build/host/bin/mrbc (not_needed) ** Execute /home/eugenio/git/mruby/build/host/mrbgems/mruby-bin-mirb-hostbased/gem_init.c ** Execute /home/eugenio/git/mruby/build/host/mrbgems/mruby-bin-mirb-hostbased/gem_init.o "gcc" -O3 -iquote -fpermissive -std=gnu99 -O3 -iquote -fpermissive -std=gnu99 -DENABLE_GEMS -I"/usr/include" -I"/home/eu genio/workspace/STM32F4_Sample/inc/" -I"/home/eugenio/workspace/STM32F4_Sample/Libraries/CMSIS/Include" -I"/home/eugenio/ workspace/STM32F4_Sample/Libraries/STM32F4xx_StdPeriph_Driver/inc" -I"/home/eugenio/workspace/STM32F4_Sample/Libraries/STM 32_USB_Device_Library/Class/hid/inc" -I"/home/eugenio/workspace/STM32F4_Sample/Libraries/STM32_USB_Device_Library/Core/inc " -I"/home/eugenio/workspace/STM32F4_Sample/Libraries/STM32_USB_OTG_Driver/inc" -I"/home/eugenio/workspace/STM32F4_Sample /Utilities/STM32F4-Discovery" -I"/home/eugenio/git/mruby/include" -I"/home/eugenio/git/AeroQuad/Libmaple/libmaple/wirish" -I"/home/eugenio/git/AeroQuad/Libmaple/libmaple/libmaple" -I"/home/eugenio/git/AeroQuad/Libmaple/libmaple/libraries" -I "/home/eugenio/git/AeroQuad/Libmaple/libmaple/wirish/boards" -I"/home/eugenio/git/AeroQuad/Libmaple/libmaple/wirish/comm" -I"build/mrbgems/mruby-bin-mirb-hostbased/include" -I"build/mrbgems/mruby-arduino/include" -I"/home/eugenio/git/mruby/mr bgems/mruby-sprintf/include" -I"/home/eugenio/git/mruby/mrbgems/mruby-print/include" -I"/home/eugenio/git/mruby/mrbgems/m ruby-math/include" -I"/home/eugenio/git/mruby/mrbgems/mruby-time/include" -I"/home/eugenio/git/mruby/mrbgems/mruby-struct /include" -I"/home/eugenio/git/mruby/mrbgems/mruby-enum-ext/include" -I"/home/eugenio/git/mruby/mrbgems/mruby-string-ext/ include" -I"/home/eugenio/git/mruby/mrbgems/mruby-numeric-ext/include" -I"/home/eugenio/git/mruby/mrbgems/mruby-array-ext /include" -I"/home/eugenio/git/mruby/mrbgems/mruby-hash-ext/include" -I"/home/eugenio/git/mruby/mrbgems/mruby-range-ext/i nclude" -I"/home/eugenio/git/mruby/mrbgems/mruby-proc-ext/include" -I"/home/eugenio/git/mruby/mrbgems/mruby-symbol-ext/in clude" -I"/home/eugenio/git/mruby/mrbgems/mruby-random/include" -I"/home/eugenio/git/mruby/mrbgems/mruby-object-ext/inclu de" -I"/home/eugenio/git/mruby/mrbgems/mruby-objectspace/include" -I"/home/eugenio/git/mruby/mrbgems/mruby-fiber/include" -I"/home/eugenio/git/mruby/mrbgems/mruby-bin-mirb/include" -I"/home/eugenio/git/mruby/mrbgems/mruby-bin-mruby/include"
-MMD -o "/home/eugenio/git/mruby/build/host/mrbgems/mruby-bin-mirb-hostbased/gem_init.o" -c "/home/eugenio/git/mruby/build/ host/mrbgems/mruby-bin-mirb-hostbased/gem_init.c" ** Invoke /home/eugenio/git/mruby/build/host/mrbgems/mruby-arduino/src/mruby-arduino.o (first_time) ** Invoke build/mrbgems/mruby-arduino/src/mruby-arduino.cpp (first_time, not_needed) ** Execute /home/eugenio/git/mruby/build/host/mrbgems/mruby-arduino/src/mruby-arduino.o "cc" -I"/home/eugenio/git/mruby/include" -I"build/mrbgems/mruby-bin-mirb-hostbased/include" -I"build/mrbgems/mruby-arduino/ include" -o "/home/eugenio/git/mruby/build/host/mrbgems/mruby-arduino/src/mruby-arduino.o" -c "build/mrbgems/mruby-arduino/ src/mruby-arduino.cpp" build/mrbgems/mruby-arduino/src/mruby-arduino.cpp:11:26: fatal error: WProgram.h: No such file or directory compilation terminated. rake aborted! Command failed with status (1): ["cc" -I"/home/eugenio/git/mruby/include" -...] /home/eugenio/.rvm/gems/ruby-1.9.2-p290/gems/rake-10.1.0/lib/rake/file_utils.rb:55:inblock in create_shell_runner' /home/eugenio/.rvm/gems/ruby-1.9.2-p290/gems/rake-10.1.0/lib/rake/file_utils.rb:45:in
call' /home/eugenio/.rvm/gems/ruby-1.9.2-p290/gems/rake-10.1.0/lib/rake/file_utils.rb:45:insh' /home/eugenio/.rvm/gems/ruby-1.9.2-p290/gems/rake-10.1.0/lib/rake/file_utils_ext.rb:37:in
sh' /home/eugenio/git/mruby/tasks/mruby_build_commands.rake:29:in_run' /home/eugenio/git/mruby/tasks/mruby_build_commands.rake:68:in
run' /home/eugenio/git/mruby/tasks/mruby_build_commands.rake:90:inblock (2 levels) in define_rules' /home/eugenio/.rvm/gems/ruby-1.9.2-p290/gems/rake-10.1.0/lib/rake/task.rb:234:in
call' /home/eugenio/.rvm/gems/ruby-1.9.2-p290/gems/rake-10.1.0/lib/rake/task.rb:234:inblock in execute' /home/eugenio/.rvm/gems/ruby-1.9.2-p290/gems/rake-10.1.0/lib/rake/task.rb:231:in
each' /home/eugenio/.rvm/gems/ruby-1.9.2-p290/gems/rake-10.1.0/lib/rake/task.rb:231:inexecute' /home/eugenio/.rvm/gems/ruby-1.9.2-p290/gems/rake-10.1.0/lib/rake/task.rb:175:in
block in invoke_with_call_chain' /home/eugenio/.rvm/rubies/ruby-1.9.2-p290/lib/ruby/1.9.1/monitor.rb:201:inmon_synchronize' /home/eugenio/.rvm/gems/ruby-1.9.2-p290/gems/rake-10.1.0/lib/rake/task.rb:168:in
invoke_with_call_chain' /home/eugenio/.rvm/gems/ruby-1.9.2-p290/gems/rake-10.1.0/lib/rake/task.rb:197:inblock in invoke_prerequisites' /home/eugenio/.rvm/gems/ruby-1.9.2-p290/gems/rake-10.1.0/lib/rake/task.rb:195:in
each' /home/eugenio/.rvm/gems/ruby-1.9.2-p290/gems/rake-10.1.0/lib/rake/task.rb:195:ininvoke_prerequisites' /home/eugenio/.rvm/gems/ruby-1.9.2-p290/gems/rake-10.1.0/lib/rake/task.rb:174:in
block in invoke_with_call_chain' /home/eugenio/.rvm/rubies/ruby-1.9.2-p290/lib/ruby/1.9.1/monitor.rb:201:inmon_synchronize' /home/eugenio/.rvm/gems/ruby-1.9.2-p290/gems/rake-10.1.0/lib/rake/task.rb:168:in
invoke_with_call_chain' /home/eugenio/.rvm/gems/ruby-1.9.2-p290/gems/rake-10.1.0/lib/rake/task.rb:197:inblock in invoke_prerequisites' /home/eugenio/.rvm/gems/ruby-1.9.2-p290/gems/rake-10.1.0/lib/rake/task.rb:195:in
each' /home/eugenio/.rvm/gems/ruby-1.9.2-p290/gems/rake-10.1.0/lib/rake/task.rb:195:ininvoke_prerequisites' /home/eugenio/.rvm/gems/ruby-1.9.2-p290/gems/rake-10.1.0/lib/rake/task.rb:174:in
block in invoke_with_call_chain' /home/eugenio/.rvm/rubies/ruby-1.9.2-p290/lib/ruby/1.9.1/monitor.rb:201:inmon_synchronize' /home/eugenio/.rvm/gems/ruby-1.9.2-p290/gems/rake-10.1.0/lib/rake/task.rb:168:in
invoke_with_call_chain' /home/eugenio/.rvm/gems/ruby-1.9.2-p290/gems/rake-10.1.0/lib/rake/task.rb:197:inblock in invoke_prerequisites' /home/eugenio/.rvm/gems/ruby-1.9.2-p290/gems/rake-10.1.0/lib/rake/task.rb:195:in
each' /home/eugenio/.rvm/gems/ruby-1.9.2-p290/gems/rake-10.1.0/lib/rake/task.rb:195:ininvoke_prerequisites' /home/eugenio/.rvm/gems/ruby-1.9.2-p290/gems/rake-10.1.0/lib/rake/task.rb:174:in
block in invoke_with_call_chain' /home/eugenio/.rvm/rubies/ruby-1.9.2-p290/lib/ruby/1.9.1/monitor.rb:201:inmon_synchronize' /home/eugenio/.rvm/gems/ruby-1.9.2-p290/gems/rake-10.1.0/lib/rake/task.rb:168:in
invoke_with_call_chain' /home/eugenio/.rvm/gems/ruby-1.9.2-p290/gems/rake-10.1.0/lib/rake/task.rb:197:inblock in invoke_prerequisites' /home/eugenio/.rvm/gems/ruby-1.9.2-p290/gems/rake-10.1.0/lib/rake/task.rb:195:in
each' /home/eugenio/.rvm/gems/ruby-1.9.2-p290/gems/rake-10.1.0/lib/rake/task.rb:195:ininvoke_prerequisites' /home/eugenio/.rvm/gems/ruby-1.9.2-p290/gems/rake-10.1.0/lib/rake/task.rb:174:in
block in invoke_with_call_chain' /home/eugenio/.rvm/rubies/ruby-1.9.2-p290/lib/ruby/1.9.1/monitor.rb:201:inmon_synchronize' /home/eugenio/.rvm/gems/ruby-1.9.2-p290/gems/rake-10.1.0/lib/rake/task.rb:168:in
invoke_with_call_chain' /home/eugenio/.rvm/gems/ruby-1.9.2-p290/gems/rake-10.1.0/lib/rake/task.rb:161:ininvoke' /home/eugenio/.rvm/gems/ruby-1.9.2-p290/gems/rake-10.1.0/lib/rake/application.rb:149:in
invoke_task' /home/eugenio/.rvm/gems/ruby-1.9.2-p290/gems/rake-10.1.0/lib/rake/application.rb:106:inblock (2 levels) in top_level' /home/eugenio/.rvm/gems/ruby-1.9.2-p290/gems/rake-10.1.0/lib/rake/application.rb:106:in
each' /home/eugenio/.rvm/gems/ruby-1.9.2-p290/gems/rake-10.1.0/lib/rake/application.rb:106:inblock in top_level' /home/eugenio/.rvm/gems/ruby-1.9.2-p290/gems/rake-10.1.0/lib/rake/application.rb:115:in
run_with_threads' /home/eugenio/.rvm/gems/ruby-1.9.2-p290/gems/rake-10.1.0/lib/rake/application.rb:100:intop_level' /home/eugenio/.rvm/gems/ruby-1.9.2-p290/gems/rake-10.1.0/lib/rake/application.rb:78:in
block in run' /home/eugenio/.rvm/gems/ruby-1.9.2-p290/gems/rake-10.1.0/lib/rake/application.rb:165:instandard_exception_handling' /home/eugenio/.rvm/gems/ruby-1.9.2-p290/gems/rake-10.1.0/lib/rake/application.rb:75:in
run' /home/eugenio/.rvm/gems/ruby-1.9.2-p290/gems/rake-10.1.0/bin/rake:33:in<top (required)>' /home/eugenio/.rvm/gems/ruby-1.9.2-p290/bin/rake:19:in
load' /home/eugenio/.rvm/gems/ruby-1.9.2-p290/bin/rake:19:in `' Tasks: TOP => all => /home/eugenio/git/mruby/bin/mirb-hostbased => /home/eugenio/git/mruby/build/host/bin/mirb-hostbased => /home/eugenio/git/mruby/build/host/lib/libmruby.a => /home/eugenio/git/mruby/build/host/mrbgems/mruby-arduino/src/mruby-ar duino.o
Do not include mruby-arduino for host configuration because it wont compile for Host machine, use only for target(STM32F4).
In contrast mruby-bin-mirb-hostbased is only for host
#configuration for host
MRuby::Build.new do |conf|
...
#NOT here
#conf.gem :git => "https://github.com/kyab/mruby-arduino.git"...
...
conf.gem :git => "https://github.com/kyab/mruby-bin-mirb-hostbased.git"...
end
#configuration for STM32F4
MRuby::CrossBuild.new('STM32F4') do |conf|
...
#here is OK
conf.gem :git => "https://github.com/kyab/mruby-arduino.git"
#NOT here
#conf.gem :git => "https://github.com/kyab/mruby-bin-mirb-hostbased.git"...
...
end
Don't mind about Italy error message, I didn't know too.
We're getting closer!! now i got this:
CC build/mrbgems/mruby-arduino/src/mruby-arduino.cpp -> build/STM32F4/mrbgems/mruby-arduino/src/mruby-arduino.o Using built-in specs. COLLECT_GCC=arm-none-eabi-gcc Target: arm-none-eabi Configured with: /home/build/work/GCC-4-7-build/src/gcc/configure --target=arm-none-eabi --prefix=/home/build/work/GCC-4-7- build/install-native --libexecdir=/home/build/work/GCC-4-7-build/install-native/lib --infodir=/home/build/work/GCC-4-7-buil d/install-native/share/doc/gcc-arm-none-eabi/info --mandir=/home/build/work/GCC-4-7-build/install-native/share/doc/gcc-arm- none-eabi/man --htmldir=/home/build/work/GCC-4-7-build/install-native/share/doc/gcc-arm-none-eabi/html --pdfdir=/home/build /work/GCC-4-7-build/install-native/share/doc/gcc-arm-none-eabi/pdf --enable-languages=c,c++ --disable-decimal-float --disab le-libffi --disable-libgomp --disable-libmudflap --disable-libquadmath --disable-libssp --disable-libstdcxx-pch --disable-l to --disable-nls --disable-shared --disable-threads --disable-tls --with-gnu-as --with-gnu-ld --with-newlib --with-headers= yes --with-python-dir=share/gcc-arm-none-eabi --with-sysroot=/home/build/work/GCC-4-7-build/install-native/arm-none-eabi -- build=i686-linux-gnu --host=i686-linux-gnu --with-gmp=/home/build/work/GCC-4-7-build/build-native/host-libs/usr --with-mpfr =/home/build/work/GCC-4-7-build/build-native/host-libs/usr --with-mpc=/home/build/work/GCC-4-7-build/build-native/host-libs /usr --with-ppl=/home/build/work/GCC-4-7-build/build-native/host-libs/usr --with-cloog=/home/build/work/GCC-4-7-build/build -native/host-libs/usr --with-libelf=/home/build/work/GCC-4-7-build/build-native/host-libs/usr --with-host-libstdcxx='-stati c-libgcc -Wl,-Bstatic,-lstdc++,-Bdynamic -lm' --with-pkgversion='GNU Tools for ARM Embedded Processors' --with-multilib-lis t=armv6-m,armv7-m,armv7e-m,armv7-r Thread model: single gcc version 4.7.3 20121207 (release) [ARM/embedded-4_7-branch revision 194305](GNU Tools for ARM Embedded Processors) COLLECT_GCC_OPTIONS='-v' '-iquote' '-fpermissive' '-mthumb' '-mcpu=cortex-m4' '-mfloat-abi=hard' '-mfpu=fpv4-sp-d16' '-D' ' FPU_USED=1' '-D' 'BOARD_discovery_f4' '-D' 'MCU_STM32F406VG' '-D' 'STM32_HIGH_DENSITY' '-g' '-Os' '-gdwarf-2' '-D' 'RUN_F ROM_FLASH=1' '-v' '-iquote' '-fpermissive' '-mthumb' '-mcpu=cortex-m4' '-mfloat-abi=hard' '-mfpu=fpv4-sp-d16' '-D' '__FPU_U SED=1' '-D' 'BOARD_discovery_f4' '-D' 'MCU_STM32F406VG' '-D' 'STM32_HIGH_DENSITY' '-g' '-Os' '-gdwarf-2' '-D' 'RUN_FROM_FLA SH=1' '-I' '/usr/include' '-I' '/home/eugenio/workspace/STM32F4_Sample/inc/' '-I' '/home/eugenio/workspace/STM32F4_Sample/L ibraries/CMSIS/Include' '-I' '/home/eugenio/workspace/STM32F4_Sample/Libraries/STM32F4xx_StdPeriph_Driver/inc' '-I' '/home/ eugenio/workspace/STM32F4_Sample/Libraries/STM32_USB_Device_Library/Class/hid/inc' '-I' '/home/eugenio/workspace/STM32F4_Sa mple/Libraries/STM32_USB_Device_Library/Core/inc' '-I' '/home/eugenio/workspace/STM32F4_Sample/Libraries/STM32_USB_OTG_Driv er/inc' '-I' '/home/eugenio/workspace/STM32F4_Sample/Utilities/STM32F4-Discovery' '-I' '/home/eugenio/git/mruby/include' '- I' '/home/eugenio/git/AeroQuad/Libmaple/libmaple/wirish' '-I' '/home/eugenio/git/AeroQuad/Libmaple/libmaple/libmaple' '-I' '/home/eugenio/git/AeroQuad/Libmaple/libmaple/libraries' '-I' '/home/eugenio/git/AeroQuad/Libmaple/libmaple/wirish/boards' '-I' '/home/eugenio/git/AeroQuad/Libmaple/libmaple/wirish/comm' '-I' 'build/mrbgems/mruby-arduino/include' '-o' '/home/euge nio/git/mruby/build/STM32F4/mrbgems/mruby-arduino/src/mruby-arduino.o' '-c' /home/eugenio/gcc-arm-none-eabi-4_7-2012q4/bin/../lib/gcc/arm-none-eabi/4.7.3/cc1plus -quiet -v -v -I /usr/include -I /hom e/eugenio/workspace/STM32F4_Sample/inc/ -I /home/eugenio/workspace/STM32F4_Sample/Libraries/CMSIS/Include -I /home/eugenio/ workspace/STM32F4_Sample/Libraries/STM32F4xx_StdPeriph_Driver/inc -I /home/eugenio/workspace/STM32F4_Sample/Libraries/STM32 _USB_Device_Library/Class/hid/inc -I /home/eugenio/workspace/STM32F4_Sample/Libraries/STM32_USB_Device_Library/Core/inc -I /home/eugenio/workspace/STM32F4_Sample/Libraries/STM32_USB_OTG_Driver/inc -I /home/eugenio/workspace/STM32F4_Sample/Utiliti es/STM32F4-Discovery -I /home/eugenio/git/mruby/include -I /home/eugenio/git/AeroQuad/Libmaple/libmaple/wirish -I /home/eug enio/git/AeroQuad/Libmaple/libmaple/libmaple -I /home/eugenio/git/AeroQuad/Libmaple/libmaple/libraries -I /home/eugenio/git /AeroQuad/Libmaple/libmaple/wirish/boards -I /home/eugenio/git/AeroQuad/Libmaple/libmaple/wirish/comm -I build/mrbgems/mrub y-arduino/include -imultilib armv7e-m/fpu -iprefix /home/eugenio/gcc-arm-none-eabi-4_7-2012q4/bin/../lib/gcc/arm-none-eabi/ 4.7.3/ -isysroot /home/eugenio/gcc-arm-none-eabi-4_7-2012q4/bin/../arm-none-eabi -D__USES_INITFINI -D _FPU_USED=1 -D BOA RD_discovery_f4 -D MCU_STM32F406VG -D STM32_HIGH_DENSITY -D RUN_FROM_FLASH=1 -D FPU_USED=1 -D BOARD_discovery_f4 -D MCU_S TM32F406VG -D STM32_HIGH_DENSITY -D RUN_FROM_FLASH=1 -iquote -fpermissive -iquote -fpermissive build/mrbgems/mruby-arduino/ src/mruby-arduino.cpp -quiet -dumpbase mruby-arduino.cpp -mthumb -mcpu=cortex-m4 -mfloat-abi=hard -mfpu=fpv4-sp-d16 -mthumb -mcpu=cortex-m4 -mfloat-abi=hard -mfpu=fpv4-sp-d16 -auxbase-strip /home/eugenio/git/mruby/build/STM32F4/mrbgems/mruby-ardu ino/src/mruby-arduino.o -g -gdwarf-2 -g -gdwarf-2 -Os -Os -version -o /tmp/ccsA6DO4.s GNU C++ (GNU Tools for ARM Embedded Processors) version 4.7.3 20121207 (release) ARM/embedded-4_7-branch revision 194305 compiled by GNU C version 4.3.6, GMP version 4.3.2, MPFR version 2.4.2, MPC version 0.8.1 GGC heuristics: --param ggc-min-expand=100 --param ggc-min-heapsize=131072 ignoring duplicate directory "/home/eugenio/gcc-arm-none-eabi-4_7-2012q4/bin/../lib/gcc/../../lib/gcc/arm-none-eabi/4.7.3/. ./../../../arm-none-eabi/include/c++/4.7.3" ignoring duplicate directory "/home/eugenio/gcc-arm-none-eabi-4_7-2012q4/bin/../lib/gcc/../../lib/gcc/arm-none-eabi/4.7.3/. ./../../../arm-none-eabi/include/c++/4.7.3/arm-none-eabi/armv7e-m/fpu" ignoring duplicate directory "/home/eugenio/gcc-arm-none-eabi-4_7-2012q4/bin/../lib/gcc/../../lib/gcc/arm-none-eabi/4.7.3/. ./../../../arm-none-eabi/include/c++/4.7.3/backward" ignoring duplicate directory "/home/eugenio/gcc-arm-none-eabi-4_7-2012q4/bin/../lib/gcc/../../lib/gcc/arm-none-eabi/4.7.3/i nclude" ignoring nonexistent directory "/home/eugenio/gcc-arm-none-eabi-4_7-2012q4/bin/../arm-none-eabi/usr/local/include" ignoring duplicate directory "/home/eugenio/gcc-arm-none-eabi-4_7-2012q4/bin/../lib/gcc/../../lib/gcc/arm-none-eabi/4.7.3/i nclude-fixed" ignoring duplicate directory "/home/eugenio/gcc-arm-none-eabi-4_7-2012q4/bin/../lib/gcc/../../lib/gcc/arm-none-eabi/4.7.3/. ./../../../arm-none-eabi/include" ignoring nonexistent directory "/home/eugenio/gcc-arm-none-eabi-4_7-2012q4/bin/../arm-none-eabi/usr/include" ignoring nonexistent directory "build/mrbgems/mruby-arduino/include" ignoring nonexistent directory "-fpermissive" ignoring nonexistent directory "-fpermissive" #include "..." search starts here: #include <...> search starts here: /usr/include /home/eugenio/workspace/STM32F4_Sample/inc/ /home/eugenio/workspace/STM32F4_Sample/Libraries/CMSIS/Include /home/eugenio/workspace/STM32F4_Sample/Libraries/STM32F4xx_StdPeriph_Driver/inc /home/eugenio/workspace/STM32F4_Sample/Libraries/STM32_USB_Device_Library/Class/hid/inc /home/eugenio/workspace/STM32F4_Sample/Libraries/STM32_USB_Device_Library/Core/inc /home/eugenio/workspace/STM32F4_Sample/Libraries/STM32_USB_OTG_Driver/inc /home/eugenio/workspace/STM32F4_Sample/Utilities/STM32F4-Discovery /home/eugenio/git/mruby/include /home/eugenio/git/AeroQuad/Libmaple/libmaple/wirish /home/eugenio/git/AeroQuad/Libmaple/libmaple/libmaple /home/eugenio/git/AeroQuad/Libmaple/libmaple/libraries /home/eugenio/git/AeroQuad/Libmaple/libmaple/wirish/boards /home/eugenio/git/AeroQuad/Libmaple/libmaple/wirish/comm /home/eugenio/gcc-arm-none-eabi-4_7-2012q4/bin/../lib/gcc/arm-none-eabi/4.7.3/../../../../arm-none-eabi/include/c++/4.7.3 /home/eugenio/gcc-arm-none-eabi-4_7-2012q4/bin/../lib/gcc/arm-none-eabi/4.7.3/../../../../arm-none-eabi/include/c++/4.7.3/ arm-none-eabi/armv7e-m/fpu /home/eugenio/gcc-arm-none-eabi-4_7-2012q4/bin/../lib/gcc/arm-none-eabi/4.7.3/../../../../arm-none-eabi/include/c++/4.7.3/ backward /home/eugenio/gcc-arm-none-eabi-4_7-2012q4/bin/../lib/gcc/arm-none-eabi/4.7.3/include /home/eugenio/gcc-arm-none-eabi-4_7-2012q4/bin/../lib/gcc/arm-none-eabi/4.7.3/include-fixed /home/eugenio/gcc-arm-none-eabi-4_7-2012q4/bin/../lib/gcc/arm-none-eabi/4.7.3/../../../../arm-none-eabi/include End of search list. GNU C++ (GNU Tools for ARM Embedded Processors) version 4.7.3 20121207 (release) ARM/embedded-4_7-branch revision 194305 compiled by GNU C version 4.3.6, GMP version 4.3.2, MPFR version 2.4.2, MPC version 0.8.1 GGC heuristics: --param ggc-min-expand=100 --param ggc-min-heapsize=131072 Compiler executable checksum: adee437fad9936e057626ce888dcd43c In file included from /home/eugenio/git/AeroQuad/Libmaple/libmaple/wirish/wirish.h:45:0, from /home/eugenio/git/AeroQuad/Libmaple/libmaple/wirish/WProgram.h:27, from build/mrbgems/mruby-arduino/src/mruby-arduino.cpp:11: /home/eugenio/git/AeroQuad/Libmaple/libmaple/wirish/wirish_math.h:117:20: error: declaration of 'double cos(double)' has a different exception specifier In file included from /usr/include/math.h:70:0, from /home/eugenio/git/AeroQuad/Libmaple/libmaple/wirish/wirish_math.h:35, from /home/eugenio/git/AeroQuad/Libmaple/libmaple/wirish/wirish.h:45, from /home/eugenio/git/AeroQuad/Libmaple/libmaple/wirish/WProgram.h:27, from build/mrbgems/mruby-arduino/src/mruby-arduino.cpp:11: /usr/include/bits/mathcalls.h:63:1: error: from previous declaration 'double cos(double) throw ()' In file included from /home/eugenio/git/AeroQuad/Libmaple/libmaple/wirish/wirish.h:45:0, from /home/eugenio/git/AeroQuad/Libmaple/libmaple/wirish/WProgram.h:27, from build/mrbgems/mruby-arduino/src/mruby-arduino.cpp:11: /home/eugenio/git/AeroQuad/Libmaple/libmaple/wirish/wirish_math.h:124:20: error: declaration of 'double sin(double)' has a different exception specifier In file included from /usr/include/math.h:70:0, from /home/eugenio/git/AeroQuad/Libmaple/libmaple/wirish/wirish_math.h:35, from /home/eugenio/git/AeroQuad/Libmaple/libmaple/wirish/wirish.h:45, from /home/eugenio/git/AeroQuad/Libmaple/libmaple/wirish/WProgram.h:27, from build/mrbgems/mruby-arduino/src/mruby-arduino.cpp:11: /usr/include/bits/mathcalls.h:65:1: error: from previous declaration 'double sin(double) throw ()' In file included from /home/eugenio/git/AeroQuad/Libmaple/libmaple/wirish/wirish.h:45:0, from /home/eugenio/git/AeroQuad/Libmaple/libmaple/wirish/WProgram.h:27, from build/mrbgems/mruby-arduino/src/mruby-arduino.cpp:11: /home/eugenio/git/AeroQuad/Libmaple/libmaple/wirish/wirish_math.h:132:20: error: declaration of 'double tan(double)' has a different exception specifier In file included from /usr/include/math.h:70:0, from /home/eugenio/git/AeroQuad/Libmaple/libmaple/wirish/wirish_math.h:35, from /home/eugenio/git/AeroQuad/Libmaple/libmaple/wirish/wirish.h:45, from /home/eugenio/git/AeroQuad/Libmaple/libmaple/wirish/WProgram.h:27, from build/mrbgems/mruby-arduino/src/mruby-arduino.cpp:11: /usr/include/bits/mathcalls.h:67:1: error: from previous declaration 'double tan(double) throw ()' In file included from /home/eugenio/git/AeroQuad/Libmaple/libmaple/wirish/wirish.h:45:0, from /home/eugenio/git/AeroQuad/Libmaple/libmaple/wirish/WProgram.h:27, from build/mrbgems/mruby-arduino/src/mruby-arduino.cpp:11: /home/eugenio/git/AeroQuad/Libmaple/libmaple/wirish/wirish_math.h:140:21: error: declaration of 'double sqrt(double)' has a different exception specifier In file included from /usr/include/math.h:70:0, from /home/eugenio/git/AeroQuad/Libmaple/libmaple/wirish/wirish_math.h:35, from /home/eugenio/git/AeroQuad/Libmaple/libmaple/wirish/wirish.h:45, from /home/eugenio/git/AeroQuad/Libmaple/libmaple/wirish/WProgram.h:27, from build/mrbgems/mruby-arduino/src/mruby-arduino.cpp:11: /usr/include/bits/mathcalls.h:157:1: error: from previous declaration 'double sqrt(double) throw ()' In file included from /home/eugenio/git/AeroQuad/Libmaple/libmaple/wirish/wirish.h:45:0, from /home/eugenio/git/AeroQuad/Libmaple/libmaple/wirish/WProgram.h:27, from build/mrbgems/mruby-arduino/src/mruby-arduino.cpp:11: /home/eugenio/git/AeroQuad/Libmaple/libmaple/wirish/wirish_math.h:149:30: error: declaration of 'double pow(double, double) ' has a different exception specifier In file included from /usr/include/math.h:70:0, from /home/eugenio/git/AeroQuad/Libmaple/libmaple/wirish/wirish_math.h:35, from /home/eugenio/git/AeroQuad/Libmaple/libmaple/wirish/wirish.h:45, from /home/eugenio/git/AeroQuad/Libmaple/libmaple/wirish/WProgram.h:27, from build/mrbgems/mruby-arduino/src/mruby-arduino.cpp:11: /usr/include/bits/mathcalls.h:154:1: error: from previous declaration 'double pow(double, double) throw ()' build/mrbgems/mruby-arduino/src/mruby-arduino.cpp: In function 'mrb_value mrb_arduino_pinMode(mrb_state, mrb_value)': build/mrbgems/mruby-arduino/src/mruby-arduino.cpp:60:20: error: invalid conversion from 'mrb_int {aka int}' to 'WiringPinMo de' [-fpermissive] In file included from /home/eugenio/git/AeroQuad/Libmaple/libmaple/wirish/wirish.h:40:0, from /home/eugenio/git/AeroQuad/Libmaple/libmaple/wirish/WProgram.h:27, from build/mrbgems/mruby-arduino/src/mruby-arduino.cpp:11: /home/eugenio/git/AeroQuad/Libmaple/libmaple/wirish/io.h:113:6: error: initializing argument 2 of 'void pinMode(uint8, Wi ringPinMode)' [-fpermissive] build/mrbgems/mruby-arduino/src/mruby-arduino.cpp: In function 'mrb_value mrb_arduino_analogReference(mrb_state, mrb_value )': build/mrbgems/mruby-arduino/src/mruby-arduino.cpp:87:23: error: 'analogReference' was not declared in this scope build/mrbgems/mruby-arduino/src/mruby-arduino.cpp: In function 'mrb_value mrb_arduino_shiftIn(mrb_state*, mrb_value)': build/mrbgems/mruby-arduino/src/mruby-arduino.cpp:143:62: error: 'shiftIn' was not declared in this scope rake aborted! Command Failed: ["arm-none-eabi-gcc" -v -iquote -fpermissive -mthumb -mcpu=cortex-m4 -mfloat-abi=hard -mfpu=fpv4-sp-d16 -D FPU_USED=1 -DBOARD_discovery_f4 -DMCU_STM32F406VG -DSTM32_HIGH_DENSITY -g -Os -gdwarf-2 -DRUN_FROM_FLASH=1 -v -iquote -fpe rmissive -mthumb -mcpu=cortex-m4 -mfloat-abi=hard -mfpu=fpv4-sp-d16 -D__FPU_USED=1 -DBOARD_discovery_f4 -DMCU_STM32F406VG - DSTM32_HIGH_DENSITY -g -Os -gdwarf-2 -DRUN_FROM_FLASH=1 -I"/usr/include" -I"/home/eugenio/workspace/STM32F4_Sample/inc/"
-I"/home/eugenio/workspace/STM32F4_Sample/Libraries/CMSIS/Include" -I"/home/eugenio/workspace/STM32F4_Sample/Libraries/STM 32F4xx_StdPeriph_Driver/inc" -I"/home/eugenio/workspace/STM32F4_Sample/Libraries/STM32_USB_Device_Library/Class/hid/inc"
-I"/home/eugenio/workspace/STM32F4_Sample/Libraries/STM32_USB_Device_Library/Core/inc" -I"/home/eugenio/workspace/STM32F4 Sample/Libraries/STM32_USB_OTG_Driver/inc" -I"/home/eugenio/workspace/STM32F4_Sample/Utilities/STM32F4-Discovery" -I"/hom e/eugenio/git/mruby/include" -I"/home/eugenio/git/AeroQuad/Libmaple/libmaple/wirish" -I"/home/eugenio/git/AeroQuad/Libmap le/libmaple/libmaple" -I"/home/eugenio/git/AeroQuad/Libmaple/libmaple/libraries" -I"/home/eugenio/git/AeroQuad/Libmaple/l ibmaple/wirish/boards" -I"/home/eugenio/git/AeroQuad/Libmaple/libmaple/wirish/comm" -I"build/mrbgems/mruby-arduino/includ e" -o "/home/eugenio/git/mruby/build/STM32F4/mrbgems/mruby-arduino/src/mruby-arduino.o" -c "build/mrbgems/mruby-arduino/sr c/mruby-arduino.cpp"]
Yes getting closer.
remove /usr/include
from @@crosscompilation_include_paths
. /usr/include is for headers for Host compiler.
And paster build_config.rb again. I will refine it.
Here you are, build_config.rb in its last version
MRuby::Build.new do |conf|
STM32_PROJ_PATH = '/home/eugenio/workspace/STM32F4_Sample'
STM32_LIB_PATH = "#{STM32_PROJ_PATH}/Libraries"
STM32_UTIL_PATH = "#{STM32_PROJ_PATH}/Utilities"
AEROQUAD_PATH = "/home/eugenio/git/AeroQuad"
@@crosscompilation_include_paths = [
"#{STM32_PROJ_PATH}/inc/",
"#{STM32_LIB_PATH}/CMSIS/Include",
"#{STM32_LIB_PATH}/STM32F4xx_StdPeriph_Driver/inc",
"#{STM32_LIB_PATH}/STM32_USB_Device_Library/Class/hid/inc",
"#{STM32_LIB_PATH}/STM32_USB_Device_Library/Core/inc",
"#{STM32_LIB_PATH}/STM32_USB_OTG_Driver/inc",
"#{STM32_UTIL_PATH}/STM32F4-Discovery",
"#{MRUBY_ROOT}/include",
"#{AEROQUAD_PATH}/Libmaple/libmaple/wirish",
"#{AEROQUAD_PATH}/Libmaple/libmaple/libmaple",
"#{AEROQUAD_PATH}/Libmaple/libmaple/libraries",
"#{AEROQUAD_PATH}/Libmaple/libmaple/wirish/boards",
"#{AEROQUAD_PATH}/Libmaple/libmaple/wirish/comm"]
@@compilation_include_paths = [
"/usr/include",
"#{STM32_PROJ_PATH}/inc/",
"#{STM32_LIB_PATH}/CMSIS/Include",
"#{STM32_LIB_PATH}/STM32F4xx_StdPeriph_Driver/inc",
"#{STM32_LIB_PATH}/STM32_USB_Device_Library/Class/hid/inc",
"#{STM32_LIB_PATH}/STM32_USB_Device_Library/Core/inc",
"#{STM32_LIB_PATH}/STM32_USB_OTG_Driver/inc",
"#{STM32_UTIL_PATH}/STM32F4-Discovery",
"#{MRUBY_ROOT}/include",
"#{AEROQUAD_PATH}/Libmaple/libmaple/wirish",
"#{AEROQUAD_PATH}/Libmaple/libmaple/libmaple",
"#{AEROQUAD_PATH}/Libmaple/libmaple/libraries",
"#{AEROQUAD_PATH}/Libmaple/libmaple/wirish/boards",
"#{AEROQUAD_PATH}/Libmaple/libmaple/wirish/comm"]
CFLAGS_CROSSCOMPILE = "-v -iquote -fpermissive -std=gnu99 -mthumb -mcpu=cortex-m4 -mfloat-abi=hard -mfpu=fpv4-sp-d16 -D__FPU_USED=1 -DMCU_STM32F406VG -DBOARD_discovery_f4 -DSTM32_HIGH_DENSITY -g -Os -gdwarf-2 -DRUN_FROM_FLASH=1"
CROSSCOMPILATION_CXXFLAGS = "-v -iquote -fpermissive -mthumb -mcpu=cortex-m4 -mfloat-abi=hard -mfpu=fpv4-sp-d16 -D__FPU_USED=1 -DBOARD_discovery_f4 -DMCU_STM32F406VG -DSTM32_HIGH_DENSITY -g -Os -gdwarf-2 -DRUN_FROM_FLASH=1"
CFLAGS = " -O3 -iquote -fpermissive -std=gnu99"
LINKFLAGS = "-lc -lm"
conf.gem :git => 'https://github.com/kyab/mruby-bin-mirb-hostbased', :branch => 'master' do |g|
g.cc.include_paths = @@compilation_include_paths
g.cc.flags << "#{CFLAGS}"
g.cc.option_include_path = '-I%s '
end
# load specific toolchain settings
#toolchain :gcc
## Use mrbgems
# conf.gem 'examples/mrbgems/ruby_extension_example'
# conf.gem 'examples/mrbgems/c_extension_example' do |g|
# g.cc.flags << '-g' # append cflags in this gem
# end
# conf.gem 'examples/mrbgems/c_and_ruby_extension_example'
# conf.gem :github => 'masuidrive/mrbgems-example', :branch => 'master'
# conf.gem :git => '[email protected]:masuidrive/mrbgems-example.git', :branch => 'master', :options => '-v'
# include the default GEMs
conf.gembox 'default'
# C compiler settings
conf.cc do |cc|
cc.command = ENV['CC'] || 'gcc'
cc.flags << "#{CFLAGS}"
cc.include_paths = @@compilation_include_paths
cc.defines = %w(ENABLE_GEMS)
cc.option_include_path = '-I%s '
cc.option_define = '-D%s'
cc.compile_options = "%{flags} -MMD -o %{outfile} -c %{infile}"
end
# mrbc settings
# conf.mrbc do |mrbc|
# mrbc.compile_options = "-g -B%{funcname} -o-" # The -g option is required for line numbers
# end
conf.linker do |linker|
linker.command = ENV['LD'] || 'gcc'
linker.flags << "#{LINKFLAGS}"
linker.flags_before_libraries << "#{LINKFLAGS}"
linker.libraries = %w(m)
linker.flags_after_libraries << "#{LINKFLAGS}"
linker.library_paths = @@compilation_include_paths
linker.option_library = '-l%s'
linker.option_library_path = '-L%s'
linker.link_options = "-o %{outfile} %{objs} %{libs} "
end
# Archiver settings
# conf.archiver do |archiver|
# archiver.command = ENV['AR'] || 'ar'
# archiver.archive_options = 'rs %{outfile} %{objs}'
# end
# Parser generator settings
# conf.yacc do |yacc|
# yacc.command = ENV['YACC'] || 'bison'
# yacc.compile_options = '-o %{outfile} %{infile}'
# end
# gperf settings
# conf.gperf do |gperf|
# gperf.command = 'gperf'
# gperf.compile_options = '-L ANSI-C -C -p -j1 -i 1 -g -o -t -N mrb_reserved_word -k"1,3,$" %{infile} > %{outfile}'
# end
# file extensions
# conf.exts do |exts|
# exts.object = '.o'
# exts.executable = '' # '.exe' if Windows
# exts.library = '.a'
# end
# file separetor
# conf.file_separator = '/'
end
# Define cross build settings
MRuby::CrossBuild.new('STM32F4') do |conf|
# Use led class 他のページで説明しているLEDのクラスを使用する場合はコメントを外してください
# conf.gem 'mrbgems/mruby-led'
# conf.gem :git => "https://github.com/kyab/mruby-arduino.git", :branch => "master" do |g|
# g.cc.command = 'arm-none-eabi-gcc'
# g.cc.include_paths = @@crosscompilation_include_paths
# g.cc.flags << "#{CROSSCOMPILATION_CXXFLAGS}"
# end
conf.gem :git => "https://github.com/kyab/mruby-arduino.git", :branch => "master" do |g|
g.cxx.command = 'arm-none-eabi-gcc'
g.cxx.include_paths = @@crosscompilation_include_paths
g.cxx.flags << "#{CROSSCOMPILATION_CXXFLAGS}"
g.cxx.option_include_path = '-I%s '
end
conf.cc do |cc|
cc.command = ENV['CC'] ||'arm-none-eabi-gcc'
cc.include_paths = @@crosscompilation_include_paths
cc.option_include_path = '-I%s '
cc.flags << "#{CFLAGS_CROSSCOMPILE}"
cc.compile_options = '%{flags} -MMD -o %{outfile} -c %{infile}'
end
conf.cxx do |cc|
cc.command = 'arm-none-eabi-gcc'
cc.flags << "#{CROSSCOMPILATION_CXXFLAGS}"
end
# Linker settings
conf.linker do |linker|
linker.command = 'arm-none-eabi-gcc'
linker.flags = ["-T/home/eugenio/workspace/STM32F4_Sample/stm32_flash.ld"]
linker.flags_before_libraries = []
linker.libraries = %w()
linker.flags_after_libraries = []
linker.library_paths = @@compilation_include_paths
linker.option_library = '-l%s'
linker.option_library_path = '-L%s'
linker.link_options = "-o %{outfile} %{objs} %{libs} "
end
# file extensions
# conf.exts do |exts|
# exts.object = '.o'
# exts.executable = '' # '.exe' if Windows
# exts.library = '.a'
# end
end
Try with this.
MRuby::Build.new do |conf|
toolchain :gcc
conf.gembox 'default'
CFLAGS = "-O3 -iquote -fpermissive -std=gnu99"
conf.cc do |cc|
cc.include_paths << ["/usr/include"] #maybe unnecessary
cc.flags << CFLAGS
end
end
MRuby::CrossBuild.new('STM32F4') do |conf|
toolchain :gcc #This pulls default for you. We only have to overwrite specifig things.
STM32_PROJ_PATH = '/home/eugenio/workspace/STM32F4_Sample'
STM32_LIB_PATH = "#{STM32_PROJ_PATH}/Libraries"
STM32_UTIL_PATH = "#{STM32_PROJ_PATH}/Utilities"
AEROQUAD_PATH = "/home/eugenio/git/AeroQuad"
CFLAGS_CROSSCOMPILE = "-v -iquote -fpermissive -std=gnu99 -mthumb -mcpu=cortex-m4 -mfloat-abi=hard -mfpu=fpv4-sp-d16 -D__FPU_USED=1 -DMCU_STM32F406VG -DBOARD_discovery_f4 -DSTM32_HIGH_DENSITY -g -Os -gdwarf-2 -DRUN_FROM_FLASH=1"
CROSSCOMPILATION_CXXFLAGS = "-v -iquote -fpermissive -mthumb -mcpu=cortex-m4 -mfloat-abi=hard -mfpu=fpv4-sp-d16 -D__FPU_USED=1 -DBOARD_discovery_f4 -DMCU_STM32F406VG -DSTM32_HIGH_DENSITY -g -Os -gdwarf-2 -DRUN_FROM_FLASH=1"
conf.cc do |cc|
cc.command = 'arm-none-eabi-gcc'
cc.include_paths << [
"#{STM32_PROJ_PATH}/inc/",
"#{STM32_LIB_PATH}/CMSIS/Include",
"#{STM32_LIB_PATH}/STM32F4xx_StdPeriph_Driver/inc",
"#{STM32_LIB_PATH}/STM32_USB_Device_Library/Class/hid/inc",
"#{STM32_LIB_PATH}/STM32_USB_Device_Library/Core/inc",
"#{STM32_LIB_PATH}/STM32_USB_OTG_Driver/inc",
"#{STM32_UTIL_PATH}/STM32F4-Discovery",
"#{AEROQUAD_PATH}/Libmaple/libmaple/wirish",
"#{AEROQUAD_PATH}/Libmaple/libmaple/libmaple",
"#{AEROQUAD_PATH}/Libmaple/libmaple/libraries",
"#{AEROQUAD_PATH}/Libmaple/libmaple/wirish/boards",
"#{AEROQUAD_PATH}/Libmaple/libmaple/wirish/comm"]
cc.flags = CFLAGS_CROSSCOMPILE
end
conf.cxx do |cxx|
cxx.command = conf.cc.command.dup
cxx.include_paths = conf.cxx.command.dup
cxx.flags = CROSSCOMPILATION_CXXFLAGS
end
conf.linker do |linker|
linker.command = 'arm-none-eabi-gcc'
linker.flags = ["-T/home/eugenio/workspace/STM32F4_Sample/stm32_flash.ld"]
end
conf.archiver do |archiver|
archiver.command = 'arm-none-eabi-ar' #I'm not sure about name of archiver.
end
conf.bins = []
conf.build_mrbtest_lib_only
conf.gem :git => "https://github.com/kyab/mruby-arduino.git", :branch => "master"
end
Hi @kyab, now it compiles. I had to do some minor changes in mruby-arduino.cpp to make it work but it's ok now. The only issue is that i couldn't find the compiled binary :( In /STM32F4 there is no bin directory so I'm a little confused here :O . Perhaps we have to specify an output format to obtain mruby-arduino.bin ? Or do I have to look somewhere else? I tried to load a dfu version of mruby-arduino.o because I thought "that's it!", but the board didn't show up in my system ( i use ubuntu 13.04).
build/STMF34/lib/libmruby.a includes mruby-arduino.o. I'm embarrassment little. Basically mruby is a library which allow your main program to execute Ruby. library name is libmruby.a. You need your main program written in C and you should link against libmruby.a.
mruby-arduino is just mrbgem. mruby's mrbgem system allows 3rd vender mruby extention to be included in libmruby.a
I was finally able to compile successfully with libmaple and libmruby, the only problem I have now is that the binary does not produce any output on my board when i load it up. I was trying to load other examples including only libmaple but I haven't had any luck. If you kindly could review my code and try to compile it for yourself and/or directly try to load the binary on your discovery board maybe I can narrow down the problem. Let me know if you want me to issue a pull request to your repo or you want to download from my page on github (the code isn't there yet but I'll push it on if you want).
@eugenio You could not see any serial output from board?
I think you should first try to able to use libmaple , then with libmruby. I could check you entire source but not sure if the problem is libmaple issue. Anyway I prefer you to put your source in your page.
@kyab I'm on the way to get mruby-arduino compiled but got: rake aborted! Don't know how to rake .../mruby-arduino/src/mruby-arduino.c I'm new in mruby and think its some wrong setup...?
@marcel12bell
Could you tell me below information?
- Your target(board name). Arduino Due or chipKIT Max32 or else?
- Full contents of your build_config.rb for cross compile mruby.
- full command line and result of build(including error message)
Ok, got it compiled. Was a bit libmaple directory inferno. After changing to the AeroQuad32 libmaple files it worked. Q: in the in the build_config.rb is a -DMCU_STM32F406VG flag. My board is the xxF407VG can I change the flag? Next step is a bit Interaction with the board in/output...
@marcel12bell Good news. I think changing -DMCU_STM32F406VG to something like -DMCU_STM32F407VG is not good idea and won't compile. Because there are no specific check for xxF407VG currently in AeroQuard's libmaple.
I'm using -DMCU_STM32F406VG with stm32f4discovery which have STM32F407VG, and no problem.
I found your mruby-bin-mirb-hostbased repo! Can't wait to get it on my board.... Is there anywhere a script and example to ".elf" and ".bin" all together?
Thanks for interested in mruby-bin-mirb-hostbased. I did not try with stm32f4 yet, but I believe It should be easy to copy many parts of https://github.com/kyab/mruby-bin-mirb-hostbased/blob/master/samples/target/chipKITMax32_ArduinoDue_runner/chipKITMax32_ArduinoDue_runner.pde to your *.cpp, then make elf/bin. *.pde is called sketch in Arduino world, but it is actually C++ program.
I found your tutorial (http://d.hatena.ne.jp/kyab/20130806), but on libmaple side there are still errors... hard work to get it running. Is there any libmaple packet with all needed stm32f4 files? h:29:27: fatal error: usbd_cdc_core.h: No such file or directory #include "usbd_cdc_core.h" ^ compilation terminated. make[1]: *** [build//...../libmaple/libmaple/libmaple/usbF4/VCP/usbd_cdc_vcp.o] Error 1
Uhmm, I'm currently working with my slightly modified version of AeroQuad https://github.com/kyab/AeroQuad Not much change from original, most important change was linker script(ld). I changed RAM usage to maximum(128kb) in Libmaple/libmaple/support/ld/discovery_f4/jtag.ld. Some changes on FreeRTOS related file are ignorable because changes are for my other experimental projects.
Here is my current project with above AeroQuad: https://github.com/kyab/mruby_web_ledcontrol Check Makefile. this is my latest.
In my environment, usbd_cdc_vcp.c succeeded to compile, but maybe not required because I don't use USB.
And, here is my build_config.rb for mruby. I'm updating to latest mruby every day. https://gist.github.com/kyab/10589251
https://github.com/mruby/mruby
Adjust paths of Makefile, build_config.rb for your environment, and try. BTW, what toolchain are you using? I'm using toolchain with Maple IDE.
Thanks for your help! After some strange errors in my arm-none-eabi toolchain I got it compiled. Now I have an error:: Device not configured if I try to connect with mirb. I think because I have to implement the ...runner.pde parts. Btw. I'm starting with all so I din't really use an IDE till now.
@kyab last error I hope: /AeroQuad/Libmaple/libmaple/support/ld/libcs3_stm32_high_density.a(start_c.o): In function '__cs3_start_c': start_c.c:(.text+0xd4): undefined reference to 'main' collect2: error: ld returned 1 exit status
No Idea what to do...