Class: MTBuild::ToolchainArmNoneEabiGcc

Inherits:
ToolchainGcc show all
Defined in:
lib/mtbuild/toolchains/arm_none_eabi_gcc.rb

Overview

This ToolchainGcc subclass can build using arm-non-eabi-gcc

Instance Attribute Summary

Attributes inherited from ToolchainGcc

#asflags, #cflags, #cppflags, #cxxflags, #ldflags, #linker_script

Attributes inherited from Toolchain

#output_decorator, #output_folder, #parent_configuration, #project_folder

Instance Method Summary collapse

Methods inherited from ToolchainGcc

#create_compile_tasks, #create_static_library_tasks, #scan_sources

Methods included from DSL

#application_project, #framework_project, #mtfile, #static_library_project, #test_application_project, #toolchain, #workspace

Methods inherited from Toolchain

#add_include_objects, #add_include_paths, #add_library_paths, #create_compile_tasks, #create_static_library_tasks, #get_include_objects, #get_include_paths, #get_library_paths, #scan_sources

Methods included from Rake::DSL

#application_task, #framework_task, #static_library_task, #test_application_task

Constructor Details

#initialize(parent_configuration, toolchain_configuration) ⇒ ToolchainArmNoneEabiGcc

Returns a new instance of ToolchainArmNoneEabiGcc.



9
10
11
# File 'lib/mtbuild/toolchains/arm_none_eabi_gcc.rb', line 9

def initialize(parent_configuration, toolchain_configuration)
  super
end

Instance Method Details

#create_application_tasks(objects, executable_name) ⇒ Object

Create Rake tasks for linking



14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
# File 'lib/mtbuild/toolchains/arm_none_eabi_gcc.rb', line 14

def create_application_tasks(objects, executable_name)
  elf_file = File.join(@output_folder, "#{executable_name}#{@output_decorator}.elf")
  bin_file = File.join(@output_folder, "#{executable_name}#{@output_decorator}.bin")
  hex_file = File.join(@output_folder, "#{executable_name}#{@output_decorator}.hex")
  map_file = File.join(@output_folder, "#{executable_name}#{@output_decorator}.map")
  executable_folder = @output_folder

  unless @tracked_folders.include?executable_folder
    @tracked_folders << executable_folder
    directory executable_folder
    @parent_configuration.parent_project.add_files_to_clean(executable_folder)
  end

  @parent_configuration.parent_project.add_files_to_clean(elf_file, bin_file, hex_file, map_file)

  all_objects = objects+get_include_objects

  file elf_file => all_objects do |t|
    command_line = construct_link_command(all_objects, t.name, get_include_paths, get_library_paths, map_file)
    sh command_line
  end

  file map_file => elf_file

  file bin_file => elf_file do |t|
    command_line = construct_objcopy_command(elf_file, t.name, ' -Obinary')
    sh command_line
  end
  file hex_file => elf_file do |t|
    command_line = construct_objcopy_command(elf_file, t.name, ' -Oihex')
    sh command_line
  end

  return [elf_file, bin_file, hex_file], [map_file], [executable_folder]
end