Class: Lunchbox::Tasks::Environment
- Inherits:
-
Object
- Object
- Lunchbox::Tasks::Environment
- Includes:
- Rake::DSL
- Defined in:
- lib/lunchbox/tasks.rb
Constant Summary collapse
- C_DIR =
File. File.join(File.dirname(__FILE__), 'native')
- C_SRC =
File.join C_DIR, 'src'
- C_INC =
File.join C_DIR, 'include'
Instance Attribute Summary collapse
-
#cc ⇒ Object
Returns the value of attribute cc.
-
#cpu ⇒ Object
Returns the value of attribute cpu.
-
#cxx ⇒ Object
Returns the value of attribute cxx.
-
#mspdebug ⇒ Object
Returns the value of attribute mspdebug.
-
#objdump ⇒ Object
Returns the value of attribute objdump.
-
#size ⇒ Object
Returns the value of attribute size.
-
#src ⇒ Object
Returns the value of attribute src.
Instance Method Summary collapse
- #add_lib(f) ⇒ Object
- #add_src(f) ⇒ Object
- #cflags ⇒ Object
- #hardware_uart! ⇒ Object
- #have_crystal! ⇒ Object
- #includes ⇒ Object
-
#initialize ⇒ Environment
constructor
A new instance of Environment.
- #obj ⇒ Object
Constructor Details
#initialize ⇒ Environment
Returns a new instance of Environment.
17 18 19 20 21 22 23 24 25 26 27 28 |
# File 'lib/lunchbox/tasks.rb', line 17 def initialize @cpu = nil @cc = 'msp430-gcc' @cxx = 'msp430-g++' @objdump = 'msp430-objdump' @size = 'msp430-size' @mspdebug = 'mspdebug' @src = Rake::FileList.new @defines = [] define_tasks end |
Instance Attribute Details
#cc ⇒ Object
Returns the value of attribute cc.
11 12 13 |
# File 'lib/lunchbox/tasks.rb', line 11 def cc @cc end |
#cpu ⇒ Object
Returns the value of attribute cpu.
11 12 13 |
# File 'lib/lunchbox/tasks.rb', line 11 def cpu @cpu end |
#cxx ⇒ Object
Returns the value of attribute cxx.
11 12 13 |
# File 'lib/lunchbox/tasks.rb', line 11 def cxx @cxx end |
#mspdebug ⇒ Object
Returns the value of attribute mspdebug.
11 12 13 |
# File 'lib/lunchbox/tasks.rb', line 11 def mspdebug @mspdebug end |
#objdump ⇒ Object
Returns the value of attribute objdump.
11 12 13 |
# File 'lib/lunchbox/tasks.rb', line 11 def objdump @objdump end |
#size ⇒ Object
Returns the value of attribute size.
11 12 13 |
# File 'lib/lunchbox/tasks.rb', line 11 def size @size end |
#src ⇒ Object
Returns the value of attribute src.
11 12 13 |
# File 'lib/lunchbox/tasks.rb', line 11 def src @src end |
Instance Method Details
#add_lib(f) ⇒ Object
40 41 42 43 44 45 46 47 48 49 |
# File 'lib/lunchbox/tasks.rb', line 40 def add_lib f f = File.join(C_SRC, "#{f}.c") src << f file f t = Rake.application['build/main.elf'] t.prerequisites.concat obj t.prerequisites.uniq! end |
#add_src(f) ⇒ Object
30 31 32 33 34 35 36 37 38 |
# File 'lib/lunchbox/tasks.rb', line 30 def add_src f src << f file f t = Rake.application['build/main.elf'] t.prerequisites.concat obj t.prerequisites.uniq! end |
#cflags ⇒ Object
67 68 69 70 71 |
# File 'lib/lunchbox/tasks.rb', line 67 def cflags incs = includes.map { |i| "-I#{i}" }.join ' ' defines = @defines.map { |i| "-D#{i}" }.join ' ' [incs, defines, "-Os -Wall -g -mmcu=#{E.cpu}"].join ' ' end |
#hardware_uart! ⇒ Object
51 52 53 |
# File 'lib/lunchbox/tasks.rb', line 51 def hardware_uart! @defines << "HW_UART" end |
#have_crystal! ⇒ Object
55 56 57 |
# File 'lib/lunchbox/tasks.rb', line 55 def have_crystal! @defines << "HAVE_CRYSTAL" end |
#includes ⇒ Object
63 64 65 |
# File 'lib/lunchbox/tasks.rb', line 63 def includes [ '.', C_INC ] end |
#obj ⇒ Object
59 60 61 |
# File 'lib/lunchbox/tasks.rb', line 59 def obj src.ext('o').pathmap("build/%f") end |