提交 93b6b755 编写于 作者: K Kyle.Hu.GZ@gmail.com

Added scons scripts.

Rename and updated libcpu/avr32/uc3/exception.x (with .irp macro) to exception_gcc.S (without .irp macro) for better compatibility.

git-svn-id: https://rt-thread.googlecode.com/svn/trunk@1613 bbd45198-f89e-11dd-88c7-29a3b14d5316
上级 958e18b5
import rtconfig
Import('RTT_ROOT')
from building import *
src_bsp = ['application.c', 'startup.c', 'board.c']
src = File(src_bsp)
CPPPATH = [RTT_ROOT + '/bsp/avr32uc3b0']
group = DefineGroup('Startup', src, depend = [''], CPPPATH = CPPPATH)
Return('group')
import os
import sys
import rtconfig
RTT_ROOT = os.path.normpath(os.getcwd() + '/../..')
sys.path = sys.path + [os.path.join(RTT_ROOT, 'tools')]
from building import *
TARGET = 'rtthread-' + rtconfig.ARCH + '.' + rtconfig.TARGET_EXT
env = Environment(tools = ['mingw'],
AS = rtconfig.AS, ASFLAGS = rtconfig.AFLAGS,
CC = rtconfig.CC, CCFLAGS = rtconfig.CFLAGS,
AR = rtconfig.AR, ARFLAGS = '-rc',
LINK = rtconfig.LINK, LINKFLAGS = rtconfig.LFLAGS)
env.PrependENVPath('PATH', rtconfig.EXEC_PATH)
Export('RTT_ROOT')
Export('rtconfig')
# prepare building environment
objs = PrepareBuilding(env, RTT_ROOT)
# AVR32 software framework building script
objs = objs + SConscript(RTT_ROOT + '/bsp/avr32uc3b0/SOFTWARE_FRAMEWORK/SConscript', variant_dir='bsp/SOFTWARE_FRAMEWORK', duplicate=0)
# build program
env.Program(TARGET, objs)
# end building
EndBuilding(TARGET)
\ No newline at end of file
import rtconfig
Import('RTT_ROOT')
from building import *
cwd = GetCurrentDir()
src = Split("""
DRIVERS/FLASHC/flashc.c
DRIVERS/GPIO/gpio.c
DRIVERS/INTC/intc.c
DRIVERS/PM/pm.c
DRIVERS/PM/pm_conf_clocks.c
DRIVERS/PM/power_clocks_lib.c
DRIVERS/USART/usart.c
""")
CPPPATH = [
cwd + '/BOARDS',
cwd + '/UTILS',
cwd + '/UTILS/PREPROCESSOR',
cwd + '/DRIVERS/FLASHC',
cwd + '/DRIVERS/GPIO',
cwd + '/DRIVERS/INTC',
cwd + '/DRIVERS/PM',
cwd + '/DRIVERS/USART',
]
group = DefineGroup('Startup', src, depend = [''], CPPPATH = CPPPATH)
Return('group')
# toolchains options
ARCH = 'avr32'
CPU = 'uc3'
PART = 'uc3b0256'
BOARD = 'USERBOARD'
CROSS_TOOL = 'gcc'
if CROSS_TOOL == 'gcc':
PLATFORM = 'gcc'
EXEC_PATH = 'C:/Program Files/Atmel/AVR Tools/AVR Toolchain/bin'
#BUILD = 'debug'
BUILD = 'release'
if PLATFORM == 'gcc':
# toolchains
PREFIX = 'avr32-'
CC = PREFIX + 'gcc'
AS = PREFIX + 'gcc'
AR = PREFIX + 'ar'
LINK = PREFIX + 'gcc'
TARGET_EXT = 'elf'
SIZE = PREFIX + 'size'
OBJDUMP = PREFIX + 'objdump'
OBJCPY = PREFIX + 'objcopy'
DEVICE = ' -mpart=' + PART
CFLAGS = DEVICE + ' -DBOARD=' + BOARD + ' -fmessage-length=0 -ffunction-sections -masm-addr-pseudos'
AFLAGS = ' -c -x assembler-with-cpp' + DEVICE
LFLAGS = DEVICE + ' -Wl,--gc-sections --rodata-writable -Wl,--direct-data -LSOFTWARE_FRAMEWORK/UTILS/LIBS/NEWLIB_ADDONS -T avr32elf_uc3b0256.lds'
CPATH = ''
LPATH = ''
if BUILD == 'debug':
CFLAGS += ' -O0 -g3 -Wall'
AFLAGS += ' -g3'
else:
CFLAGS += ' -O2 -Wall'
POST_ACTION = OBJCPY + ' -O binary $TARGET rtthread.bin\n' + SIZE + ' $TARGET \n'
......@@ -193,12 +193,11 @@ _handle_Supervisor_Call:
.balign 4
.irp priority, 0, 1, 2, 3
_int\priority:
mov r12, \priority // Pass the int_level parameter to the _get_interrupt_handler function.
_int0:
mov r12, 0 // Pass the int_level parameter to the _get_interrupt_handler function.
call _get_interrupt_handler
cp.w r12, 0 // Get the pointer to the interrupt handler returned by the function.
breq _spint\priority // If this was not a spurious interrupt (R12 != NULL), jump to the handler.
breq _spint0 // If this was not a spurious interrupt (R12 != NULL), jump to the handler.
call rt_interrupt_enter
icall r12
call rt_interrupt_leave
......@@ -206,15 +205,81 @@ _int\priority:
lda.w r12, rt_interrupt_nest /* Is nested interrupt? */
ld.w r11, r12[0]
cp.w r11, 0
brne _spint\priority
brne _spint0
lda.w r12, rt_thread_switch_interrupt_flag /* Is thread switch required? */
ld.w r11, r12[0]
cp.w r11, 1
breq rt_hw_context_switch_interrupt_do
_spint\priority:
_spint0:
csrf AVR32_SR_GM_OFFSET /* Enable global interrupt */
rete // If this was a spurious interrupt (R12 == NULL), return from event handler.
.endr
_int1:
mov r12, 1 // Pass the int_level parameter to the _get_interrupt_handler function.
call _get_interrupt_handler
cp.w r12, 0 // Get the pointer to the interrupt handler returned by the function.
breq _spint1 // If this was not a spurious interrupt (R12 != NULL), jump to the handler.
call rt_interrupt_enter
icall r12
call rt_interrupt_leave
ssrf AVR32_SR_GM_OFFSET /* Disable global interrupt */
lda.w r12, rt_interrupt_nest /* Is nested interrupt? */
ld.w r11, r12[0]
cp.w r11, 0
brne _spint1
lda.w r12, rt_thread_switch_interrupt_flag /* Is thread switch required? */
ld.w r11, r12[0]
cp.w r11, 1
breq rt_hw_context_switch_interrupt_do
_spint1:
csrf AVR32_SR_GM_OFFSET /* Enable global interrupt */
rete // If this was a spurious interrupt (R12 == NULL), return from event handler.
_int2:
mov r12, 2 // Pass the int_level parameter to the _get_interrupt_handler function.
call _get_interrupt_handler
cp.w r12, 0 // Get the pointer to the interrupt handler returned by the function.
breq _spint2 // If this was not a spurious interrupt (R12 != NULL), jump to the handler.
call rt_interrupt_enter
icall r12
call rt_interrupt_leave
ssrf AVR32_SR_GM_OFFSET /* Disable global interrupt */
lda.w r12, rt_interrupt_nest /* Is nested interrupt? */
ld.w r11, r12[0]
cp.w r11, 0
brne _spint2
lda.w r12, rt_thread_switch_interrupt_flag /* Is thread switch required? */
ld.w r11, r12[0]
cp.w r11, 1
breq rt_hw_context_switch_interrupt_do
_spint2:
csrf AVR32_SR_GM_OFFSET /* Enable global interrupt */
rete // If this was a spurious interrupt (R12 == NULL), return from event handler.
_int3:
mov r12, 3 // Pass the int_level parameter to the _get_interrupt_handler function.
call _get_interrupt_handler
cp.w r12, 0 // Get the pointer to the interrupt handler returned by the function.
breq _spint3 // If this was not a spurious interrupt (R12 != NULL), jump to the handler.
call rt_interrupt_enter
icall r12
call rt_interrupt_leave
ssrf AVR32_SR_GM_OFFSET /* Disable global interrupt */
lda.w r12, rt_interrupt_nest /* Is nested interrupt? */
ld.w r11, r12[0]
cp.w r11, 0
brne _spint3
lda.w r12, rt_thread_switch_interrupt_flag /* Is thread switch required? */
ld.w r11, r12[0]
cp.w r11, 1
breq rt_hw_context_switch_interrupt_do
_spint3:
csrf AVR32_SR_GM_OFFSET /* Enable global interrupt */
rete // If this was a spurious interrupt (R12 == NULL), return from event handler.
rt_hw_context_switch_interrupt_do:
mov r11, 0
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册