Skip to content

Instantly share code, notes, and snippets.

@nuclearsandwich
Created May 28, 2018 19:54
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save nuclearsandwich/d18375a375acd703bf1687d97fe57d92 to your computer and use it in GitHub Desktop.
Save nuclearsandwich/d18375a375acd703bf1687d97fe57d92 to your computer and use it in GitHub Desktop.
CIRCUITRUBY_ROOT = File.expand_path "../..", __FILE__
ATMEL_START_DIR = File.join(CIRCUITRUBY_ROOT, "atmel-start-cpx")
MRuby::Build.new('host', "#{CIRCUITRUBY_ROOT}/build") do |conf|
toolchain :gcc
conf.bins =%w(mrbc)
end
MRuby::CrossBuild.new("arm-none-eabi-cpx", "#{CIRCUITRUBY_ROOT}/build") do |conf|
toolchain :gcc
conf.cc do |cc|
cc.command = "arm-none-eabi-gcc"
# Start with mruby parameters for low-memory environments.
# From upstream examples/targets/build_config_ArduinoDue.rb
cc.defines = %w(
MRB_HEAP_PAGE_SIZE=64
KHASH_DEFAULT_SIZE=8
MRB_STR_BUF_MIN_SIZE=20
)
cc.defines << %w(MRB_DISABLE_STDIO DISABLE_STDIO)
# Controller framework required definitions
cc.defines << %w(
__SAMD21G18A__
)
# CFLAGS from atmel start makefile.
cc.flags << %w(
-mthumb -Os -ffunction-sections -mlong-calls -g3 -Wall -c -std=gnu99
)
# Controller include paths.
cc.include_paths << %w(
config
hal/include
hal/utils/include
hpl/core
hpl/dmac
hpl/gclk
hpl/pm
hpk/port
hpl/sysctrl
hri
CMSIS/Include
samd21a/include
).map{|inc| File.join(ATMEL_START_DIR, inc) }
end
conf.bins = []
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment