sconsarduino
Differences
This shows you the differences between two versions of the page.
Both sides previous revisionPrevious revisionNext revision | Previous revision | ||
sconsarduino [2009/08/12 07:48] – suapapa | sconsarduino [2013/08/03 05:04] (current) – external edit 127.0.0.1 | ||
---|---|---|---|
Line 1: | Line 1: | ||
+ | <code python> | ||
+ | # | ||
+ | # Copyright 2010 by Adam Mayer < | ||
+ | # | ||
+ | # This program is free software: you can redistribute it and/or modify | ||
+ | # it under the terms of the GNU General Public License as published by | ||
+ | # the Free Software Foundation, either version 3 of the License, or | ||
+ | # (at your option) any later version. | ||
+ | # | ||
+ | # This program is distributed in the hope that it will be useful, | ||
+ | # but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
+ | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. | ||
+ | # GNU General Public License for more details. | ||
+ | # | ||
+ | # You should have received a copy of the GNU General Public License | ||
+ | # along with this program. | ||
+ | # | ||
+ | |||
+ | # | ||
+ | # HOW TO USE THIS BUILD SCRIPT | ||
+ | # | ||
+ | # By default, this script will build the firmware for an atmega644p-based motherboard. | ||
+ | # The firmware will be built, but not uploaded. | ||
+ | # | ||
+ | # To build for another platform, pass an explicit platform parameter. | ||
+ | # $ scons platform=rrmbv12 | ||
+ | # $ scons platform=rrmbv22 | ||
+ | # | ||
+ | # To upload the firmware, specify the " | ||
+ | # / | ||
+ | # $ scons upload | ||
+ | # | ||
+ | # If you want to select a port manually, specify it as a parameter: | ||
+ | # $ scons port=/ | ||
+ | # | ||
+ | |||
+ | import os | ||
+ | import re | ||
+ | from os.path import dirname | ||
+ | # Parameters | ||
+ | platform = ARGUMENTS.get(' | ||
+ | f_cpu=' | ||
+ | |||
+ | default_baud = ' | ||
+ | mcu=' | ||
+ | has_queue = 0 | ||
+ | has_psu = 0 | ||
+ | |||
+ | def extract_version(f): | ||
+ | regex = re.compile(r" | ||
+ | for line in f.get_contents().split(' | ||
+ | mo = regex.match(line) | ||
+ | if mo: | ||
+ | return int(mo.group(1)) | ||
+ | return 0 | ||
+ | |||
+ | version = extract_version(File('#/ | ||
+ | |||
+ | if (platform == ' | ||
+ | default_baud = ' | ||
+ | mcu=' | ||
+ | has_queue = 1 | ||
+ | has_psu = 1 | ||
+ | elif (platform == ' | ||
+ | default_baud = ' | ||
+ | mcu=' | ||
+ | has_queue = 1 | ||
+ | has_psu = 0 | ||
+ | else: | ||
+ | print " | ||
+ | exit() | ||
+ | |||
+ | target_name = " | ||
+ | |||
+ | upload_port = ARGUMENTS.get(' | ||
+ | upload_baud = ARGUMENTS.get(' | ||
+ | upload_prog = ARGUMENTS.get(' | ||
+ | |||
+ | srcs = Glob(' | ||
+ | |||
+ | include_paths = ['#/ | ||
+ | |||
+ | flags=[ | ||
+ | ' | ||
+ | ' | ||
+ | ' | ||
+ | ' | ||
+ | ' | ||
+ | ' | ||
+ | ' | ||
+ | ' | ||
+ | |||
+ | if (os.environ.has_key(' | ||
+ | avr_tools_path = os.environ[' | ||
+ | else: | ||
+ | avr_tools_path = dirname(os.popen('/ | ||
+ | |||
+ | env=Environment(CC=avr_tools_path+"/ | ||
+ | CXX=avr_tools_path+"/ | ||
+ | CPPPATH=include_paths, | ||
+ | CCFLAGS=flags) | ||
+ | objs = env.Object(srcs) | ||
+ | |||
+ | # run_alias = Alias(' | ||
+ | # AlwaysBuild(run_alias) | ||
+ | |||
+ | hex_name = target_name + ' | ||
+ | elf_name = target_name + ' | ||
+ | |||
+ | env.Append(BUILDERS={' | ||
+ | env.Append(BUILDERS={' | ||
+ | env.Elf(elf_name, | ||
+ | env.Hex(hex_name, | ||
+ | |||
+ | avrdude = avr_tools_path+"/ | ||
+ | avrdude_flags = "-V -F -p " | ||
+ | avrdude_flags = avrdude_flags + " -P " | ||
+ | avrdude_flags = avrdude_flags + " -c " | ||
+ | avrdude_flags = avrdude_flags + " -b " | ||
+ | avrdude_command = " " | ||
+ | |||
+ | # env.Alias instead of just Alias because of | ||
+ | # http:// | ||
+ | upload_alias = env.Alias(' | ||
+ | AlwaysBuild(upload_alias) | ||
+ | </ | ||
<code python> | <code python> | ||
avr = Environment() | avr = Environment() | ||
Line 53: | Line 179: | ||
env[' | env[' | ||
</ | </ | ||
+ | ====== section garbage collection ====== | ||
+ | < | ||
+ | gcc -ffunction-sections -fdata-sections | ||
+ | ld --gc-sections | ||
+ | </ | ||
+ | *[[http:// | ||
+ | *[[http:// | ||
+ | |||
====== vim setting ====== | ====== vim setting ====== | ||
*copy [[http:// | *copy [[http:// | ||
Line 60: | Line 194: | ||
</ | </ | ||
====== references ====== | ====== references ====== | ||
- | [[http:// | + | *[[http:// |
+ | *[[http:// |
sconsarduino.1250063339.txt.gz · Last modified: 2013/08/03 05:04 (external edit)