sconsarduino
Differences
This shows you the differences between two versions of the page.
Both sides previous revisionPrevious revisionNext revision | Previous revision | ||
sconsarduino [2009/06/23 09:06] – suapapa | sconsarduino [2013/08/03 05:04] (current) – external edit 127.0.0.1 | ||
---|---|---|---|
Line 1: | Line 1: | ||
<code python> | <code python> | ||
- | """ | ||
# | # | ||
- | # | + | # Copyright |
# | # | ||
- | # | + | # 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 |
- | # | + | # (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. |
- | # | + | # |
- | # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, | + | # You should have received a copy of the GNU General Public License |
- | # MA 02110-1301, USA. | + | # along with this program. If not, see < |
- | """ | + | # |
+ | |||
+ | # | ||
+ | # 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" | ||
+ | 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> | ||
avr = Environment() | avr = Environment() | ||
Line 59: | Line 168: | ||
avr.Command(None, | avr.Command(None, | ||
</ | </ | ||
+ | 또다른 avr 환경설정 | ||
+ | <code python> | ||
+ | env.Append(CPPDEFINES = {' | ||
+ | env.Append(CCFLAGS = ' | ||
+ | env.Append(LINKFLAGS = ' | ||
+ | env[' | ||
+ | env[' | ||
+ | env[' | ||
+ | env[' | ||
+ | </ | ||
+ | ====== section garbage collection ====== | ||
+ | < | ||
+ | gcc -ffunction-sections -fdata-sections | ||
+ | ld --gc-sections | ||
+ | </ | ||
+ | *[[http:// | ||
+ | *[[http:// | ||
+ | |||
+ | ====== vim setting ====== | ||
+ | *copy [[http:// | ||
+ | *link pde extention to arduino syntax | ||
+ | <code vi> | ||
+ | au BufNewFile, | ||
+ | </ | ||
====== references ====== | ====== references ====== | ||
- | [[http:// | + | *[[http:// |
+ | *[[http:// |
sconsarduino.1245747979.txt.gz · Last modified: 2013/08/03 05:04 (external edit)