Initial commit.
Signed-off-by: Yilin Sun <imi415@imi.moe>
This commit is contained in:
commit
9c5afa41ea
|
@ -0,0 +1,3 @@
|
|||
/config/*.lock
|
||||
/build
|
||||
/cmake-build-*
|
|
@ -0,0 +1,3 @@
|
|||
[submodule "mruby"]
|
||||
path = mruby
|
||||
url = https://github.com/mruby/mruby.git
|
|
@ -0,0 +1,28 @@
|
|||
cmake_minimum_required(VERSION 3.10)
|
||||
|
||||
project(mruby_mcux)
|
||||
|
||||
if(NOT DEFINED MRUBY_MCUX_TARGET)
|
||||
message(WARNING "MRUBY_MCUX_TARGET not defined, using default.")
|
||||
set(MRUBY_MCUX_TARGET imxrt10xx)
|
||||
endif()
|
||||
|
||||
add_custom_command(OUTPUT libmruby.a
|
||||
COMMAND "${CMAKE_COMMAND}" "-E" "env"
|
||||
"MRUBY_CONFIG=${CMAKE_CURRENT_SOURCE_DIR}/configs/${MRUBY_MCUX_TARGET}.rb"
|
||||
"MRUBY_BUILD_DIR=${CMAKE_CURRENT_BINARY_DIR}/mruby"
|
||||
"./minirake"
|
||||
|
||||
WORKING_DIRECTORY "${CMAKE_CURRENT_SOURCE_DIR}/mruby"
|
||||
)
|
||||
|
||||
add_custom_target(mruby
|
||||
DEPENDS "libmruby.a"
|
||||
)
|
||||
|
||||
set_target_properties(mruby PROPERTIES
|
||||
ADDITIONAL_CLEAN_FILES "${CMAKE_CURRENT_BINARY_DIR}/mruby"
|
||||
)
|
||||
|
||||
add_library(${PROJECT_NAME} INTERFACE)
|
||||
target_link_libraries(${PROJECT_NAME} INTERFACE mruby)
|
|
@ -0,0 +1,56 @@
|
|||
# Cross Compiling configuration for i.MXRT 1xxx (Cortex-M7)
|
||||
|
||||
MRuby::CrossBuild.new("imxrt1xxx") do |conf|
|
||||
toolchain :gcc
|
||||
|
||||
conf.cc do |cc|
|
||||
cc.command = "arm-none-eabi-gcc"
|
||||
cc.flags = "-mcpu=cortex-m7 -mthumb -mfloat-abi=hard -mfpu=fpv5-d16 -Wall -g -O2"
|
||||
cc.compile_options = %Q[%{flags} -o "%{outfile}" -c "%{infile}"]
|
||||
|
||||
#configuration for low memory environment
|
||||
cc.defines << %w(MRB_HEAP_PAGE_SIZE=64)
|
||||
cc.defines << %w(KHASH_DEFAULT_SIZE=8)
|
||||
cc.defines << %w(MRB_GC_STRESS)
|
||||
end
|
||||
|
||||
conf.cxx do |cxx|
|
||||
cxx.command = conf.cc.command.dup
|
||||
cxx.include_paths = conf.cc.include_paths.dup
|
||||
cxx.flags = conf.cc.flags.dup
|
||||
cxx.defines = conf.cc.defines.dup
|
||||
cxx.compile_options = conf.cc.compile_options.dup
|
||||
end
|
||||
|
||||
conf.linker do |linker|
|
||||
linker.command="arm-none-eabi-ld"
|
||||
end
|
||||
|
||||
conf.archiver do |archiver|
|
||||
archiver.command = "arm-none-eabi-ar"
|
||||
archiver.archive_options = 'rcs "%{outfile}" %{objs}'
|
||||
end
|
||||
|
||||
#no executables
|
||||
conf.bins = []
|
||||
|
||||
#do not build executable test
|
||||
conf.build_mrbtest_lib_only
|
||||
|
||||
#disable C++ exception
|
||||
conf.disable_cxx_exception
|
||||
|
||||
#gems from core
|
||||
conf.gem :core => "mruby-sprintf"
|
||||
conf.gem :core => "mruby-print"
|
||||
conf.gem :core => "mruby-math"
|
||||
conf.gem :core => "mruby-enum-ext"
|
||||
conf.gem :core => "mruby-numeric-ext"
|
||||
|
||||
#light-weight regular expression
|
||||
#conf.gem :github => "masamitsu-murase/mruby-hs-regexp", :branch => "master"
|
||||
|
||||
#Arduino API
|
||||
#conf.gem :github =>"kyab/mruby-arduino", :branch => "master"
|
||||
|
||||
end
|
|
@ -0,0 +1,59 @@
|
|||
# Cross Compiling configuration for RX630
|
||||
# http://gadget.renesas.com/
|
||||
#
|
||||
# Requires gnurx_v14.03
|
||||
MRuby::CrossBuild.new("lpc5500") do |conf|
|
||||
toolchain :gcc
|
||||
|
||||
conf.cc do |cc|
|
||||
cc.command = "arm-none-eabi-gcc"
|
||||
cc.flags = "-mcpu=cortex-m33 -mthumb -mfloat-abi=hard -mfpu=fpv5-sp-d16 -Wall -g -O2"
|
||||
cc.compile_options = %Q[%{flags} -o "%{outfile}" -c "%{infile}"]
|
||||
|
||||
#configuration for low memory environment
|
||||
cc.defines << %w(MRB_USE_FLOAT32)
|
||||
cc.defines << %w(MRB_HEAP_PAGE_SIZE=64)
|
||||
cc.defines << %w(KHASH_DEFAULT_SIZE=8)
|
||||
cc.defines << %w(MRB_GC_STRESS)
|
||||
end
|
||||
|
||||
conf.cxx do |cxx|
|
||||
cxx.command = conf.cc.command.dup
|
||||
cxx.include_paths = conf.cc.include_paths.dup
|
||||
cxx.flags = conf.cc.flags.dup
|
||||
cxx.defines = conf.cc.defines.dup
|
||||
cxx.compile_options = conf.cc.compile_options.dup
|
||||
end
|
||||
|
||||
conf.linker do |linker|
|
||||
linker.command="arm-none-eabi-ld"
|
||||
end
|
||||
|
||||
conf.archiver do |archiver|
|
||||
archiver.command = "arm-none-eabi-ar"
|
||||
archiver.archive_options = 'rcs "%{outfile}" %{objs}'
|
||||
end
|
||||
|
||||
#no executables
|
||||
conf.bins = []
|
||||
|
||||
#do not build executable test
|
||||
conf.build_mrbtest_lib_only
|
||||
|
||||
#disable C++ exception
|
||||
conf.disable_cxx_exception
|
||||
|
||||
#gems from core
|
||||
conf.gem :core => "mruby-sprintf"
|
||||
conf.gem :core => "mruby-print"
|
||||
conf.gem :core => "mruby-math"
|
||||
conf.gem :core => "mruby-enum-ext"
|
||||
conf.gem :core => "mruby-numeric-ext"
|
||||
|
||||
#light-weight regular expression
|
||||
#conf.gem :github => "masamitsu-murase/mruby-hs-regexp", :branch => "master"
|
||||
|
||||
#Arduino API
|
||||
#conf.gem :github =>"kyab/mruby-arduino", :branch => "master"
|
||||
|
||||
end
|
|
@ -0,0 +1 @@
|
|||
Subproject commit d7f4af04ca2c5d7caf377623b9a0c2f86e10e9e8
|
Loading…
Reference in New Issue