mirror of
https://github.com/ThrowTheSwitch/CMock.git
synced 2026-06-05 21:15:20 +00:00
Normalize all the line endings
This commit is contained in:
@@ -1,14 +1,14 @@
|
||||
# ==========================================
|
||||
# CMock Project - Automatic Mock Generation for C
|
||||
# Copyright (c) 2007 Mike Karlesky, Mark VanderVoord, Greg Williams
|
||||
# [Released under MIT License. Please refer to license.txt for details]
|
||||
# ==========================================
|
||||
|
||||
# Setup our load path:
|
||||
[
|
||||
'lib',
|
||||
].each do |dir|
|
||||
$LOAD_PATH.unshift( File.join( File.expand_path(File.dirname(__FILE__)) + '/../', dir) )
|
||||
end
|
||||
|
||||
|
||||
# ==========================================
|
||||
# CMock Project - Automatic Mock Generation for C
|
||||
# Copyright (c) 2007 Mike Karlesky, Mark VanderVoord, Greg Williams
|
||||
# [Released under MIT License. Please refer to license.txt for details]
|
||||
# ==========================================
|
||||
|
||||
# Setup our load path:
|
||||
[
|
||||
'lib',
|
||||
].each do |dir|
|
||||
$LOAD_PATH.unshift( File.join( File.expand_path(File.dirname(__FILE__)) + '/../', dir) )
|
||||
end
|
||||
|
||||
|
||||
|
||||
+16
-16
@@ -1,16 +1,16 @@
|
||||
# ==========================================
|
||||
# CMock Project - Automatic Mock Generation for C
|
||||
# Copyright (c) 2007 Mike Karlesky, Mark VanderVoord, Greg Williams
|
||||
# [Released under MIT License. Please refer to license.txt for details]
|
||||
# ==========================================
|
||||
|
||||
# Setup our load path:
|
||||
[
|
||||
'lib',
|
||||
'vendor/behaviors/lib',
|
||||
'vendor/hardmock/lib',
|
||||
'vendor/unity/auto/',
|
||||
'test/system/'
|
||||
].each do |dir|
|
||||
$LOAD_PATH.unshift( File.join( File.expand_path(File.dirname(__FILE__) + "/../"), dir) )
|
||||
end
|
||||
# ==========================================
|
||||
# CMock Project - Automatic Mock Generation for C
|
||||
# Copyright (c) 2007 Mike Karlesky, Mark VanderVoord, Greg Williams
|
||||
# [Released under MIT License. Please refer to license.txt for details]
|
||||
# ==========================================
|
||||
|
||||
# Setup our load path:
|
||||
[
|
||||
'lib',
|
||||
'vendor/behaviors/lib',
|
||||
'vendor/hardmock/lib',
|
||||
'vendor/unity/auto/',
|
||||
'test/system/'
|
||||
].each do |dir|
|
||||
$LOAD_PATH.unshift( File.join( File.expand_path(File.dirname(__FILE__) + "/../"), dir) )
|
||||
end
|
||||
|
||||
@@ -1,185 +1,185 @@
|
||||
// ----------------------------------------------------------------------------
|
||||
// ATMEL Microcontroller Software Support - ROUSSET -
|
||||
// ----------------------------------------------------------------------------
|
||||
// DISCLAIMER: THIS SOFTWARE IS PROVIDED BY ATMEL "AS IS" AND ANY EXPRESS OR
|
||||
// IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
|
||||
// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT ARE
|
||||
// DISCLAIMED. IN NO EVENT SHALL ATMEL BE LIABLE FOR ANY DIRECT, INDIRECT,
|
||||
// INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
|
||||
// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA,
|
||||
// OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
|
||||
// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
|
||||
// NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,
|
||||
// EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
// ----------------------------------------------------------------------------
|
||||
// File Name : at91SAM7X256_FLASH.xcl
|
||||
// Object : Generic Linker Command File for IAR
|
||||
// 1.0 30/Aug/05 FBr : Creation for 4.30A
|
||||
// ----------------------------------------------------------------------------
|
||||
|
||||
//*************************************************************************
|
||||
// XLINK command file template for EWARM/ICCARM
|
||||
//
|
||||
// Usage: xlink -f lnkarm <your_object_file(s)>
|
||||
// -s <program start label> <C/C++ runtime library>
|
||||
//*************************************************************************
|
||||
//
|
||||
// -------------
|
||||
// Code segments - may be placed anywhere in memory.
|
||||
// -------------
|
||||
//
|
||||
// INTVEC -- Exception vector table.
|
||||
// SWITAB -- Software interrupt vector table.
|
||||
// ICODE -- Startup (cstartup) and exception code.
|
||||
// DIFUNCT -- Dynamic initialization vectors used by C++.
|
||||
// CODE -- Compiler generated code.
|
||||
// CODE_I -- Compiler generated code declared __ramfunc (executes in RAM)
|
||||
// CODE_ID -- Initializer for CODE_I (ROM).
|
||||
//
|
||||
// -------------
|
||||
// Data segments - may be placed anywhere in memory.
|
||||
// -------------
|
||||
//
|
||||
// CSTACK -- The stack used by C/C++ programs (system and user mode).
|
||||
// IRQ_STACK -- The stack used by IRQ service routines.
|
||||
// SVC_STACK -- The stack used in supervisor mode
|
||||
// (Define other exception stacks as needed for
|
||||
// FIQ, ABT, UND).
|
||||
// HEAP -- The heap used by malloc and free in C and new and
|
||||
// delete in C++.
|
||||
// INITTAB -- Table containing addresses and sizes of segments that
|
||||
// need to be initialized at startup (by cstartup).
|
||||
// CHECKSUM -- The linker places checksum byte(s) in this segment,
|
||||
// when the -J linker command line option is used.
|
||||
// DATA_y -- Data objects.
|
||||
//
|
||||
// Where _y can be one of:
|
||||
//
|
||||
// _AN -- Holds uninitialized located objects, i.e. objects with
|
||||
// an absolute location given by the @ operator or the
|
||||
// #pragma location directive. Since these segments
|
||||
// contain objects which already have a fixed address,
|
||||
// they should not be mentioned in this linker command
|
||||
// file.
|
||||
// _C -- Constants (ROM).
|
||||
// _I -- Initialized data (RAM).
|
||||
// _ID -- The original content of _I (copied to _I by cstartup) (ROM).
|
||||
// _N -- Uninitialized data (RAM).
|
||||
// _Z -- Zero initialized data (RAM).
|
||||
//
|
||||
// Note: Be sure to use end values for the defined address ranges.
|
||||
// Otherwise, the linker may allocate space outside the
|
||||
// intended memory range.
|
||||
//*************************************************************************
|
||||
|
||||
//*************************************************************************
|
||||
// Inform the linker about the CPU family used.
|
||||
// AT91SAM7X256 Memory mapping
|
||||
// No remap
|
||||
// ROMSTART
|
||||
// Start address 0x0000 0000
|
||||
// Size 256 Kbo 0x0004 0000
|
||||
// RAMSTART
|
||||
// Start address 0x0020 0000
|
||||
// Size 64 Kbo 0x0001 0000
|
||||
// Remap done
|
||||
// RAMSTART
|
||||
// Start address 0x0000 0000
|
||||
// Size 64 Kbo 0x0001 0000
|
||||
// ROMSTART
|
||||
// Start address 0x0010 0000
|
||||
// Size 256 Kbo 0x0004 0000
|
||||
|
||||
//*************************************************************************
|
||||
-carm
|
||||
|
||||
//*************************************************************************
|
||||
// Internal Ram segments mapped AFTER REMAP 64 K.
|
||||
//*************************************************************************
|
||||
-Z(CONST)INTRAMSTART_REMAP=00200000
|
||||
-Z(CONST)INTRAMEND_REMAP=0020FFFF
|
||||
|
||||
//*************************************************************************
|
||||
// Read-only segments mapped to Flash 256 K.
|
||||
//*************************************************************************
|
||||
-DROMSTART=00000000
|
||||
-DROMEND=0003FFFF
|
||||
//*************************************************************************
|
||||
// Read/write segments mapped to 64 K RAM.
|
||||
//*************************************************************************
|
||||
-DRAMSTART=00200000
|
||||
-DRAMEND=0020FFFF
|
||||
|
||||
//*************************************************************************
|
||||
// Address range for reset and exception
|
||||
// vectors (INTVEC).
|
||||
// The vector area is 32 bytes,
|
||||
// an additional 32 bytes is allocated for the
|
||||
// constant table used by ldr PC in cstartup.s79.
|
||||
//*************************************************************************
|
||||
-Z(CODE)INTVEC=00-3F
|
||||
|
||||
//*************************************************************************
|
||||
// Startup code and exception routines (ICODE).
|
||||
//*************************************************************************
|
||||
-Z(CODE)ICODE,DIFUNCT=ROMSTART-ROMEND
|
||||
-Z(CODE)SWITAB=ROMSTART-ROMEND
|
||||
|
||||
//*************************************************************************
|
||||
// Code segments may be placed anywhere.
|
||||
//*************************************************************************
|
||||
-Z(CODE)CODE=ROMSTART-ROMEND
|
||||
|
||||
//*************************************************************************
|
||||
// Various constants and initializers.
|
||||
//*************************************************************************
|
||||
-Z(CONST)INITTAB,DATA_ID,DATA_C=ROMSTART-ROMEND
|
||||
-Z(CONST)CHECKSUM=ROMSTART-ROMEND
|
||||
|
||||
//*************************************************************************
|
||||
// Data segments.
|
||||
//*************************************************************************
|
||||
-Z(DATA)DATA_I,DATA_Z,DATA_N=RAMSTART-RAMEND
|
||||
|
||||
//*************************************************************************
|
||||
// __ramfunc code copied to and executed from RAM.
|
||||
//*************************************************************************
|
||||
-Z(DATA)CODE_I=RAMSTART-RAMEND
|
||||
-Z(CONST)CODE_ID=ROMSTART-ROMEND // Initializer for
|
||||
-QCODE_I=CODE_ID
|
||||
|
||||
//*************************************************************************
|
||||
// ICCARM produces code for __ramfunc functions in
|
||||
// CODE_I segments. The -Q XLINK command line
|
||||
// option redirects XLINK to emit the code in the
|
||||
// debug information associated with the CODE_I
|
||||
// segment, where the code will execute.
|
||||
//*************************************************************************
|
||||
|
||||
//*************************************************************************
|
||||
// Stack and heap segments.
|
||||
//*************************************************************************
|
||||
-D_CSTACK_SIZE=(100*4)
|
||||
-D_IRQ_STACK_SIZE=(3*8*4)
|
||||
-D_HEAP_SIZE=(1024*1)
|
||||
|
||||
-Z(DATA)CSTACK+_CSTACK_SIZE=RAMSTART-RAMEND
|
||||
-Z(DATA)IRQ_STACK+_IRQ_STACK_SIZE=RAMSTART-RAMEND
|
||||
-Z(DATA)HEAP+_HEAP_SIZE=RAMSTART-RAMEND
|
||||
|
||||
//*************************************************************************
|
||||
// ELF/DWARF support.
|
||||
//
|
||||
// Uncomment the line "-Felf" below to generate ELF/DWARF output.
|
||||
// Available format specifiers are:
|
||||
//
|
||||
// "-yn": Suppress DWARF debug output
|
||||
// "-yp": Multiple ELF program sections
|
||||
// "-yas": Format suitable for debuggers from ARM Ltd (also sets -p flag)
|
||||
//
|
||||
// "-Felf" and the format specifiers can also be supplied directly as
|
||||
// command line options, or selected from the Xlink Output tab in the
|
||||
// IAR Embedded Workbench.
|
||||
//*************************************************************************
|
||||
|
||||
// -Felf
|
||||
// ----------------------------------------------------------------------------
|
||||
// ATMEL Microcontroller Software Support - ROUSSET -
|
||||
// ----------------------------------------------------------------------------
|
||||
// DISCLAIMER: THIS SOFTWARE IS PROVIDED BY ATMEL "AS IS" AND ANY EXPRESS OR
|
||||
// IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
|
||||
// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT ARE
|
||||
// DISCLAIMED. IN NO EVENT SHALL ATMEL BE LIABLE FOR ANY DIRECT, INDIRECT,
|
||||
// INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
|
||||
// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA,
|
||||
// OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
|
||||
// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
|
||||
// NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,
|
||||
// EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
// ----------------------------------------------------------------------------
|
||||
// File Name : at91SAM7X256_FLASH.xcl
|
||||
// Object : Generic Linker Command File for IAR
|
||||
// 1.0 30/Aug/05 FBr : Creation for 4.30A
|
||||
// ----------------------------------------------------------------------------
|
||||
|
||||
//*************************************************************************
|
||||
// XLINK command file template for EWARM/ICCARM
|
||||
//
|
||||
// Usage: xlink -f lnkarm <your_object_file(s)>
|
||||
// -s <program start label> <C/C++ runtime library>
|
||||
//*************************************************************************
|
||||
//
|
||||
// -------------
|
||||
// Code segments - may be placed anywhere in memory.
|
||||
// -------------
|
||||
//
|
||||
// INTVEC -- Exception vector table.
|
||||
// SWITAB -- Software interrupt vector table.
|
||||
// ICODE -- Startup (cstartup) and exception code.
|
||||
// DIFUNCT -- Dynamic initialization vectors used by C++.
|
||||
// CODE -- Compiler generated code.
|
||||
// CODE_I -- Compiler generated code declared __ramfunc (executes in RAM)
|
||||
// CODE_ID -- Initializer for CODE_I (ROM).
|
||||
//
|
||||
// -------------
|
||||
// Data segments - may be placed anywhere in memory.
|
||||
// -------------
|
||||
//
|
||||
// CSTACK -- The stack used by C/C++ programs (system and user mode).
|
||||
// IRQ_STACK -- The stack used by IRQ service routines.
|
||||
// SVC_STACK -- The stack used in supervisor mode
|
||||
// (Define other exception stacks as needed for
|
||||
// FIQ, ABT, UND).
|
||||
// HEAP -- The heap used by malloc and free in C and new and
|
||||
// delete in C++.
|
||||
// INITTAB -- Table containing addresses and sizes of segments that
|
||||
// need to be initialized at startup (by cstartup).
|
||||
// CHECKSUM -- The linker places checksum byte(s) in this segment,
|
||||
// when the -J linker command line option is used.
|
||||
// DATA_y -- Data objects.
|
||||
//
|
||||
// Where _y can be one of:
|
||||
//
|
||||
// _AN -- Holds uninitialized located objects, i.e. objects with
|
||||
// an absolute location given by the @ operator or the
|
||||
// #pragma location directive. Since these segments
|
||||
// contain objects which already have a fixed address,
|
||||
// they should not be mentioned in this linker command
|
||||
// file.
|
||||
// _C -- Constants (ROM).
|
||||
// _I -- Initialized data (RAM).
|
||||
// _ID -- The original content of _I (copied to _I by cstartup) (ROM).
|
||||
// _N -- Uninitialized data (RAM).
|
||||
// _Z -- Zero initialized data (RAM).
|
||||
//
|
||||
// Note: Be sure to use end values for the defined address ranges.
|
||||
// Otherwise, the linker may allocate space outside the
|
||||
// intended memory range.
|
||||
//*************************************************************************
|
||||
|
||||
//*************************************************************************
|
||||
// Inform the linker about the CPU family used.
|
||||
// AT91SAM7X256 Memory mapping
|
||||
// No remap
|
||||
// ROMSTART
|
||||
// Start address 0x0000 0000
|
||||
// Size 256 Kbo 0x0004 0000
|
||||
// RAMSTART
|
||||
// Start address 0x0020 0000
|
||||
// Size 64 Kbo 0x0001 0000
|
||||
// Remap done
|
||||
// RAMSTART
|
||||
// Start address 0x0000 0000
|
||||
// Size 64 Kbo 0x0001 0000
|
||||
// ROMSTART
|
||||
// Start address 0x0010 0000
|
||||
// Size 256 Kbo 0x0004 0000
|
||||
|
||||
//*************************************************************************
|
||||
-carm
|
||||
|
||||
//*************************************************************************
|
||||
// Internal Ram segments mapped AFTER REMAP 64 K.
|
||||
//*************************************************************************
|
||||
-Z(CONST)INTRAMSTART_REMAP=00200000
|
||||
-Z(CONST)INTRAMEND_REMAP=0020FFFF
|
||||
|
||||
//*************************************************************************
|
||||
// Read-only segments mapped to Flash 256 K.
|
||||
//*************************************************************************
|
||||
-DROMSTART=00000000
|
||||
-DROMEND=0003FFFF
|
||||
//*************************************************************************
|
||||
// Read/write segments mapped to 64 K RAM.
|
||||
//*************************************************************************
|
||||
-DRAMSTART=00200000
|
||||
-DRAMEND=0020FFFF
|
||||
|
||||
//*************************************************************************
|
||||
// Address range for reset and exception
|
||||
// vectors (INTVEC).
|
||||
// The vector area is 32 bytes,
|
||||
// an additional 32 bytes is allocated for the
|
||||
// constant table used by ldr PC in cstartup.s79.
|
||||
//*************************************************************************
|
||||
-Z(CODE)INTVEC=00-3F
|
||||
|
||||
//*************************************************************************
|
||||
// Startup code and exception routines (ICODE).
|
||||
//*************************************************************************
|
||||
-Z(CODE)ICODE,DIFUNCT=ROMSTART-ROMEND
|
||||
-Z(CODE)SWITAB=ROMSTART-ROMEND
|
||||
|
||||
//*************************************************************************
|
||||
// Code segments may be placed anywhere.
|
||||
//*************************************************************************
|
||||
-Z(CODE)CODE=ROMSTART-ROMEND
|
||||
|
||||
//*************************************************************************
|
||||
// Various constants and initializers.
|
||||
//*************************************************************************
|
||||
-Z(CONST)INITTAB,DATA_ID,DATA_C=ROMSTART-ROMEND
|
||||
-Z(CONST)CHECKSUM=ROMSTART-ROMEND
|
||||
|
||||
//*************************************************************************
|
||||
// Data segments.
|
||||
//*************************************************************************
|
||||
-Z(DATA)DATA_I,DATA_Z,DATA_N=RAMSTART-RAMEND
|
||||
|
||||
//*************************************************************************
|
||||
// __ramfunc code copied to and executed from RAM.
|
||||
//*************************************************************************
|
||||
-Z(DATA)CODE_I=RAMSTART-RAMEND
|
||||
-Z(CONST)CODE_ID=ROMSTART-ROMEND // Initializer for
|
||||
-QCODE_I=CODE_ID
|
||||
|
||||
//*************************************************************************
|
||||
// ICCARM produces code for __ramfunc functions in
|
||||
// CODE_I segments. The -Q XLINK command line
|
||||
// option redirects XLINK to emit the code in the
|
||||
// debug information associated with the CODE_I
|
||||
// segment, where the code will execute.
|
||||
//*************************************************************************
|
||||
|
||||
//*************************************************************************
|
||||
// Stack and heap segments.
|
||||
//*************************************************************************
|
||||
-D_CSTACK_SIZE=(100*4)
|
||||
-D_IRQ_STACK_SIZE=(3*8*4)
|
||||
-D_HEAP_SIZE=(1024*1)
|
||||
|
||||
-Z(DATA)CSTACK+_CSTACK_SIZE=RAMSTART-RAMEND
|
||||
-Z(DATA)IRQ_STACK+_IRQ_STACK_SIZE=RAMSTART-RAMEND
|
||||
-Z(DATA)HEAP+_HEAP_SIZE=RAMSTART-RAMEND
|
||||
|
||||
//*************************************************************************
|
||||
// ELF/DWARF support.
|
||||
//
|
||||
// Uncomment the line "-Felf" below to generate ELF/DWARF output.
|
||||
// Available format specifiers are:
|
||||
//
|
||||
// "-yn": Suppress DWARF debug output
|
||||
// "-yp": Multiple ELF program sections
|
||||
// "-yas": Format suitable for debuggers from ARM Ltd (also sets -p flag)
|
||||
//
|
||||
// "-Felf" and the format specifiers can also be supplied directly as
|
||||
// command line options, or selected from the Xlink Output tab in the
|
||||
// IAR Embedded Workbench.
|
||||
//*************************************************************************
|
||||
|
||||
// -Felf
|
||||
|
||||
@@ -1,185 +1,185 @@
|
||||
// ----------------------------------------------------------------------------
|
||||
// ATMEL Microcontroller Software Support - ROUSSET -
|
||||
// ----------------------------------------------------------------------------
|
||||
// DISCLAIMER: THIS SOFTWARE IS PROVIDED BY ATMEL "AS IS" AND ANY EXPRESS OR
|
||||
// IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
|
||||
// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT ARE
|
||||
// DISCLAIMED. IN NO EVENT SHALL ATMEL BE LIABLE FOR ANY DIRECT, INDIRECT,
|
||||
// INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
|
||||
// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA,
|
||||
// OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
|
||||
// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
|
||||
// NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,
|
||||
// EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
// ----------------------------------------------------------------------------
|
||||
// File Name : at91SAM7X256_RAM.xcl
|
||||
// Object : Generic Linker Command File for IAR
|
||||
// 1.0 30/Aug/05 FBr : Creation for 4.30A
|
||||
// ----------------------------------------------------------------------------
|
||||
|
||||
//*************************************************************************
|
||||
// XLINK command file template for EWARM/ICCARM
|
||||
//
|
||||
// Usage: xlink -f lnkarm <your_object_file(s)>
|
||||
// -s <program start label> <C/C++ runtime library>
|
||||
//*************************************************************************
|
||||
//
|
||||
// -------------
|
||||
// Code segments - may be placed anywhere in memory.
|
||||
// -------------
|
||||
//
|
||||
// INTVEC -- Exception vector table.
|
||||
// SWITAB -- Software interrupt vector table.
|
||||
// ICODE -- Startup (cstartup) and exception code.
|
||||
// DIFUNCT -- Dynamic initialization vectors used by C++.
|
||||
// CODE -- Compiler generated code.
|
||||
// CODE_I -- Compiler generated code declared __ramfunc (executes in RAM)
|
||||
// CODE_ID -- Initializer for CODE_I (ROM).
|
||||
//
|
||||
// -------------
|
||||
// Data segments - may be placed anywhere in memory.
|
||||
// -------------
|
||||
//
|
||||
// CSTACK -- The stack used by C/C++ programs (system and user mode).
|
||||
// IRQ_STACK -- The stack used by IRQ service routines.
|
||||
// SVC_STACK -- The stack used in supervisor mode
|
||||
// (Define other exception stacks as needed for
|
||||
// FIQ, ABT, UND).
|
||||
// HEAP -- The heap used by malloc and free in C and new and
|
||||
// delete in C++.
|
||||
// INITTAB -- Table containing addresses and sizes of segments that
|
||||
// need to be initialized at startup (by cstartup).
|
||||
// CHECKSUM -- The linker places checksum byte(s) in this segment,
|
||||
// when the -J linker command line option is used.
|
||||
// DATA_y -- Data objects.
|
||||
//
|
||||
// Where _y can be one of:
|
||||
//
|
||||
// _AN -- Holds uninitialized located objects, i.e. objects with
|
||||
// an absolute location given by the @ operator or the
|
||||
// #pragma location directive. Since these segments
|
||||
// contain objects which already have a fixed address,
|
||||
// they should not be mentioned in this linker command
|
||||
// file.
|
||||
// _C -- Constants (ROM).
|
||||
// _I -- Initialized data (RAM).
|
||||
// _ID -- The original content of _I (copied to _I by cstartup) (ROM).
|
||||
// _N -- Uninitialized data (RAM).
|
||||
// _Z -- Zero initialized data (RAM).
|
||||
//
|
||||
// Note: Be sure to use end values for the defined address ranges.
|
||||
// Otherwise, the linker may allocate space outside the
|
||||
// intended memory range.
|
||||
//*************************************************************************
|
||||
|
||||
//*************************************************************************
|
||||
// Inform the linker about the CPU family used.
|
||||
// AT91SAM7X256 Memory mapping
|
||||
// No remap
|
||||
// ROMSTART
|
||||
// Start address 0x0000 0000
|
||||
// Size 256 Kbo 0x0004 0000
|
||||
// RAMSTART
|
||||
// Start address 0x0020 0000
|
||||
// Size 64 Kbo 0x0001 0000
|
||||
// Remap done
|
||||
// RAMSTART
|
||||
// Start address 0x0000 0000
|
||||
// Size 64 Kbo 0x0001 0000
|
||||
// ROMSTART
|
||||
// Start address 0x0010 0000
|
||||
// Size 256 Kbo 0x0004 0000
|
||||
|
||||
//*************************************************************************
|
||||
-carm
|
||||
|
||||
//*************************************************************************
|
||||
// Internal Ram segments mapped AFTER REMAP 64 K.
|
||||
//*************************************************************************
|
||||
-Z(CONST)INTRAMSTART_REMAP=00000000
|
||||
-Z(CONST)INTRAMEND_REMAP=0000FFFF
|
||||
|
||||
//*************************************************************************
|
||||
// Read-only segments mapped to Flash 256 K.
|
||||
//*************************************************************************
|
||||
-DROMSTART=00000000
|
||||
-DROMEND=0003FFFF
|
||||
//*************************************************************************
|
||||
// Read/write segments mapped to 64 K RAM.
|
||||
//*************************************************************************
|
||||
-DRAMSTART=00000000
|
||||
-DRAMEND=0000FFFF
|
||||
|
||||
//*************************************************************************
|
||||
// Address range for reset and exception
|
||||
// vectors (INTVEC).
|
||||
// The vector area is 32 bytes,
|
||||
// an additional 32 bytes is allocated for the
|
||||
// constant table used by ldr PC in cstartup.s79.
|
||||
//*************************************************************************
|
||||
-Z(CODE)INTVEC=00-3F
|
||||
|
||||
//*************************************************************************
|
||||
// Startup code and exception routines (ICODE).
|
||||
//*************************************************************************
|
||||
-Z(CODE)ICODE,DIFUNCT=ROMSTART-ROMEND
|
||||
-Z(CODE)SWITAB=ROMSTART-ROMEND
|
||||
|
||||
//*************************************************************************
|
||||
// Code segments may be placed anywhere.
|
||||
//*************************************************************************
|
||||
-Z(CODE)CODE=ROMSTART-ROMEND
|
||||
|
||||
//*************************************************************************
|
||||
// Various constants and initializers.
|
||||
//*************************************************************************
|
||||
-Z(CONST)INITTAB,DATA_ID,DATA_C=ROMSTART-ROMEND
|
||||
-Z(CONST)CHECKSUM=ROMSTART-ROMEND
|
||||
|
||||
//*************************************************************************
|
||||
// Data segments.
|
||||
//*************************************************************************
|
||||
-Z(DATA)DATA_I,DATA_Z,DATA_N=RAMSTART-RAMEND
|
||||
|
||||
//*************************************************************************
|
||||
// __ramfunc code copied to and executed from RAM.
|
||||
//*************************************************************************
|
||||
-Z(DATA)CODE_I=RAMSTART-RAMEND
|
||||
-Z(CONST)CODE_ID=ROMSTART-ROMEND // Initializer for
|
||||
-QCODE_I=CODE_ID
|
||||
|
||||
//*************************************************************************
|
||||
// ICCARM produces code for __ramfunc functions in
|
||||
// CODE_I segments. The -Q XLINK command line
|
||||
// option redirects XLINK to emit the code in the
|
||||
// debug information associated with the CODE_I
|
||||
// segment, where the code will execute.
|
||||
//*************************************************************************
|
||||
|
||||
//*************************************************************************
|
||||
// Stack and heap segments.
|
||||
//*************************************************************************
|
||||
-D_CSTACK_SIZE=(100*4)
|
||||
-D_IRQ_STACK_SIZE=(3*8*4)
|
||||
-D_HEAP_SIZE=(1024*2)
|
||||
|
||||
-Z(DATA)CSTACK+_CSTACK_SIZE=RAMSTART-RAMEND
|
||||
-Z(DATA)IRQ_STACK+_IRQ_STACK_SIZE=RAMSTART-RAMEND
|
||||
-Z(DATA)HEAP+_HEAP_SIZE=RAMSTART-RAMEND
|
||||
|
||||
//*************************************************************************
|
||||
// ELF/DWARF support.
|
||||
//
|
||||
// Uncomment the line "-Felf" below to generate ELF/DWARF output.
|
||||
// Available format specifiers are:
|
||||
//
|
||||
// "-yn": Suppress DWARF debug output
|
||||
// "-yp": Multiple ELF program sections
|
||||
// "-yas": Format suitable for debuggers from ARM Ltd (also sets -p flag)
|
||||
//
|
||||
// "-Felf" and the format specifiers can also be supplied directly as
|
||||
// command line options, or selected from the Xlink Output tab in the
|
||||
// IAR Embedded Workbench.
|
||||
//*************************************************************************
|
||||
|
||||
// -Felf
|
||||
// ----------------------------------------------------------------------------
|
||||
// ATMEL Microcontroller Software Support - ROUSSET -
|
||||
// ----------------------------------------------------------------------------
|
||||
// DISCLAIMER: THIS SOFTWARE IS PROVIDED BY ATMEL "AS IS" AND ANY EXPRESS OR
|
||||
// IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
|
||||
// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT ARE
|
||||
// DISCLAIMED. IN NO EVENT SHALL ATMEL BE LIABLE FOR ANY DIRECT, INDIRECT,
|
||||
// INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
|
||||
// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA,
|
||||
// OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
|
||||
// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
|
||||
// NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,
|
||||
// EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
// ----------------------------------------------------------------------------
|
||||
// File Name : at91SAM7X256_RAM.xcl
|
||||
// Object : Generic Linker Command File for IAR
|
||||
// 1.0 30/Aug/05 FBr : Creation for 4.30A
|
||||
// ----------------------------------------------------------------------------
|
||||
|
||||
//*************************************************************************
|
||||
// XLINK command file template for EWARM/ICCARM
|
||||
//
|
||||
// Usage: xlink -f lnkarm <your_object_file(s)>
|
||||
// -s <program start label> <C/C++ runtime library>
|
||||
//*************************************************************************
|
||||
//
|
||||
// -------------
|
||||
// Code segments - may be placed anywhere in memory.
|
||||
// -------------
|
||||
//
|
||||
// INTVEC -- Exception vector table.
|
||||
// SWITAB -- Software interrupt vector table.
|
||||
// ICODE -- Startup (cstartup) and exception code.
|
||||
// DIFUNCT -- Dynamic initialization vectors used by C++.
|
||||
// CODE -- Compiler generated code.
|
||||
// CODE_I -- Compiler generated code declared __ramfunc (executes in RAM)
|
||||
// CODE_ID -- Initializer for CODE_I (ROM).
|
||||
//
|
||||
// -------------
|
||||
// Data segments - may be placed anywhere in memory.
|
||||
// -------------
|
||||
//
|
||||
// CSTACK -- The stack used by C/C++ programs (system and user mode).
|
||||
// IRQ_STACK -- The stack used by IRQ service routines.
|
||||
// SVC_STACK -- The stack used in supervisor mode
|
||||
// (Define other exception stacks as needed for
|
||||
// FIQ, ABT, UND).
|
||||
// HEAP -- The heap used by malloc and free in C and new and
|
||||
// delete in C++.
|
||||
// INITTAB -- Table containing addresses and sizes of segments that
|
||||
// need to be initialized at startup (by cstartup).
|
||||
// CHECKSUM -- The linker places checksum byte(s) in this segment,
|
||||
// when the -J linker command line option is used.
|
||||
// DATA_y -- Data objects.
|
||||
//
|
||||
// Where _y can be one of:
|
||||
//
|
||||
// _AN -- Holds uninitialized located objects, i.e. objects with
|
||||
// an absolute location given by the @ operator or the
|
||||
// #pragma location directive. Since these segments
|
||||
// contain objects which already have a fixed address,
|
||||
// they should not be mentioned in this linker command
|
||||
// file.
|
||||
// _C -- Constants (ROM).
|
||||
// _I -- Initialized data (RAM).
|
||||
// _ID -- The original content of _I (copied to _I by cstartup) (ROM).
|
||||
// _N -- Uninitialized data (RAM).
|
||||
// _Z -- Zero initialized data (RAM).
|
||||
//
|
||||
// Note: Be sure to use end values for the defined address ranges.
|
||||
// Otherwise, the linker may allocate space outside the
|
||||
// intended memory range.
|
||||
//*************************************************************************
|
||||
|
||||
//*************************************************************************
|
||||
// Inform the linker about the CPU family used.
|
||||
// AT91SAM7X256 Memory mapping
|
||||
// No remap
|
||||
// ROMSTART
|
||||
// Start address 0x0000 0000
|
||||
// Size 256 Kbo 0x0004 0000
|
||||
// RAMSTART
|
||||
// Start address 0x0020 0000
|
||||
// Size 64 Kbo 0x0001 0000
|
||||
// Remap done
|
||||
// RAMSTART
|
||||
// Start address 0x0000 0000
|
||||
// Size 64 Kbo 0x0001 0000
|
||||
// ROMSTART
|
||||
// Start address 0x0010 0000
|
||||
// Size 256 Kbo 0x0004 0000
|
||||
|
||||
//*************************************************************************
|
||||
-carm
|
||||
|
||||
//*************************************************************************
|
||||
// Internal Ram segments mapped AFTER REMAP 64 K.
|
||||
//*************************************************************************
|
||||
-Z(CONST)INTRAMSTART_REMAP=00000000
|
||||
-Z(CONST)INTRAMEND_REMAP=0000FFFF
|
||||
|
||||
//*************************************************************************
|
||||
// Read-only segments mapped to Flash 256 K.
|
||||
//*************************************************************************
|
||||
-DROMSTART=00000000
|
||||
-DROMEND=0003FFFF
|
||||
//*************************************************************************
|
||||
// Read/write segments mapped to 64 K RAM.
|
||||
//*************************************************************************
|
||||
-DRAMSTART=00000000
|
||||
-DRAMEND=0000FFFF
|
||||
|
||||
//*************************************************************************
|
||||
// Address range for reset and exception
|
||||
// vectors (INTVEC).
|
||||
// The vector area is 32 bytes,
|
||||
// an additional 32 bytes is allocated for the
|
||||
// constant table used by ldr PC in cstartup.s79.
|
||||
//*************************************************************************
|
||||
-Z(CODE)INTVEC=00-3F
|
||||
|
||||
//*************************************************************************
|
||||
// Startup code and exception routines (ICODE).
|
||||
//*************************************************************************
|
||||
-Z(CODE)ICODE,DIFUNCT=ROMSTART-ROMEND
|
||||
-Z(CODE)SWITAB=ROMSTART-ROMEND
|
||||
|
||||
//*************************************************************************
|
||||
// Code segments may be placed anywhere.
|
||||
//*************************************************************************
|
||||
-Z(CODE)CODE=ROMSTART-ROMEND
|
||||
|
||||
//*************************************************************************
|
||||
// Various constants and initializers.
|
||||
//*************************************************************************
|
||||
-Z(CONST)INITTAB,DATA_ID,DATA_C=ROMSTART-ROMEND
|
||||
-Z(CONST)CHECKSUM=ROMSTART-ROMEND
|
||||
|
||||
//*************************************************************************
|
||||
// Data segments.
|
||||
//*************************************************************************
|
||||
-Z(DATA)DATA_I,DATA_Z,DATA_N=RAMSTART-RAMEND
|
||||
|
||||
//*************************************************************************
|
||||
// __ramfunc code copied to and executed from RAM.
|
||||
//*************************************************************************
|
||||
-Z(DATA)CODE_I=RAMSTART-RAMEND
|
||||
-Z(CONST)CODE_ID=ROMSTART-ROMEND // Initializer for
|
||||
-QCODE_I=CODE_ID
|
||||
|
||||
//*************************************************************************
|
||||
// ICCARM produces code for __ramfunc functions in
|
||||
// CODE_I segments. The -Q XLINK command line
|
||||
// option redirects XLINK to emit the code in the
|
||||
// debug information associated with the CODE_I
|
||||
// segment, where the code will execute.
|
||||
//*************************************************************************
|
||||
|
||||
//*************************************************************************
|
||||
// Stack and heap segments.
|
||||
//*************************************************************************
|
||||
-D_CSTACK_SIZE=(100*4)
|
||||
-D_IRQ_STACK_SIZE=(3*8*4)
|
||||
-D_HEAP_SIZE=(1024*2)
|
||||
|
||||
-Z(DATA)CSTACK+_CSTACK_SIZE=RAMSTART-RAMEND
|
||||
-Z(DATA)IRQ_STACK+_IRQ_STACK_SIZE=RAMSTART-RAMEND
|
||||
-Z(DATA)HEAP+_HEAP_SIZE=RAMSTART-RAMEND
|
||||
|
||||
//*************************************************************************
|
||||
// ELF/DWARF support.
|
||||
//
|
||||
// Uncomment the line "-Felf" below to generate ELF/DWARF output.
|
||||
// Available format specifiers are:
|
||||
//
|
||||
// "-yn": Suppress DWARF debug output
|
||||
// "-yp": Multiple ELF program sections
|
||||
// "-yas": Format suitable for debuggers from ARM Ltd (also sets -p flag)
|
||||
//
|
||||
// "-Felf" and the format specifiers can also be supplied directly as
|
||||
// command line options, or selected from the Xlink Output tab in the
|
||||
// IAR Embedded Workbench.
|
||||
//*************************************************************************
|
||||
|
||||
// -Felf
|
||||
|
||||
+2259
-2259
File diff suppressed because it is too large
Load Diff
+3691
-3691
File diff suppressed because it is too large
Load Diff
+2581
-2581
File diff suppressed because it is too large
Load Diff
@@ -1,61 +1,61 @@
|
||||
// ----------------------------------------------------------------------------
|
||||
// ATMEL Microcontroller Software Support - ROUSSET -
|
||||
// ----------------------------------------------------------------------------
|
||||
// DISCLAIMER: THIS SOFTWARE IS PROVIDED BY ATMEL "AS IS" AND ANY EXPRESS OR
|
||||
// IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
|
||||
// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT ARE
|
||||
// DISCLAIMED. IN NO EVENT SHALL ATMEL BE LIABLE FOR ANY DIRECT, INDIRECT,
|
||||
// INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
|
||||
// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA,
|
||||
// OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
|
||||
// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
|
||||
// NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,
|
||||
// EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
// ----------------------------------------------------------------------------
|
||||
// File Name : AT91SAM7X-EK.h
|
||||
// Object : AT91SAM7X-EK Evaluation Board Features Definition File
|
||||
//
|
||||
// ----------------------------------------------------------------------------
|
||||
|
||||
#ifndef AT91SAM7X_EK_H
|
||||
#define AT91SAM7X_EK_H
|
||||
|
||||
/*-----------------*/
|
||||
/* LEDs Definition */
|
||||
/*-----------------*/
|
||||
#define AT91B_LED1 (1<<19) // AT91C_PIO_PB19 AT91C_PB19_PWM0 AT91C_PB19_TCLK1
|
||||
#define AT91B_LED2 (1<<20) // AT91C_PIO_PB20 AT91C_PB20_PWM1 AT91C_PB20_PWM1
|
||||
#define AT91B_LED3 (AT91C_PIO_PB21) // AT91C_PIO_PB21 AT91C_PB21_PWM2 AT91C_PB21_PCK1
|
||||
#define AT91B_LED4 (AT91C_PIO_PB22) // AT91C_PIO_PB22 AT91C_PB22_PWM3 AT91C_PB22_PCK2
|
||||
#define AT91B_NB_LEB 4
|
||||
#define AT91B_LED_MASK (AT91B_LED1|AT91B_LED2|AT91B_LED3|AT91B_LED4)
|
||||
#define AT91D_BASE_PIO_LED (AT91C_BASE_PIOB)
|
||||
|
||||
#define AT91B_POWERLED (1<<25) // PB25
|
||||
|
||||
|
||||
/*-------------------------------*/
|
||||
/* JOYSTICK Position Definition */
|
||||
/*-------------------------------*/
|
||||
#define AT91B_SW1 (1<<21) // PA21 Up Button AT91C_PA21_TF AT91C_PA21_NPCS10
|
||||
#define AT91B_SW2 (1<<22) // PA22 Down Button AT91C_PA22_TK AT91C_PA22_SPCK1
|
||||
#define AT91B_SW3 (1<<23) // PA23 Left Button AT91C_PA23_TD AT91C_PA23_MOSI1
|
||||
#define AT91B_SW4 (1<<24) // PA24 Right Button AT91C_PA24_RD AT91C_PA24_MISO1
|
||||
#define AT91B_SW5 (1<<25) // PA25 Push Button AT91C_PA25_RK AT91C_PA25_NPCS11
|
||||
#define AT91B_SW_MASK (AT91B_SW1|AT91B_SW2|AT91B_SW3|AT91B_SW4|AT91B_SW5)
|
||||
|
||||
|
||||
#define AT91D_BASE_PIO_SW (AT91C_BASE_PIOA)
|
||||
|
||||
/*------------------*/
|
||||
/* CAN Definition */
|
||||
/*------------------*/
|
||||
#define AT91B_CAN_TRANSCEIVER_RS (1<<2) // PA2
|
||||
|
||||
/*--------------*/
|
||||
/* Clocks */
|
||||
/*--------------*/
|
||||
#define AT91B_MAIN_OSC 18432000 // Main Oscillator MAINCK
|
||||
#define AT91B_MCK ((18432000*73/14)/2) // Output PLL Clock
|
||||
|
||||
#endif /* AT91SAM7X-EK_H */
|
||||
// ----------------------------------------------------------------------------
|
||||
// ATMEL Microcontroller Software Support - ROUSSET -
|
||||
// ----------------------------------------------------------------------------
|
||||
// DISCLAIMER: THIS SOFTWARE IS PROVIDED BY ATMEL "AS IS" AND ANY EXPRESS OR
|
||||
// IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
|
||||
// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT ARE
|
||||
// DISCLAIMED. IN NO EVENT SHALL ATMEL BE LIABLE FOR ANY DIRECT, INDIRECT,
|
||||
// INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
|
||||
// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA,
|
||||
// OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
|
||||
// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
|
||||
// NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,
|
||||
// EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
// ----------------------------------------------------------------------------
|
||||
// File Name : AT91SAM7X-EK.h
|
||||
// Object : AT91SAM7X-EK Evaluation Board Features Definition File
|
||||
//
|
||||
// ----------------------------------------------------------------------------
|
||||
|
||||
#ifndef AT91SAM7X_EK_H
|
||||
#define AT91SAM7X_EK_H
|
||||
|
||||
/*-----------------*/
|
||||
/* LEDs Definition */
|
||||
/*-----------------*/
|
||||
#define AT91B_LED1 (1<<19) // AT91C_PIO_PB19 AT91C_PB19_PWM0 AT91C_PB19_TCLK1
|
||||
#define AT91B_LED2 (1<<20) // AT91C_PIO_PB20 AT91C_PB20_PWM1 AT91C_PB20_PWM1
|
||||
#define AT91B_LED3 (AT91C_PIO_PB21) // AT91C_PIO_PB21 AT91C_PB21_PWM2 AT91C_PB21_PCK1
|
||||
#define AT91B_LED4 (AT91C_PIO_PB22) // AT91C_PIO_PB22 AT91C_PB22_PWM3 AT91C_PB22_PCK2
|
||||
#define AT91B_NB_LEB 4
|
||||
#define AT91B_LED_MASK (AT91B_LED1|AT91B_LED2|AT91B_LED3|AT91B_LED4)
|
||||
#define AT91D_BASE_PIO_LED (AT91C_BASE_PIOB)
|
||||
|
||||
#define AT91B_POWERLED (1<<25) // PB25
|
||||
|
||||
|
||||
/*-------------------------------*/
|
||||
/* JOYSTICK Position Definition */
|
||||
/*-------------------------------*/
|
||||
#define AT91B_SW1 (1<<21) // PA21 Up Button AT91C_PA21_TF AT91C_PA21_NPCS10
|
||||
#define AT91B_SW2 (1<<22) // PA22 Down Button AT91C_PA22_TK AT91C_PA22_SPCK1
|
||||
#define AT91B_SW3 (1<<23) // PA23 Left Button AT91C_PA23_TD AT91C_PA23_MOSI1
|
||||
#define AT91B_SW4 (1<<24) // PA24 Right Button AT91C_PA24_RD AT91C_PA24_MISO1
|
||||
#define AT91B_SW5 (1<<25) // PA25 Push Button AT91C_PA25_RK AT91C_PA25_NPCS11
|
||||
#define AT91B_SW_MASK (AT91B_SW1|AT91B_SW2|AT91B_SW3|AT91B_SW4|AT91B_SW5)
|
||||
|
||||
|
||||
#define AT91D_BASE_PIO_SW (AT91C_BASE_PIOA)
|
||||
|
||||
/*------------------*/
|
||||
/* CAN Definition */
|
||||
/*------------------*/
|
||||
#define AT91B_CAN_TRANSCEIVER_RS (1<<2) // PA2
|
||||
|
||||
/*--------------*/
|
||||
/* Clocks */
|
||||
/*--------------*/
|
||||
#define AT91B_MAIN_OSC 18432000 // Main Oscillator MAINCK
|
||||
#define AT91B_MCK ((18432000*73/14)/2) // Output PLL Clock
|
||||
|
||||
#endif /* AT91SAM7X-EK_H */
|
||||
|
||||
+2314
-2314
File diff suppressed because it is too large
Load Diff
+4704
-4704
File diff suppressed because it is too large
Load Diff
+3407
-3407
File diff suppressed because it is too large
Load Diff
+2268
-2268
File diff suppressed because it is too large
Load Diff
+4380
-4380
File diff suppressed because it is too large
Load Diff
+4211
-4211
File diff suppressed because it is too large
Load Diff
@@ -1,32 +1,32 @@
|
||||
@REM This bat file has been generated by the IAR Embeddded Workbench
|
||||
@REM C-SPY interactive debugger,as an aid to preparing a command
|
||||
@REM line for running the cspybat command line utility with the
|
||||
@REM appropriate settings.
|
||||
@REM
|
||||
@REM After making some adjustments to this file, you can launch cspybat
|
||||
@REM by typing the name of this file followed by the name of the debug
|
||||
@REM file (usually an ubrof file). Note that this file is generated
|
||||
@REM every time a new debug session is initialized, so you may want to
|
||||
@REM move or rename the file before making changes.
|
||||
@REM
|
||||
@REM Note: some command line arguments cannot be properly generated
|
||||
@REM by this process. Specifically, the plugin which is responsible
|
||||
@REM for the Terminal I/O window (and other C runtime functionality)
|
||||
@REM comes in a special version for cspybat, and the name of that
|
||||
@REM plugin dll is not known when generating this file. It resides in
|
||||
@REM the $TOOLKIT_DIR$\bin folder and is usually called XXXbat.dll or
|
||||
@REM XXXlibsupportbat.dll, where XXX is the name of the corresponding
|
||||
@REM tool chain. Replace the '<libsupport_plugin>' parameter
|
||||
@REM below with the appropriate file name. Other plugins loaded by
|
||||
@REM C-SPY are usually not needed by, or will not work in, cspybat
|
||||
@REM but they are listed at the end of this file for reference.
|
||||
|
||||
|
||||
"C:\Program Files\IAR Systems\Embedded Workbench 4.0\common\bin\cspybat" "C:\Program Files\IAR Systems\Embedded Workbench 4.0\ARM\bin\armproc.dll" "C:\Program Files\IAR Systems\Embedded Workbench 4.0\ARM\bin\armjlink.dll" %1 --plugin "C:\Program Files\IAR Systems\Embedded Workbench 4.0\ARM\bin\<libsupport_plugin>" --macro "C:\svn\cmock\iar\iar_v4\Resource\SAM7_FLASH.mac" --backend -B "--endian" "little" "--cpu" "ARM7TDMI" "--fpu" "None" "--proc_device_desc_file" "C:\Program Files\IAR Systems\Embedded Workbench 4.0\ARM\CONFIG\ioAT91SAM7X256.ddf" "--drv_verify_download" "all" "--proc_driver" "jlink" "--jlink_connection" "USB:0" "--jlink_initial_speed" "32"
|
||||
|
||||
|
||||
@REM loaded plugins:
|
||||
@REM armlibsupport.dll
|
||||
@REM C:\Program Files\IAR Systems\Embedded Workbench 4.0\common\plugins\CodeCoverage\CodeCoverage.dll
|
||||
@REM C:\Program Files\IAR Systems\Embedded Workbench 4.0\common\plugins\Profiling\Profiling.dll
|
||||
@REM C:\Program Files\IAR Systems\Embedded Workbench 4.0\common\plugins\stack\stack.dll
|
||||
@REM This bat file has been generated by the IAR Embeddded Workbench
|
||||
@REM C-SPY interactive debugger,as an aid to preparing a command
|
||||
@REM line for running the cspybat command line utility with the
|
||||
@REM appropriate settings.
|
||||
@REM
|
||||
@REM After making some adjustments to this file, you can launch cspybat
|
||||
@REM by typing the name of this file followed by the name of the debug
|
||||
@REM file (usually an ubrof file). Note that this file is generated
|
||||
@REM every time a new debug session is initialized, so you may want to
|
||||
@REM move or rename the file before making changes.
|
||||
@REM
|
||||
@REM Note: some command line arguments cannot be properly generated
|
||||
@REM by this process. Specifically, the plugin which is responsible
|
||||
@REM for the Terminal I/O window (and other C runtime functionality)
|
||||
@REM comes in a special version for cspybat, and the name of that
|
||||
@REM plugin dll is not known when generating this file. It resides in
|
||||
@REM the $TOOLKIT_DIR$\bin folder and is usually called XXXbat.dll or
|
||||
@REM XXXlibsupportbat.dll, where XXX is the name of the corresponding
|
||||
@REM tool chain. Replace the '<libsupport_plugin>' parameter
|
||||
@REM below with the appropriate file name. Other plugins loaded by
|
||||
@REM C-SPY are usually not needed by, or will not work in, cspybat
|
||||
@REM but they are listed at the end of this file for reference.
|
||||
|
||||
|
||||
"C:\Program Files\IAR Systems\Embedded Workbench 4.0\common\bin\cspybat" "C:\Program Files\IAR Systems\Embedded Workbench 4.0\ARM\bin\armproc.dll" "C:\Program Files\IAR Systems\Embedded Workbench 4.0\ARM\bin\armjlink.dll" %1 --plugin "C:\Program Files\IAR Systems\Embedded Workbench 4.0\ARM\bin\<libsupport_plugin>" --macro "C:\svn\cmock\iar\iar_v4\Resource\SAM7_FLASH.mac" --backend -B "--endian" "little" "--cpu" "ARM7TDMI" "--fpu" "None" "--proc_device_desc_file" "C:\Program Files\IAR Systems\Embedded Workbench 4.0\ARM\CONFIG\ioAT91SAM7X256.ddf" "--drv_verify_download" "all" "--proc_driver" "jlink" "--jlink_connection" "USB:0" "--jlink_initial_speed" "32"
|
||||
|
||||
|
||||
@REM loaded plugins:
|
||||
@REM armlibsupport.dll
|
||||
@REM C:\Program Files\IAR Systems\Embedded Workbench 4.0\common\plugins\CodeCoverage\CodeCoverage.dll
|
||||
@REM C:\Program Files\IAR Systems\Embedded Workbench 4.0\common\plugins\Profiling\Profiling.dll
|
||||
@REM C:\Program Files\IAR Systems\Embedded Workbench 4.0\common\plugins\stack\stack.dll
|
||||
|
||||
+265
-265
@@ -1,266 +1,266 @@
|
||||
;- ----------------------------------------------------------------------------
|
||||
;- ATMEL Microcontroller Software Support - ROUSSET -
|
||||
;- ----------------------------------------------------------------------------
|
||||
;- DISCLAIMER: THIS SOFTWARE IS PROVIDED BY ATMEL "AS IS" AND ANY EXPRESS OR
|
||||
;- IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
|
||||
;- MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT ARE
|
||||
;- DISCLAIMED. IN NO EVENT SHALL ATMEL BE LIABLE FOR ANY DIRECT, INDIRECT,
|
||||
;- INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
|
||||
;- LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA,
|
||||
;- OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
|
||||
;- LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
|
||||
;- NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,
|
||||
;- EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
;- ----------------------------------------------------------------------------
|
||||
;- File source : Cstartup.s79
|
||||
;- Object : Generic CStartup
|
||||
;- 1.0 01/Sep/05 FBr : Creation
|
||||
;- 1.1 09/Sep/05 JPP : Change Interrupt management
|
||||
;------------------------------------------------------------------------------
|
||||
|
||||
;------------------------------------------------------------------------------
|
||||
; Include your AT91 Library files
|
||||
;------------------------------------------------------------------------------
|
||||
#include "AT91SAM7X256_inc.h"
|
||||
;------------------------------------------------------------------------------
|
||||
|
||||
;------------------------------------------------------------------------------
|
||||
; ?RESET
|
||||
; Reset Vector.
|
||||
; Normally, segment INTVEC is linked at address 0.
|
||||
; For debugging purposes, INTVEC may be placed at other addresses.
|
||||
; A debugger that honors the entry point will start the
|
||||
; program in a normal way even if INTVEC is not at address 0.
|
||||
;------------------------------------------------------------------------------
|
||||
|
||||
PROGRAM ?RESET ;- Begins a program module
|
||||
RSEG INTRAMEND_REMAP ;- Begins a relocatable segment
|
||||
RSEG ICODE:CODE (2) ;- Begins a relocatable segment : corresponding address is 32-bit aligned
|
||||
CODE32 ;- Always ARM mode after reset
|
||||
ORG 0 ;- Sets the location counter: corresponds to the RESET vector address
|
||||
|
||||
;------------------------------------------------------------------------------
|
||||
;- Exception vectors
|
||||
;------------------------------------------------------------------------------
|
||||
;- These vectors can be read at address 0 or at RAM address
|
||||
;- They ABSOLUTELY requires to be in relative addresssing mode in order to
|
||||
;- guarantee a valid jump. For the moment, all are just looping.
|
||||
;- If an exception occurs before remap, this would result in an infinite loop.
|
||||
;- To ensure if a exeption occurs before start application to infinite loop.
|
||||
;------------------------------------------------------------------------------
|
||||
|
||||
reset
|
||||
B InitReset ; 0x00 Reset handler
|
||||
undefvec:
|
||||
B undefvec ; 0x04 Undefined Instruction
|
||||
swivec:
|
||||
B swivec ; 0x08 Software Interrupt
|
||||
pabtvec:
|
||||
B pabtvec ; 0x0C Prefetch Abort
|
||||
dabtvec:
|
||||
B dabtvec ; 0x10 Data Abort
|
||||
rsvdvec:
|
||||
B rsvdvec ; 0x14 reserved
|
||||
irqvec:
|
||||
B IRQ_Handler_Entry ; 0x18 IRQ
|
||||
|
||||
fiqvec: ; 0x1c FIQ
|
||||
;------------------------------------------------------------------------------
|
||||
;- Function : FIQ_Handler_Entry
|
||||
;- Treatments : FIQ Controller Interrupt Handler.
|
||||
;- Called Functions : AIC_FVR[interrupt]
|
||||
;------------------------------------------------------------------------------
|
||||
|
||||
FIQ_Handler_Entry:
|
||||
|
||||
;- Switch in SVC/User Mode to allow User Stack access for C code
|
||||
; because the FIQ is not yet acknowledged
|
||||
|
||||
;- Save and r0 in FIQ_Register
|
||||
mov r9,r0
|
||||
ldr r0 , [r8, #AIC_FVR]
|
||||
msr CPSR_c,#I_BIT | F_BIT | ARM_MODE_SVC
|
||||
;- Save scratch/used registers and LR in User Stack
|
||||
stmfd sp!, { r1-r3, r12, lr}
|
||||
|
||||
;- Branch to the routine pointed by the AIC_FVR
|
||||
mov r14, pc
|
||||
bx r0
|
||||
|
||||
;- Restore scratch/used registers and LR from User Stack
|
||||
ldmia sp!, { r1-r3, r12, lr}
|
||||
|
||||
;- Leave Interrupts disabled and switch back in FIQ mode
|
||||
msr CPSR_c, #I_BIT | F_BIT | ARM_MODE_FIQ
|
||||
|
||||
;- Restore the R0 ARM_MODE_SVC register
|
||||
mov r0,r9
|
||||
|
||||
;- Restore the Program Counter using the LR_fiq directly in the PC
|
||||
subs pc,lr,#4
|
||||
|
||||
;------------------------------------------------------------------------------
|
||||
;- Manage exception: The exception must be ensure in ARM mode
|
||||
;------------------------------------------------------------------------------
|
||||
;------------------------------------------------------------------------------
|
||||
;- Function : IRQ_Handler_Entry
|
||||
;- Treatments : IRQ Controller Interrupt Handler.
|
||||
;- Called Functions : AIC_IVR[interrupt]
|
||||
;------------------------------------------------------------------------------
|
||||
IRQ_Handler_Entry:
|
||||
|
||||
;-------------------------
|
||||
;- Manage Exception Entry
|
||||
;-------------------------
|
||||
;- Adjust and save LR_irq in IRQ stack
|
||||
sub lr, lr, #4
|
||||
stmfd sp!, {lr}
|
||||
|
||||
;- Save r0 and SPSR (need to be saved for nested interrupt)
|
||||
mrs r14, SPSR
|
||||
stmfd sp!, {r0,r14}
|
||||
|
||||
;- Write in the IVR to support Protect Mode
|
||||
;- No effect in Normal Mode
|
||||
;- De-assert the NIRQ and clear the source in Protect Mode
|
||||
ldr r14, =AT91C_BASE_AIC
|
||||
ldr r0 , [r14, #AIC_IVR]
|
||||
str r14, [r14, #AIC_IVR]
|
||||
|
||||
;- Enable Interrupt and Switch in Supervisor Mode
|
||||
msr CPSR_c, #ARM_MODE_SVC
|
||||
|
||||
;- Save scratch/used registers and LR in User Stack
|
||||
stmfd sp!, { r1-r3, r12, r14}
|
||||
|
||||
;----------------------------------------------
|
||||
;- Branch to the routine pointed by the AIC_IVR
|
||||
;----------------------------------------------
|
||||
mov r14, pc
|
||||
bx r0
|
||||
|
||||
;----------------------------------------------
|
||||
;- Manage Exception Exit
|
||||
;----------------------------------------------
|
||||
;- Restore scratch/used registers and LR from User Stack
|
||||
ldmia sp!, { r1-r3, r12, r14}
|
||||
|
||||
;- Disable Interrupt and switch back in IRQ mode
|
||||
msr CPSR_c, #I_BIT | ARM_MODE_IRQ
|
||||
|
||||
;- Mark the End of Interrupt on the AIC
|
||||
ldr r14, =AT91C_BASE_AIC
|
||||
str r14, [r14, #AIC_EOICR]
|
||||
|
||||
;- Restore SPSR_irq and r0 from IRQ stack
|
||||
ldmia sp!, {r0,r14}
|
||||
msr SPSR_cxsf, r14
|
||||
|
||||
;- Restore adjusted LR_irq from IRQ stack directly in the PC
|
||||
ldmia sp!, {pc}^
|
||||
|
||||
|
||||
|
||||
InitReset:
|
||||
|
||||
;------------------------------------------------------------------------------
|
||||
;- Low level Init is performed in a C function: AT91F_LowLevelInit
|
||||
;- Init Stack Pointer to a valid memory area before calling AT91F_LowLevelInit
|
||||
;------------------------------------------------------------------------------
|
||||
|
||||
;- Retrieve end of RAM address
|
||||
__iramend EQU SFB(INTRAMEND_REMAP) ;- Segment begin
|
||||
|
||||
EXTERN AT91F_LowLevelInit
|
||||
ldr r13,=__iramend ;- Temporary stack in internal RAM for Low Level Init execution
|
||||
ldr r0,=AT91F_LowLevelInit
|
||||
mov lr, pc
|
||||
bx r0 ;- Branch on C function (with interworking)
|
||||
|
||||
;------------------------------------------------------------------------------
|
||||
;- Top of Stack Definition
|
||||
;------------------------------------------------------------------------------
|
||||
;- Interrupt and Supervisor Stack are located at the top of internal memory in
|
||||
;- order to speed the exception handling context saving and restoring.
|
||||
;- ARM_MODE_SVC (Application, C) Stack is located at the top of the external memory.
|
||||
;------------------------------------------------------------------------------
|
||||
|
||||
IRQ_STACK_SIZE EQU (3*8*4) ; 3 words to be saved per interrupt priority level
|
||||
ARM_MODE_FIQ EQU 0x11
|
||||
ARM_MODE_IRQ EQU 0x12
|
||||
ARM_MODE_SVC EQU 0x13
|
||||
I_BIT EQU 0x80
|
||||
F_BIT EQU 0x40
|
||||
|
||||
;------------------------------------------------------------------------------
|
||||
;- Setup the stack for each mode
|
||||
;------------------------------------------------------------------------------
|
||||
ldr r0, =__iramend
|
||||
|
||||
;- Set up Fast Interrupt Mode and set FIQ Mode Stack
|
||||
msr CPSR_c, #ARM_MODE_FIQ | I_BIT | F_BIT
|
||||
;- Init the FIQ register
|
||||
ldr r8, =AT91C_BASE_AIC
|
||||
|
||||
;- Set up Interrupt Mode and set IRQ Mode Stack
|
||||
msr CPSR_c, #ARM_MODE_IRQ | I_BIT | F_BIT
|
||||
mov r13, r0 ; Init stack IRQ
|
||||
sub r0, r0, #IRQ_STACK_SIZE
|
||||
|
||||
;- Enable interrupt & Set up Supervisor Mode and set Supervisor Mode Stack
|
||||
msr CPSR_c, #ARM_MODE_SVC
|
||||
mov r13, r0
|
||||
|
||||
;------------------------------------------------------------------------------
|
||||
; Initialize segments.
|
||||
;------------------------------------------------------------------------------
|
||||
; __segment_init is assumed to use
|
||||
; instruction set and to be reachable by BL from the ICODE segment
|
||||
; (it is safest to link them in segment ICODE).
|
||||
;------------------------------------------------------------------------------
|
||||
EXTERN __segment_init
|
||||
ldr r0,=__segment_init
|
||||
mov lr, pc
|
||||
bx r0
|
||||
|
||||
;------------------------------------------------------------------------------
|
||||
;- Branch on C code Main function (with interworking)
|
||||
;------------------------------------------------------------------------------
|
||||
EXTERN main
|
||||
PUBLIC __main
|
||||
?jump_to_main:
|
||||
ldr lr,=?call_exit
|
||||
ldr r0,=main
|
||||
__main:
|
||||
bx r0
|
||||
|
||||
;------------------------------------------------------------------------------
|
||||
;- Loop for ever
|
||||
;------------------------------------------------------------------------------
|
||||
;- End of application. Normally, never occur.
|
||||
;- Could jump on Software Reset ( B 0x0 ).
|
||||
;------------------------------------------------------------------------------
|
||||
?call_exit:
|
||||
End
|
||||
b End
|
||||
|
||||
;------------------------------------------------------------------------------
|
||||
;- Exception Vectors
|
||||
;------------------------------------------------------------------------------
|
||||
PUBLIC AT91F_Default_FIQ_handler
|
||||
PUBLIC AT91F_Default_IRQ_handler
|
||||
PUBLIC AT91F_Spurious_handler
|
||||
|
||||
CODE32 ; Always ARM mode after exeption
|
||||
|
||||
AT91F_Default_FIQ_handler
|
||||
b AT91F_Default_FIQ_handler
|
||||
|
||||
AT91F_Default_IRQ_handler
|
||||
b AT91F_Default_IRQ_handler
|
||||
|
||||
AT91F_Spurious_handler
|
||||
b AT91F_Spurious_handler
|
||||
|
||||
ENDMOD ;- Terminates the assembly of the current module
|
||||
;- ----------------------------------------------------------------------------
|
||||
;- ATMEL Microcontroller Software Support - ROUSSET -
|
||||
;- ----------------------------------------------------------------------------
|
||||
;- DISCLAIMER: THIS SOFTWARE IS PROVIDED BY ATMEL "AS IS" AND ANY EXPRESS OR
|
||||
;- IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
|
||||
;- MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT ARE
|
||||
;- DISCLAIMED. IN NO EVENT SHALL ATMEL BE LIABLE FOR ANY DIRECT, INDIRECT,
|
||||
;- INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
|
||||
;- LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA,
|
||||
;- OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
|
||||
;- LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
|
||||
;- NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,
|
||||
;- EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
;- ----------------------------------------------------------------------------
|
||||
;- File source : Cstartup.s79
|
||||
;- Object : Generic CStartup
|
||||
;- 1.0 01/Sep/05 FBr : Creation
|
||||
;- 1.1 09/Sep/05 JPP : Change Interrupt management
|
||||
;------------------------------------------------------------------------------
|
||||
|
||||
;------------------------------------------------------------------------------
|
||||
; Include your AT91 Library files
|
||||
;------------------------------------------------------------------------------
|
||||
#include "AT91SAM7X256_inc.h"
|
||||
;------------------------------------------------------------------------------
|
||||
|
||||
;------------------------------------------------------------------------------
|
||||
; ?RESET
|
||||
; Reset Vector.
|
||||
; Normally, segment INTVEC is linked at address 0.
|
||||
; For debugging purposes, INTVEC may be placed at other addresses.
|
||||
; A debugger that honors the entry point will start the
|
||||
; program in a normal way even if INTVEC is not at address 0.
|
||||
;------------------------------------------------------------------------------
|
||||
|
||||
PROGRAM ?RESET ;- Begins a program module
|
||||
RSEG INTRAMEND_REMAP ;- Begins a relocatable segment
|
||||
RSEG ICODE:CODE (2) ;- Begins a relocatable segment : corresponding address is 32-bit aligned
|
||||
CODE32 ;- Always ARM mode after reset
|
||||
ORG 0 ;- Sets the location counter: corresponds to the RESET vector address
|
||||
|
||||
;------------------------------------------------------------------------------
|
||||
;- Exception vectors
|
||||
;------------------------------------------------------------------------------
|
||||
;- These vectors can be read at address 0 or at RAM address
|
||||
;- They ABSOLUTELY requires to be in relative addresssing mode in order to
|
||||
;- guarantee a valid jump. For the moment, all are just looping.
|
||||
;- If an exception occurs before remap, this would result in an infinite loop.
|
||||
;- To ensure if a exeption occurs before start application to infinite loop.
|
||||
;------------------------------------------------------------------------------
|
||||
|
||||
reset
|
||||
B InitReset ; 0x00 Reset handler
|
||||
undefvec:
|
||||
B undefvec ; 0x04 Undefined Instruction
|
||||
swivec:
|
||||
B swivec ; 0x08 Software Interrupt
|
||||
pabtvec:
|
||||
B pabtvec ; 0x0C Prefetch Abort
|
||||
dabtvec:
|
||||
B dabtvec ; 0x10 Data Abort
|
||||
rsvdvec:
|
||||
B rsvdvec ; 0x14 reserved
|
||||
irqvec:
|
||||
B IRQ_Handler_Entry ; 0x18 IRQ
|
||||
|
||||
fiqvec: ; 0x1c FIQ
|
||||
;------------------------------------------------------------------------------
|
||||
;- Function : FIQ_Handler_Entry
|
||||
;- Treatments : FIQ Controller Interrupt Handler.
|
||||
;- Called Functions : AIC_FVR[interrupt]
|
||||
;------------------------------------------------------------------------------
|
||||
|
||||
FIQ_Handler_Entry:
|
||||
|
||||
;- Switch in SVC/User Mode to allow User Stack access for C code
|
||||
; because the FIQ is not yet acknowledged
|
||||
|
||||
;- Save and r0 in FIQ_Register
|
||||
mov r9,r0
|
||||
ldr r0 , [r8, #AIC_FVR]
|
||||
msr CPSR_c,#I_BIT | F_BIT | ARM_MODE_SVC
|
||||
;- Save scratch/used registers and LR in User Stack
|
||||
stmfd sp!, { r1-r3, r12, lr}
|
||||
|
||||
;- Branch to the routine pointed by the AIC_FVR
|
||||
mov r14, pc
|
||||
bx r0
|
||||
|
||||
;- Restore scratch/used registers and LR from User Stack
|
||||
ldmia sp!, { r1-r3, r12, lr}
|
||||
|
||||
;- Leave Interrupts disabled and switch back in FIQ mode
|
||||
msr CPSR_c, #I_BIT | F_BIT | ARM_MODE_FIQ
|
||||
|
||||
;- Restore the R0 ARM_MODE_SVC register
|
||||
mov r0,r9
|
||||
|
||||
;- Restore the Program Counter using the LR_fiq directly in the PC
|
||||
subs pc,lr,#4
|
||||
|
||||
;------------------------------------------------------------------------------
|
||||
;- Manage exception: The exception must be ensure in ARM mode
|
||||
;------------------------------------------------------------------------------
|
||||
;------------------------------------------------------------------------------
|
||||
;- Function : IRQ_Handler_Entry
|
||||
;- Treatments : IRQ Controller Interrupt Handler.
|
||||
;- Called Functions : AIC_IVR[interrupt]
|
||||
;------------------------------------------------------------------------------
|
||||
IRQ_Handler_Entry:
|
||||
|
||||
;-------------------------
|
||||
;- Manage Exception Entry
|
||||
;-------------------------
|
||||
;- Adjust and save LR_irq in IRQ stack
|
||||
sub lr, lr, #4
|
||||
stmfd sp!, {lr}
|
||||
|
||||
;- Save r0 and SPSR (need to be saved for nested interrupt)
|
||||
mrs r14, SPSR
|
||||
stmfd sp!, {r0,r14}
|
||||
|
||||
;- Write in the IVR to support Protect Mode
|
||||
;- No effect in Normal Mode
|
||||
;- De-assert the NIRQ and clear the source in Protect Mode
|
||||
ldr r14, =AT91C_BASE_AIC
|
||||
ldr r0 , [r14, #AIC_IVR]
|
||||
str r14, [r14, #AIC_IVR]
|
||||
|
||||
;- Enable Interrupt and Switch in Supervisor Mode
|
||||
msr CPSR_c, #ARM_MODE_SVC
|
||||
|
||||
;- Save scratch/used registers and LR in User Stack
|
||||
stmfd sp!, { r1-r3, r12, r14}
|
||||
|
||||
;----------------------------------------------
|
||||
;- Branch to the routine pointed by the AIC_IVR
|
||||
;----------------------------------------------
|
||||
mov r14, pc
|
||||
bx r0
|
||||
|
||||
;----------------------------------------------
|
||||
;- Manage Exception Exit
|
||||
;----------------------------------------------
|
||||
;- Restore scratch/used registers and LR from User Stack
|
||||
ldmia sp!, { r1-r3, r12, r14}
|
||||
|
||||
;- Disable Interrupt and switch back in IRQ mode
|
||||
msr CPSR_c, #I_BIT | ARM_MODE_IRQ
|
||||
|
||||
;- Mark the End of Interrupt on the AIC
|
||||
ldr r14, =AT91C_BASE_AIC
|
||||
str r14, [r14, #AIC_EOICR]
|
||||
|
||||
;- Restore SPSR_irq and r0 from IRQ stack
|
||||
ldmia sp!, {r0,r14}
|
||||
msr SPSR_cxsf, r14
|
||||
|
||||
;- Restore adjusted LR_irq from IRQ stack directly in the PC
|
||||
ldmia sp!, {pc}^
|
||||
|
||||
|
||||
|
||||
InitReset:
|
||||
|
||||
;------------------------------------------------------------------------------
|
||||
;- Low level Init is performed in a C function: AT91F_LowLevelInit
|
||||
;- Init Stack Pointer to a valid memory area before calling AT91F_LowLevelInit
|
||||
;------------------------------------------------------------------------------
|
||||
|
||||
;- Retrieve end of RAM address
|
||||
__iramend EQU SFB(INTRAMEND_REMAP) ;- Segment begin
|
||||
|
||||
EXTERN AT91F_LowLevelInit
|
||||
ldr r13,=__iramend ;- Temporary stack in internal RAM for Low Level Init execution
|
||||
ldr r0,=AT91F_LowLevelInit
|
||||
mov lr, pc
|
||||
bx r0 ;- Branch on C function (with interworking)
|
||||
|
||||
;------------------------------------------------------------------------------
|
||||
;- Top of Stack Definition
|
||||
;------------------------------------------------------------------------------
|
||||
;- Interrupt and Supervisor Stack are located at the top of internal memory in
|
||||
;- order to speed the exception handling context saving and restoring.
|
||||
;- ARM_MODE_SVC (Application, C) Stack is located at the top of the external memory.
|
||||
;------------------------------------------------------------------------------
|
||||
|
||||
IRQ_STACK_SIZE EQU (3*8*4) ; 3 words to be saved per interrupt priority level
|
||||
ARM_MODE_FIQ EQU 0x11
|
||||
ARM_MODE_IRQ EQU 0x12
|
||||
ARM_MODE_SVC EQU 0x13
|
||||
I_BIT EQU 0x80
|
||||
F_BIT EQU 0x40
|
||||
|
||||
;------------------------------------------------------------------------------
|
||||
;- Setup the stack for each mode
|
||||
;------------------------------------------------------------------------------
|
||||
ldr r0, =__iramend
|
||||
|
||||
;- Set up Fast Interrupt Mode and set FIQ Mode Stack
|
||||
msr CPSR_c, #ARM_MODE_FIQ | I_BIT | F_BIT
|
||||
;- Init the FIQ register
|
||||
ldr r8, =AT91C_BASE_AIC
|
||||
|
||||
;- Set up Interrupt Mode and set IRQ Mode Stack
|
||||
msr CPSR_c, #ARM_MODE_IRQ | I_BIT | F_BIT
|
||||
mov r13, r0 ; Init stack IRQ
|
||||
sub r0, r0, #IRQ_STACK_SIZE
|
||||
|
||||
;- Enable interrupt & Set up Supervisor Mode and set Supervisor Mode Stack
|
||||
msr CPSR_c, #ARM_MODE_SVC
|
||||
mov r13, r0
|
||||
|
||||
;------------------------------------------------------------------------------
|
||||
; Initialize segments.
|
||||
;------------------------------------------------------------------------------
|
||||
; __segment_init is assumed to use
|
||||
; instruction set and to be reachable by BL from the ICODE segment
|
||||
; (it is safest to link them in segment ICODE).
|
||||
;------------------------------------------------------------------------------
|
||||
EXTERN __segment_init
|
||||
ldr r0,=__segment_init
|
||||
mov lr, pc
|
||||
bx r0
|
||||
|
||||
;------------------------------------------------------------------------------
|
||||
;- Branch on C code Main function (with interworking)
|
||||
;------------------------------------------------------------------------------
|
||||
EXTERN main
|
||||
PUBLIC __main
|
||||
?jump_to_main:
|
||||
ldr lr,=?call_exit
|
||||
ldr r0,=main
|
||||
__main:
|
||||
bx r0
|
||||
|
||||
;------------------------------------------------------------------------------
|
||||
;- Loop for ever
|
||||
;------------------------------------------------------------------------------
|
||||
;- End of application. Normally, never occur.
|
||||
;- Could jump on Software Reset ( B 0x0 ).
|
||||
;------------------------------------------------------------------------------
|
||||
?call_exit:
|
||||
End
|
||||
b End
|
||||
|
||||
;------------------------------------------------------------------------------
|
||||
;- Exception Vectors
|
||||
;------------------------------------------------------------------------------
|
||||
PUBLIC AT91F_Default_FIQ_handler
|
||||
PUBLIC AT91F_Default_IRQ_handler
|
||||
PUBLIC AT91F_Spurious_handler
|
||||
|
||||
CODE32 ; Always ARM mode after exeption
|
||||
|
||||
AT91F_Default_FIQ_handler
|
||||
b AT91F_Default_FIQ_handler
|
||||
|
||||
AT91F_Default_IRQ_handler
|
||||
b AT91F_Default_IRQ_handler
|
||||
|
||||
AT91F_Spurious_handler
|
||||
b AT91F_Spurious_handler
|
||||
|
||||
ENDMOD ;- Terminates the assembly of the current module
|
||||
END ;- Terminates the assembly of the last module in a file
|
||||
@@ -1,98 +1,98 @@
|
||||
// ----------------------------------------------------------------------------
|
||||
// ATMEL Microcontroller Software Support - ROUSSET -
|
||||
// ----------------------------------------------------------------------------
|
||||
// DISCLAIMER: THIS SOFTWARE IS PROVIDED BY ATMEL "AS IS" AND ANY EXPRESS OR
|
||||
// IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
|
||||
// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT ARE
|
||||
// DISCLAIMED. IN NO EVENT SHALL ATMEL BE LIABLE FOR ANY DIRECT, INDIRECT,
|
||||
// INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
|
||||
// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA,
|
||||
// OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
|
||||
// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
|
||||
// NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,
|
||||
// EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
// ----------------------------------------------------------------------------
|
||||
// File Name : Cstartup_SAM7.c
|
||||
// Object : Low level initialisations written in C for IAR Tools
|
||||
// Creation : FBr 01-Sep-2005
|
||||
// 1.0 08-Sep-2005 JPP : Suppress Reset
|
||||
// ----------------------------------------------------------------------------
|
||||
|
||||
#include "AT91SAM7X256.h"
|
||||
|
||||
// The following functions must be write in ARM mode this function called directly by exception vector
|
||||
extern void AT91F_Spurious_handler(void);
|
||||
extern void AT91F_Default_IRQ_handler(void);
|
||||
extern void AT91F_Default_FIQ_handler(void);
|
||||
|
||||
//*----------------------------------------------------------------------------
|
||||
//* \fn AT91F_LowLevelInit
|
||||
//* \brief This function performs very low level HW initialization
|
||||
//* this function can use a Stack, depending the compilation
|
||||
//* optimization mode
|
||||
//*----------------------------------------------------------------------------
|
||||
void AT91F_LowLevelInit(void)
|
||||
{
|
||||
unsigned char i;
|
||||
/////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
// EFC Init
|
||||
/////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
AT91C_BASE_MC->MC_FMR = AT91C_MC_FWS_1FWS; // 1 Wait State necessary to work at 48MHz
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
// Init PMC Step 1. Enable Main Oscillator
|
||||
// Main Oscillator startup time is board specific:
|
||||
// Main Oscillator Startup Time worst case (3MHz) corresponds to 15ms (0x40 for AT91C_CKGR_OSCOUNT field)
|
||||
/////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
AT91C_BASE_PMC->PMC_MOR = (( AT91C_CKGR_OSCOUNT & (0x40 <<8) | AT91C_CKGR_MOSCEN ));
|
||||
#ifndef SIMULATE
|
||||
// Wait Main Oscillator stabilization
|
||||
while(!(AT91C_BASE_PMC->PMC_SR & AT91C_PMC_MOSCS));
|
||||
#endif
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
// Init PMC Step 2.
|
||||
// Set PLL to 96MHz (96,109MHz) and UDP Clock to 48MHz
|
||||
// PLL Startup time depends on PLL RC filter: worst case is choosen
|
||||
// UDP Clock (48,058MHz) is compliant with the Universal Serial Bus Specification (+/- 0.25% for full speed)
|
||||
/////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
AT91C_BASE_PMC->PMC_PLLR = AT91C_CKGR_USBDIV_1 | AT91C_CKGR_OUT_0 | AT91C_CKGR_PLLCOUNT |
|
||||
(AT91C_CKGR_MUL & (72 << 16)) | (AT91C_CKGR_DIV & 14);
|
||||
#ifndef SIMULATE
|
||||
// Wait for PLL stabilization
|
||||
while( !(AT91C_BASE_PMC->PMC_SR & AT91C_PMC_LOCK) );
|
||||
// Wait until the master clock is established for the case we already turn on the PLL
|
||||
while( !(AT91C_BASE_PMC->PMC_SR & AT91C_PMC_MCKRDY) );
|
||||
#endif
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
// Init PMC Step 3.
|
||||
// Selection of Master Clock MCK (equal to Processor Clock PCK) equal to PLL/2 = 48MHz
|
||||
// The PMC_MCKR register must not be programmed in a single write operation (see. Product Errata Sheet)
|
||||
/////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
AT91C_BASE_PMC->PMC_MCKR = AT91C_PMC_PRES_CLK_2;
|
||||
#ifndef SIMULATE
|
||||
// Wait until the master clock is established
|
||||
while( !(AT91C_BASE_PMC->PMC_SR & AT91C_PMC_MCKRDY) );
|
||||
#endif
|
||||
|
||||
AT91C_BASE_PMC->PMC_MCKR |= AT91C_PMC_CSS_PLL_CLK;
|
||||
#ifndef SIMULATE
|
||||
// Wait until the master clock is established
|
||||
while( !(AT91C_BASE_PMC->PMC_SR & AT91C_PMC_MCKRDY) );
|
||||
#endif
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
// Disable Watchdog (write once register)
|
||||
/////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
AT91C_BASE_WDTC->WDTC_WDMR = AT91C_WDTC_WDDIS;
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
// Init AIC: assign corresponding handler for each interrupt source
|
||||
/////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
AT91C_BASE_AIC->AIC_SVR[0] = (int) AT91F_Default_FIQ_handler ;
|
||||
for (i = 1; i < 31; i++) {
|
||||
AT91C_BASE_AIC->AIC_SVR[i] = (int) AT91F_Default_IRQ_handler ;
|
||||
}
|
||||
AT91C_BASE_AIC->AIC_SPU = (unsigned int) AT91F_Spurious_handler;
|
||||
}
|
||||
// ----------------------------------------------------------------------------
|
||||
// ATMEL Microcontroller Software Support - ROUSSET -
|
||||
// ----------------------------------------------------------------------------
|
||||
// DISCLAIMER: THIS SOFTWARE IS PROVIDED BY ATMEL "AS IS" AND ANY EXPRESS OR
|
||||
// IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
|
||||
// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT ARE
|
||||
// DISCLAIMED. IN NO EVENT SHALL ATMEL BE LIABLE FOR ANY DIRECT, INDIRECT,
|
||||
// INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
|
||||
// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA,
|
||||
// OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
|
||||
// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
|
||||
// NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,
|
||||
// EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
// ----------------------------------------------------------------------------
|
||||
// File Name : Cstartup_SAM7.c
|
||||
// Object : Low level initialisations written in C for IAR Tools
|
||||
// Creation : FBr 01-Sep-2005
|
||||
// 1.0 08-Sep-2005 JPP : Suppress Reset
|
||||
// ----------------------------------------------------------------------------
|
||||
|
||||
#include "AT91SAM7X256.h"
|
||||
|
||||
// The following functions must be write in ARM mode this function called directly by exception vector
|
||||
extern void AT91F_Spurious_handler(void);
|
||||
extern void AT91F_Default_IRQ_handler(void);
|
||||
extern void AT91F_Default_FIQ_handler(void);
|
||||
|
||||
//*----------------------------------------------------------------------------
|
||||
//* \fn AT91F_LowLevelInit
|
||||
//* \brief This function performs very low level HW initialization
|
||||
//* this function can use a Stack, depending the compilation
|
||||
//* optimization mode
|
||||
//*----------------------------------------------------------------------------
|
||||
void AT91F_LowLevelInit(void)
|
||||
{
|
||||
unsigned char i;
|
||||
/////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
// EFC Init
|
||||
/////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
AT91C_BASE_MC->MC_FMR = AT91C_MC_FWS_1FWS; // 1 Wait State necessary to work at 48MHz
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
// Init PMC Step 1. Enable Main Oscillator
|
||||
// Main Oscillator startup time is board specific:
|
||||
// Main Oscillator Startup Time worst case (3MHz) corresponds to 15ms (0x40 for AT91C_CKGR_OSCOUNT field)
|
||||
/////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
AT91C_BASE_PMC->PMC_MOR = (( AT91C_CKGR_OSCOUNT & (0x40 <<8) | AT91C_CKGR_MOSCEN ));
|
||||
#ifndef SIMULATE
|
||||
// Wait Main Oscillator stabilization
|
||||
while(!(AT91C_BASE_PMC->PMC_SR & AT91C_PMC_MOSCS));
|
||||
#endif
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
// Init PMC Step 2.
|
||||
// Set PLL to 96MHz (96,109MHz) and UDP Clock to 48MHz
|
||||
// PLL Startup time depends on PLL RC filter: worst case is choosen
|
||||
// UDP Clock (48,058MHz) is compliant with the Universal Serial Bus Specification (+/- 0.25% for full speed)
|
||||
/////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
AT91C_BASE_PMC->PMC_PLLR = AT91C_CKGR_USBDIV_1 | AT91C_CKGR_OUT_0 | AT91C_CKGR_PLLCOUNT |
|
||||
(AT91C_CKGR_MUL & (72 << 16)) | (AT91C_CKGR_DIV & 14);
|
||||
#ifndef SIMULATE
|
||||
// Wait for PLL stabilization
|
||||
while( !(AT91C_BASE_PMC->PMC_SR & AT91C_PMC_LOCK) );
|
||||
// Wait until the master clock is established for the case we already turn on the PLL
|
||||
while( !(AT91C_BASE_PMC->PMC_SR & AT91C_PMC_MCKRDY) );
|
||||
#endif
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
// Init PMC Step 3.
|
||||
// Selection of Master Clock MCK (equal to Processor Clock PCK) equal to PLL/2 = 48MHz
|
||||
// The PMC_MCKR register must not be programmed in a single write operation (see. Product Errata Sheet)
|
||||
/////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
AT91C_BASE_PMC->PMC_MCKR = AT91C_PMC_PRES_CLK_2;
|
||||
#ifndef SIMULATE
|
||||
// Wait until the master clock is established
|
||||
while( !(AT91C_BASE_PMC->PMC_SR & AT91C_PMC_MCKRDY) );
|
||||
#endif
|
||||
|
||||
AT91C_BASE_PMC->PMC_MCKR |= AT91C_PMC_CSS_PLL_CLK;
|
||||
#ifndef SIMULATE
|
||||
// Wait until the master clock is established
|
||||
while( !(AT91C_BASE_PMC->PMC_SR & AT91C_PMC_MCKRDY) );
|
||||
#endif
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
// Disable Watchdog (write once register)
|
||||
/////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
AT91C_BASE_WDTC->WDTC_WDMR = AT91C_WDTC_WDDIS;
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
// Init AIC: assign corresponding handler for each interrupt source
|
||||
/////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
AT91C_BASE_AIC->AIC_SVR[0] = (int) AT91F_Default_FIQ_handler ;
|
||||
for (i = 1; i < 31; i++) {
|
||||
AT91C_BASE_AIC->AIC_SVR[i] = (int) AT91F_Default_IRQ_handler ;
|
||||
}
|
||||
AT91C_BASE_AIC->AIC_SPU = (unsigned int) AT91F_Spurious_handler;
|
||||
}
|
||||
|
||||
@@ -1,43 +1,43 @@
|
||||
/*###ICF### Section handled by ICF editor, don't touch! ****/
|
||||
/*-Editor annotation file-*/
|
||||
/* IcfEditorFile="$TOOLKIT_DIR$\config\ide\IcfEditor\a_v1_0.xml" */
|
||||
/*-Specials-*/
|
||||
define symbol __ICFEDIT_intvec_start__ = 0x00000000;
|
||||
/*-Memory Regions-*/
|
||||
define symbol __ICFEDIT_region_ROM_start__ = 0x00000100;
|
||||
define symbol __ICFEDIT_region_ROM_end__ = 0x0003FFFF;
|
||||
define symbol __ICFEDIT_region_RAM_start__ = 0x00200000;
|
||||
define symbol __ICFEDIT_region_RAM_end__ = 0x0020FFFF;
|
||||
/*-Sizes-*/
|
||||
define symbol __ICFEDIT_size_cstack__ = 0x400;
|
||||
define symbol __ICFEDIT_size_svcstack__ = 0x100;
|
||||
define symbol __ICFEDIT_size_irqstack__ = 0x100;
|
||||
define symbol __ICFEDIT_size_fiqstack__ = 0x40;
|
||||
define symbol __ICFEDIT_size_undstack__ = 0x40;
|
||||
define symbol __ICFEDIT_size_abtstack__ = 0x40;
|
||||
define symbol __ICFEDIT_size_heap__ = 0x400;
|
||||
/**** End of ICF editor section. ###ICF###*/
|
||||
|
||||
|
||||
define memory mem with size = 4G;
|
||||
define region ROM_region = mem:[from __ICFEDIT_region_ROM_start__ to __ICFEDIT_region_ROM_end__];
|
||||
define region RAM_region = mem:[from __ICFEDIT_region_RAM_start__ to __ICFEDIT_region_RAM_end__];
|
||||
|
||||
define block CSTACK with alignment = 8, size = __ICFEDIT_size_cstack__ { };
|
||||
define block SVC_STACK with alignment = 8, size = __ICFEDIT_size_svcstack__ { };
|
||||
define block IRQ_STACK with alignment = 8, size = __ICFEDIT_size_irqstack__ { };
|
||||
define block FIQ_STACK with alignment = 8, size = __ICFEDIT_size_fiqstack__ { };
|
||||
define block UND_STACK with alignment = 8, size = __ICFEDIT_size_undstack__ { };
|
||||
define block ABT_STACK with alignment = 8, size = __ICFEDIT_size_abtstack__ { };
|
||||
define block HEAP with alignment = 8, size = __ICFEDIT_size_heap__ { };
|
||||
|
||||
initialize by copy { readwrite };
|
||||
do not initialize { section .noinit };
|
||||
|
||||
place at address mem:__ICFEDIT_intvec_start__ { readonly section .intvec };
|
||||
|
||||
place in ROM_region { readonly };
|
||||
place in RAM_region { readwrite,
|
||||
block CSTACK, block SVC_STACK, block IRQ_STACK, block FIQ_STACK,
|
||||
block UND_STACK, block ABT_STACK, block HEAP };
|
||||
|
||||
/*###ICF### Section handled by ICF editor, don't touch! ****/
|
||||
/*-Editor annotation file-*/
|
||||
/* IcfEditorFile="$TOOLKIT_DIR$\config\ide\IcfEditor\a_v1_0.xml" */
|
||||
/*-Specials-*/
|
||||
define symbol __ICFEDIT_intvec_start__ = 0x00000000;
|
||||
/*-Memory Regions-*/
|
||||
define symbol __ICFEDIT_region_ROM_start__ = 0x00000100;
|
||||
define symbol __ICFEDIT_region_ROM_end__ = 0x0003FFFF;
|
||||
define symbol __ICFEDIT_region_RAM_start__ = 0x00200000;
|
||||
define symbol __ICFEDIT_region_RAM_end__ = 0x0020FFFF;
|
||||
/*-Sizes-*/
|
||||
define symbol __ICFEDIT_size_cstack__ = 0x400;
|
||||
define symbol __ICFEDIT_size_svcstack__ = 0x100;
|
||||
define symbol __ICFEDIT_size_irqstack__ = 0x100;
|
||||
define symbol __ICFEDIT_size_fiqstack__ = 0x40;
|
||||
define symbol __ICFEDIT_size_undstack__ = 0x40;
|
||||
define symbol __ICFEDIT_size_abtstack__ = 0x40;
|
||||
define symbol __ICFEDIT_size_heap__ = 0x400;
|
||||
/**** End of ICF editor section. ###ICF###*/
|
||||
|
||||
|
||||
define memory mem with size = 4G;
|
||||
define region ROM_region = mem:[from __ICFEDIT_region_ROM_start__ to __ICFEDIT_region_ROM_end__];
|
||||
define region RAM_region = mem:[from __ICFEDIT_region_RAM_start__ to __ICFEDIT_region_RAM_end__];
|
||||
|
||||
define block CSTACK with alignment = 8, size = __ICFEDIT_size_cstack__ { };
|
||||
define block SVC_STACK with alignment = 8, size = __ICFEDIT_size_svcstack__ { };
|
||||
define block IRQ_STACK with alignment = 8, size = __ICFEDIT_size_irqstack__ { };
|
||||
define block FIQ_STACK with alignment = 8, size = __ICFEDIT_size_fiqstack__ { };
|
||||
define block UND_STACK with alignment = 8, size = __ICFEDIT_size_undstack__ { };
|
||||
define block ABT_STACK with alignment = 8, size = __ICFEDIT_size_abtstack__ { };
|
||||
define block HEAP with alignment = 8, size = __ICFEDIT_size_heap__ { };
|
||||
|
||||
initialize by copy { readwrite };
|
||||
do not initialize { section .noinit };
|
||||
|
||||
place at address mem:__ICFEDIT_intvec_start__ { readonly section .intvec };
|
||||
|
||||
place in ROM_region { readonly };
|
||||
place in RAM_region { readwrite,
|
||||
block CSTACK, block SVC_STACK, block IRQ_STACK, block FIQ_STACK,
|
||||
block UND_STACK, block ABT_STACK, block HEAP };
|
||||
|
||||
|
||||
@@ -1,42 +1,42 @@
|
||||
/*###ICF### Section handled by ICF editor, don't touch! ****/
|
||||
/*-Editor annotation file-*/
|
||||
/* IcfEditorFile="$TOOLKIT_DIR$\config\ide\IcfEditor\a_v1_0.xml" */
|
||||
/*-Specials-*/
|
||||
define symbol __ICFEDIT_intvec_start__ = 0x00000000;
|
||||
/*-Memory Regions-*/
|
||||
define symbol __ICFEDIT_region_ROM_start__ = 0x00;
|
||||
define symbol __ICFEDIT_region_ROM_end__ = 0x00;
|
||||
define symbol __ICFEDIT_region_RAM_start__ = 0x00000100;
|
||||
define symbol __ICFEDIT_region_RAM_end__ = 0x0000FFFF;
|
||||
/*-Sizes-*/
|
||||
define symbol __ICFEDIT_size_cstack__ = 0x400;
|
||||
define symbol __ICFEDIT_size_svcstack__ = 0x100;
|
||||
define symbol __ICFEDIT_size_irqstack__ = 0x100;
|
||||
define symbol __ICFEDIT_size_fiqstack__ = 0x40;
|
||||
define symbol __ICFEDIT_size_undstack__ = 0x40;
|
||||
define symbol __ICFEDIT_size_abtstack__ = 0x40;
|
||||
define symbol __ICFEDIT_size_heap__ = 0x800;
|
||||
/**** End of ICF editor section. ###ICF###*/
|
||||
|
||||
|
||||
define memory mem with size = 4G;
|
||||
define region RAM_region = mem:[from __ICFEDIT_region_RAM_start__ to __ICFEDIT_region_RAM_end__];
|
||||
|
||||
define block CSTACK with alignment = 8, size = __ICFEDIT_size_cstack__ { };
|
||||
define block SVC_STACK with alignment = 8, size = __ICFEDIT_size_svcstack__ { };
|
||||
define block IRQ_STACK with alignment = 8, size = __ICFEDIT_size_irqstack__ { };
|
||||
define block FIQ_STACK with alignment = 8, size = __ICFEDIT_size_fiqstack__ { };
|
||||
define block UND_STACK with alignment = 8, size = __ICFEDIT_size_undstack__ { };
|
||||
define block ABT_STACK with alignment = 8, size = __ICFEDIT_size_abtstack__ { };
|
||||
define block HEAP with alignment = 8, size = __ICFEDIT_size_heap__ { };
|
||||
|
||||
initialize by copy { readwrite };
|
||||
do not initialize { section .noinit };
|
||||
|
||||
place at address mem:__ICFEDIT_intvec_start__ { readonly section .intvec };
|
||||
|
||||
place in RAM_region { readonly };
|
||||
place in RAM_region { readwrite,
|
||||
block CSTACK, block SVC_STACK, block IRQ_STACK, block FIQ_STACK,
|
||||
block UND_STACK, block ABT_STACK, block HEAP };
|
||||
|
||||
/*###ICF### Section handled by ICF editor, don't touch! ****/
|
||||
/*-Editor annotation file-*/
|
||||
/* IcfEditorFile="$TOOLKIT_DIR$\config\ide\IcfEditor\a_v1_0.xml" */
|
||||
/*-Specials-*/
|
||||
define symbol __ICFEDIT_intvec_start__ = 0x00000000;
|
||||
/*-Memory Regions-*/
|
||||
define symbol __ICFEDIT_region_ROM_start__ = 0x00;
|
||||
define symbol __ICFEDIT_region_ROM_end__ = 0x00;
|
||||
define symbol __ICFEDIT_region_RAM_start__ = 0x00000100;
|
||||
define symbol __ICFEDIT_region_RAM_end__ = 0x0000FFFF;
|
||||
/*-Sizes-*/
|
||||
define symbol __ICFEDIT_size_cstack__ = 0x400;
|
||||
define symbol __ICFEDIT_size_svcstack__ = 0x100;
|
||||
define symbol __ICFEDIT_size_irqstack__ = 0x100;
|
||||
define symbol __ICFEDIT_size_fiqstack__ = 0x40;
|
||||
define symbol __ICFEDIT_size_undstack__ = 0x40;
|
||||
define symbol __ICFEDIT_size_abtstack__ = 0x40;
|
||||
define symbol __ICFEDIT_size_heap__ = 0x800;
|
||||
/**** End of ICF editor section. ###ICF###*/
|
||||
|
||||
|
||||
define memory mem with size = 4G;
|
||||
define region RAM_region = mem:[from __ICFEDIT_region_RAM_start__ to __ICFEDIT_region_RAM_end__];
|
||||
|
||||
define block CSTACK with alignment = 8, size = __ICFEDIT_size_cstack__ { };
|
||||
define block SVC_STACK with alignment = 8, size = __ICFEDIT_size_svcstack__ { };
|
||||
define block IRQ_STACK with alignment = 8, size = __ICFEDIT_size_irqstack__ { };
|
||||
define block FIQ_STACK with alignment = 8, size = __ICFEDIT_size_fiqstack__ { };
|
||||
define block UND_STACK with alignment = 8, size = __ICFEDIT_size_undstack__ { };
|
||||
define block ABT_STACK with alignment = 8, size = __ICFEDIT_size_abtstack__ { };
|
||||
define block HEAP with alignment = 8, size = __ICFEDIT_size_heap__ { };
|
||||
|
||||
initialize by copy { readwrite };
|
||||
do not initialize { section .noinit };
|
||||
|
||||
place at address mem:__ICFEDIT_intvec_start__ { readonly section .intvec };
|
||||
|
||||
place in RAM_region { readonly };
|
||||
place in RAM_region { readwrite,
|
||||
block CSTACK, block SVC_STACK, block IRQ_STACK, block FIQ_STACK,
|
||||
block UND_STACK, block ABT_STACK, block HEAP };
|
||||
|
||||
|
||||
+4204
-4204
File diff suppressed because it is too large
Load Diff
+2426
-2426
File diff suppressed because it is too large
Load Diff
@@ -1,61 +1,61 @@
|
||||
// ----------------------------------------------------------------------------
|
||||
// ATMEL Microcontroller Software Support - ROUSSET -
|
||||
// ----------------------------------------------------------------------------
|
||||
// DISCLAIMER: THIS SOFTWARE IS PROVIDED BY ATMEL "AS IS" AND ANY EXPRESS OR
|
||||
// IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
|
||||
// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT ARE
|
||||
// DISCLAIMED. IN NO EVENT SHALL ATMEL BE LIABLE FOR ANY DIRECT, INDIRECT,
|
||||
// INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
|
||||
// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA,
|
||||
// OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
|
||||
// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
|
||||
// NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,
|
||||
// EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
// ----------------------------------------------------------------------------
|
||||
// File Name : AT91SAM7X-EK.h
|
||||
// Object : AT91SAM7X-EK Evaluation Board Features Definition File
|
||||
//
|
||||
// ----------------------------------------------------------------------------
|
||||
|
||||
#ifndef AT91SAM7X_EK_H
|
||||
#define AT91SAM7X_EK_H
|
||||
|
||||
/*-----------------*/
|
||||
/* LEDs Definition */
|
||||
/*-----------------*/
|
||||
#define AT91B_LED1 (1<<19) // AT91C_PIO_PB19 AT91C_PB19_PWM0 AT91C_PB19_TCLK1
|
||||
#define AT91B_LED2 (1<<20) // AT91C_PIO_PB20 AT91C_PB20_PWM1 AT91C_PB20_PWM1
|
||||
#define AT91B_LED3 (AT91C_PIO_PB21) // AT91C_PIO_PB21 AT91C_PB21_PWM2 AT91C_PB21_PCK1
|
||||
#define AT91B_LED4 (AT91C_PIO_PB22) // AT91C_PIO_PB22 AT91C_PB22_PWM3 AT91C_PB22_PCK2
|
||||
#define AT91B_NB_LEB 4
|
||||
#define AT91B_LED_MASK (AT91B_LED1|AT91B_LED2|AT91B_LED3|AT91B_LED4)
|
||||
#define AT91D_BASE_PIO_LED (AT91C_BASE_PIOB)
|
||||
|
||||
#define AT91B_POWERLED (1<<25) // PB25
|
||||
|
||||
|
||||
/*-------------------------------*/
|
||||
/* JOYSTICK Position Definition */
|
||||
/*-------------------------------*/
|
||||
#define AT91B_SW1 (1<<21) // PA21 Up Button AT91C_PA21_TF AT91C_PA21_NPCS10
|
||||
#define AT91B_SW2 (1<<22) // PA22 Down Button AT91C_PA22_TK AT91C_PA22_SPCK1
|
||||
#define AT91B_SW3 (1<<23) // PA23 Left Button AT91C_PA23_TD AT91C_PA23_MOSI1
|
||||
#define AT91B_SW4 (1<<24) // PA24 Right Button AT91C_PA24_RD AT91C_PA24_MISO1
|
||||
#define AT91B_SW5 (1<<25) // PA25 Push Button AT91C_PA25_RK AT91C_PA25_NPCS11
|
||||
#define AT91B_SW_MASK (AT91B_SW1|AT91B_SW2|AT91B_SW3|AT91B_SW4|AT91B_SW5)
|
||||
|
||||
|
||||
#define AT91D_BASE_PIO_SW (AT91C_BASE_PIOA)
|
||||
|
||||
/*------------------*/
|
||||
/* CAN Definition */
|
||||
/*------------------*/
|
||||
#define AT91B_CAN_TRANSCEIVER_RS (1<<2) // PA2
|
||||
|
||||
/*--------------*/
|
||||
/* Clocks */
|
||||
/*--------------*/
|
||||
#define AT91B_MAIN_OSC 18432000 // Main Oscillator MAINCK
|
||||
#define AT91B_MCK ((18432000*73/14)/2) // Output PLL Clock
|
||||
|
||||
#endif /* AT91SAM7X-EK_H */
|
||||
// ----------------------------------------------------------------------------
|
||||
// ATMEL Microcontroller Software Support - ROUSSET -
|
||||
// ----------------------------------------------------------------------------
|
||||
// DISCLAIMER: THIS SOFTWARE IS PROVIDED BY ATMEL "AS IS" AND ANY EXPRESS OR
|
||||
// IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
|
||||
// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT ARE
|
||||
// DISCLAIMED. IN NO EVENT SHALL ATMEL BE LIABLE FOR ANY DIRECT, INDIRECT,
|
||||
// INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
|
||||
// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA,
|
||||
// OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
|
||||
// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
|
||||
// NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,
|
||||
// EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
// ----------------------------------------------------------------------------
|
||||
// File Name : AT91SAM7X-EK.h
|
||||
// Object : AT91SAM7X-EK Evaluation Board Features Definition File
|
||||
//
|
||||
// ----------------------------------------------------------------------------
|
||||
|
||||
#ifndef AT91SAM7X_EK_H
|
||||
#define AT91SAM7X_EK_H
|
||||
|
||||
/*-----------------*/
|
||||
/* LEDs Definition */
|
||||
/*-----------------*/
|
||||
#define AT91B_LED1 (1<<19) // AT91C_PIO_PB19 AT91C_PB19_PWM0 AT91C_PB19_TCLK1
|
||||
#define AT91B_LED2 (1<<20) // AT91C_PIO_PB20 AT91C_PB20_PWM1 AT91C_PB20_PWM1
|
||||
#define AT91B_LED3 (AT91C_PIO_PB21) // AT91C_PIO_PB21 AT91C_PB21_PWM2 AT91C_PB21_PCK1
|
||||
#define AT91B_LED4 (AT91C_PIO_PB22) // AT91C_PIO_PB22 AT91C_PB22_PWM3 AT91C_PB22_PCK2
|
||||
#define AT91B_NB_LEB 4
|
||||
#define AT91B_LED_MASK (AT91B_LED1|AT91B_LED2|AT91B_LED3|AT91B_LED4)
|
||||
#define AT91D_BASE_PIO_LED (AT91C_BASE_PIOB)
|
||||
|
||||
#define AT91B_POWERLED (1<<25) // PB25
|
||||
|
||||
|
||||
/*-------------------------------*/
|
||||
/* JOYSTICK Position Definition */
|
||||
/*-------------------------------*/
|
||||
#define AT91B_SW1 (1<<21) // PA21 Up Button AT91C_PA21_TF AT91C_PA21_NPCS10
|
||||
#define AT91B_SW2 (1<<22) // PA22 Down Button AT91C_PA22_TK AT91C_PA22_SPCK1
|
||||
#define AT91B_SW3 (1<<23) // PA23 Left Button AT91C_PA23_TD AT91C_PA23_MOSI1
|
||||
#define AT91B_SW4 (1<<24) // PA24 Right Button AT91C_PA24_RD AT91C_PA24_MISO1
|
||||
#define AT91B_SW5 (1<<25) // PA25 Push Button AT91C_PA25_RK AT91C_PA25_NPCS11
|
||||
#define AT91B_SW_MASK (AT91B_SW1|AT91B_SW2|AT91B_SW3|AT91B_SW4|AT91B_SW5)
|
||||
|
||||
|
||||
#define AT91D_BASE_PIO_SW (AT91C_BASE_PIOA)
|
||||
|
||||
/*------------------*/
|
||||
/* CAN Definition */
|
||||
/*------------------*/
|
||||
#define AT91B_CAN_TRANSCEIVER_RS (1<<2) // PA2
|
||||
|
||||
/*--------------*/
|
||||
/* Clocks */
|
||||
/*--------------*/
|
||||
#define AT91B_MAIN_OSC 18432000 // Main Oscillator MAINCK
|
||||
#define AT91B_MCK ((18432000*73/14)/2) // Output PLL Clock
|
||||
|
||||
#endif /* AT91SAM7X-EK_H */
|
||||
|
||||
+2268
-2268
File diff suppressed because it is too large
Load Diff
+4211
-4211
File diff suppressed because it is too large
Load Diff
+30
-30
@@ -1,30 +1,30 @@
|
||||
//-----------------------------------------------------------------------------
|
||||
// ATMEL Microcontroller Software Support - ROUSSET -
|
||||
//-----------------------------------------------------------------------------
|
||||
// DISCLAIMER: THIS SOFTWARE IS PROVIDED BY ATMEL "AS IS" AND ANY EXPRESS OR
|
||||
// IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
|
||||
// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT ARE
|
||||
// DISCLAIMED. IN NO EVENT SHALL ATMEL BE LIABLE FOR ANY DIRECT, INDIRECT,
|
||||
// INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
|
||||
// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA,
|
||||
// OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
|
||||
// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
|
||||
// NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,
|
||||
// EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
//-----------------------------------------------------------------------------
|
||||
// File Name : project.h
|
||||
// Object : project specific include file to AT91SAM7X256
|
||||
// Creation : JPP 14-Sep-2006
|
||||
//-----------------------------------------------------------------------------
|
||||
#ifndef _PROJECT_H
|
||||
#define _PROJECT_H
|
||||
|
||||
/// Include your AT91 Library files and specific compiler definitions
|
||||
|
||||
#include <intrinsics.h>
|
||||
#include "AT91SAM7X-EK.h"
|
||||
#include "AT91SAM7X256.h"
|
||||
#define __inline inline
|
||||
#include "lib_AT91SAM7X256.h"
|
||||
|
||||
#endif // _PROJECT_H
|
||||
//-----------------------------------------------------------------------------
|
||||
// ATMEL Microcontroller Software Support - ROUSSET -
|
||||
//-----------------------------------------------------------------------------
|
||||
// DISCLAIMER: THIS SOFTWARE IS PROVIDED BY ATMEL "AS IS" AND ANY EXPRESS OR
|
||||
// IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
|
||||
// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT ARE
|
||||
// DISCLAIMED. IN NO EVENT SHALL ATMEL BE LIABLE FOR ANY DIRECT, INDIRECT,
|
||||
// INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
|
||||
// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA,
|
||||
// OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
|
||||
// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
|
||||
// NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,
|
||||
// EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
//-----------------------------------------------------------------------------
|
||||
// File Name : project.h
|
||||
// Object : project specific include file to AT91SAM7X256
|
||||
// Creation : JPP 14-Sep-2006
|
||||
//-----------------------------------------------------------------------------
|
||||
#ifndef _PROJECT_H
|
||||
#define _PROJECT_H
|
||||
|
||||
/// Include your AT91 Library files and specific compiler definitions
|
||||
|
||||
#include <intrinsics.h>
|
||||
#include "AT91SAM7X-EK.h"
|
||||
#include "AT91SAM7X256.h"
|
||||
#define __inline inline
|
||||
#include "lib_AT91SAM7X256.h"
|
||||
|
||||
#endif // _PROJECT_H
|
||||
|
||||
@@ -1,33 +1,33 @@
|
||||
@REM This bat file has been generated by the IAR Embeddded Workbench
|
||||
@REM C-SPY interactive debugger,as an aid to preparing a command
|
||||
@REM line for running the cspybat command line utility with the
|
||||
@REM appropriate settings.
|
||||
@REM
|
||||
@REM After making some adjustments to this file, you can launch cspybat
|
||||
@REM by typing the name of this file followed by the name of the debug
|
||||
@REM file (usually an ubrof file). Note that this file is generated
|
||||
@REM every time a new debug session is initialized, so you may want to
|
||||
@REM move or rename the file before making changes.
|
||||
@REM
|
||||
@REM Note: some command line arguments cannot be properly generated
|
||||
@REM by this process. Specifically, the plugin which is responsible
|
||||
@REM for the Terminal I/O window (and other C runtime functionality)
|
||||
@REM comes in a special version for cspybat, and the name of that
|
||||
@REM plugin dll is not known when generating this file. It resides in
|
||||
@REM the $TOOLKIT_DIR$\bin folder and is usually called XXXbat.dll or
|
||||
@REM XXXlibsupportbat.dll, where XXX is the name of the corresponding
|
||||
@REM tool chain. Replace the '<libsupport_plugin>' parameter
|
||||
@REM below with the appropriate file name. Other plugins loaded by
|
||||
@REM C-SPY are usually not needed by, or will not work in, cspybat
|
||||
@REM but they are listed at the end of this file for reference.
|
||||
|
||||
|
||||
"C:\Program Files\IAR Systems\Embedded Workbench 5.0 Kickstart\common\bin\cspybat" "C:\Program Files\IAR Systems\Embedded Workbench 5.0 Kickstart\ARM\bin\armproc.dll" "C:\Program Files\IAR Systems\Embedded Workbench 5.0 Kickstart\ARM\bin\armjlink.dll" %1 --plugin "C:\Program Files\IAR Systems\Embedded Workbench 5.0 Kickstart\ARM\bin\<libsupport_plugin>" --macro "C:\Documents and Settings\Greg\Desktop\SAM7X256\AT91SAM7X-Interrupt_SAM7X\Compil\resource\SAM7_FLASH.mac" --backend -B "--endian=little" "--cpu=ARM7TDMI" "--fpu=None" "-p" "C:\Program Files\IAR Systems\Embedded Workbench 5.0 Kickstart\ARM\CONFIG\debugger\Atmel\ioAT91SAM7X256.ddf" "--drv_verify_download" "--semihosting" "--device=AT91SAM7X256" "-d" "jlink" "--drv_communication=USB0" "--jlink_speed=adaptive"
|
||||
|
||||
|
||||
@REM Loaded plugins:
|
||||
@REM C:\Program Files\IAR Systems\Embedded Workbench 5.0 Kickstart\ARM\bin\armlibsupport.dll
|
||||
@REM C:\Program Files\IAR Systems\Embedded Workbench 5.0 Kickstart\common\plugins\CodeCoverage\CodeCoverage.dll
|
||||
@REM C:\Program Files\IAR Systems\Embedded Workbench 5.0 Kickstart\common\plugins\Profiling\Profiling.dll
|
||||
@REM C:\Program Files\IAR Systems\Embedded Workbench 5.0 Kickstart\common\plugins\stack\stack.dll
|
||||
@REM C:\Program Files\IAR Systems\Embedded Workbench 5.0 Kickstart\common\plugins\SymList\SymList.dll
|
||||
@REM This bat file has been generated by the IAR Embeddded Workbench
|
||||
@REM C-SPY interactive debugger,as an aid to preparing a command
|
||||
@REM line for running the cspybat command line utility with the
|
||||
@REM appropriate settings.
|
||||
@REM
|
||||
@REM After making some adjustments to this file, you can launch cspybat
|
||||
@REM by typing the name of this file followed by the name of the debug
|
||||
@REM file (usually an ubrof file). Note that this file is generated
|
||||
@REM every time a new debug session is initialized, so you may want to
|
||||
@REM move or rename the file before making changes.
|
||||
@REM
|
||||
@REM Note: some command line arguments cannot be properly generated
|
||||
@REM by this process. Specifically, the plugin which is responsible
|
||||
@REM for the Terminal I/O window (and other C runtime functionality)
|
||||
@REM comes in a special version for cspybat, and the name of that
|
||||
@REM plugin dll is not known when generating this file. It resides in
|
||||
@REM the $TOOLKIT_DIR$\bin folder and is usually called XXXbat.dll or
|
||||
@REM XXXlibsupportbat.dll, where XXX is the name of the corresponding
|
||||
@REM tool chain. Replace the '<libsupport_plugin>' parameter
|
||||
@REM below with the appropriate file name. Other plugins loaded by
|
||||
@REM C-SPY are usually not needed by, or will not work in, cspybat
|
||||
@REM but they are listed at the end of this file for reference.
|
||||
|
||||
|
||||
"C:\Program Files\IAR Systems\Embedded Workbench 5.0 Kickstart\common\bin\cspybat" "C:\Program Files\IAR Systems\Embedded Workbench 5.0 Kickstart\ARM\bin\armproc.dll" "C:\Program Files\IAR Systems\Embedded Workbench 5.0 Kickstart\ARM\bin\armjlink.dll" %1 --plugin "C:\Program Files\IAR Systems\Embedded Workbench 5.0 Kickstart\ARM\bin\<libsupport_plugin>" --macro "C:\Documents and Settings\Greg\Desktop\SAM7X256\AT91SAM7X-Interrupt_SAM7X\Compil\resource\SAM7_FLASH.mac" --backend -B "--endian=little" "--cpu=ARM7TDMI" "--fpu=None" "-p" "C:\Program Files\IAR Systems\Embedded Workbench 5.0 Kickstart\ARM\CONFIG\debugger\Atmel\ioAT91SAM7X256.ddf" "--drv_verify_download" "--semihosting" "--device=AT91SAM7X256" "-d" "jlink" "--drv_communication=USB0" "--jlink_speed=adaptive"
|
||||
|
||||
|
||||
@REM Loaded plugins:
|
||||
@REM C:\Program Files\IAR Systems\Embedded Workbench 5.0 Kickstart\ARM\bin\armlibsupport.dll
|
||||
@REM C:\Program Files\IAR Systems\Embedded Workbench 5.0 Kickstart\common\plugins\CodeCoverage\CodeCoverage.dll
|
||||
@REM C:\Program Files\IAR Systems\Embedded Workbench 5.0 Kickstart\common\plugins\Profiling\Profiling.dll
|
||||
@REM C:\Program Files\IAR Systems\Embedded Workbench 5.0 Kickstart\common\plugins\stack\stack.dll
|
||||
@REM C:\Program Files\IAR Systems\Embedded Workbench 5.0 Kickstart\common\plugins\SymList\SymList.dll
|
||||
|
||||
@@ -1,12 +1,12 @@
|
||||
[FLASH]
|
||||
SkipProgOnCRCMatch = 1
|
||||
VerifyDownload = 1
|
||||
AllowCaching = 1
|
||||
EnableFlashDL = 2
|
||||
Override = 0
|
||||
Device="ADUC7020X62"
|
||||
[BREAKPOINTS]
|
||||
ShowInfoWin = 1
|
||||
EnableFlashBP = 2
|
||||
[CPU]
|
||||
AllowSimulation = 1
|
||||
[FLASH]
|
||||
SkipProgOnCRCMatch = 1
|
||||
VerifyDownload = 1
|
||||
AllowCaching = 1
|
||||
EnableFlashDL = 2
|
||||
Override = 0
|
||||
Device="ADUC7020X62"
|
||||
[BREAKPOINTS]
|
||||
ShowInfoWin = 1
|
||||
EnableFlashBP = 2
|
||||
[CPU]
|
||||
AllowSimulation = 1
|
||||
|
||||
@@ -1,33 +1,33 @@
|
||||
@REM This bat file has been generated by the IAR Embeddded Workbench
|
||||
@REM C-SPY interactive debugger,as an aid to preparing a command
|
||||
@REM line for running the cspybat command line utility with the
|
||||
@REM appropriate settings.
|
||||
@REM
|
||||
@REM After making some adjustments to this file, you can launch cspybat
|
||||
@REM by typing the name of this file followed by the name of the debug
|
||||
@REM file (usually an ubrof file). Note that this file is generated
|
||||
@REM every time a new debug session is initialized, so you may want to
|
||||
@REM move or rename the file before making changes.
|
||||
@REM
|
||||
@REM Note: some command line arguments cannot be properly generated
|
||||
@REM by this process. Specifically, the plugin which is responsible
|
||||
@REM for the Terminal I/O window (and other C runtime functionality)
|
||||
@REM comes in a special version for cspybat, and the name of that
|
||||
@REM plugin dll is not known when generating this file. It resides in
|
||||
@REM the $TOOLKIT_DIR$\bin folder and is usually called XXXbat.dll or
|
||||
@REM XXXlibsupportbat.dll, where XXX is the name of the corresponding
|
||||
@REM tool chain. Replace the '<libsupport_plugin>' parameter
|
||||
@REM below with the appropriate file name. Other plugins loaded by
|
||||
@REM C-SPY are usually not needed by, or will not work in, cspybat
|
||||
@REM but they are listed at the end of this file for reference.
|
||||
|
||||
|
||||
"C:\Program Files\IAR Systems\Embedded Workbench 5.0 Kickstart\common\bin\cspybat" "C:\Program Files\IAR Systems\Embedded Workbench 5.0 Kickstart\ARM\bin\armproc.dll" "C:\Program Files\IAR Systems\Embedded Workbench 5.0 Kickstart\ARM\bin\armjlink.dll" %1 --plugin "C:\Program Files\IAR Systems\Embedded Workbench 5.0 Kickstart\ARM\bin\<libsupport_plugin>" --macro "C:\svn\cmock\iar\iar_v5\Resource\SAM7_RAM.mac" --backend -B "--endian=little" "--cpu=ARM7TDMI" "--fpu=None" "-p" "C:\Program Files\IAR Systems\Embedded Workbench 5.0 Kickstart\ARM\CONFIG\debugger\Atmel\ioAT91SAM7X256.ddf" "--drv_verify_download" "--semihosting" "--device=AT91SAM7X256" "-d" "jlink" "--drv_communication=USB0" "--jlink_speed=adaptive"
|
||||
|
||||
|
||||
@REM Loaded plugins:
|
||||
@REM C:\Program Files\IAR Systems\Embedded Workbench 5.0 Kickstart\ARM\bin\armlibsupport.dll
|
||||
@REM C:\Program Files\IAR Systems\Embedded Workbench 5.0 Kickstart\common\plugins\CodeCoverage\CodeCoverage.dll
|
||||
@REM C:\Program Files\IAR Systems\Embedded Workbench 5.0 Kickstart\common\plugins\Profiling\Profiling.dll
|
||||
@REM C:\Program Files\IAR Systems\Embedded Workbench 5.0 Kickstart\common\plugins\stack\stack.dll
|
||||
@REM C:\Program Files\IAR Systems\Embedded Workbench 5.0 Kickstart\common\plugins\SymList\SymList.dll
|
||||
@REM This bat file has been generated by the IAR Embeddded Workbench
|
||||
@REM C-SPY interactive debugger,as an aid to preparing a command
|
||||
@REM line for running the cspybat command line utility with the
|
||||
@REM appropriate settings.
|
||||
@REM
|
||||
@REM After making some adjustments to this file, you can launch cspybat
|
||||
@REM by typing the name of this file followed by the name of the debug
|
||||
@REM file (usually an ubrof file). Note that this file is generated
|
||||
@REM every time a new debug session is initialized, so you may want to
|
||||
@REM move or rename the file before making changes.
|
||||
@REM
|
||||
@REM Note: some command line arguments cannot be properly generated
|
||||
@REM by this process. Specifically, the plugin which is responsible
|
||||
@REM for the Terminal I/O window (and other C runtime functionality)
|
||||
@REM comes in a special version for cspybat, and the name of that
|
||||
@REM plugin dll is not known when generating this file. It resides in
|
||||
@REM the $TOOLKIT_DIR$\bin folder and is usually called XXXbat.dll or
|
||||
@REM XXXlibsupportbat.dll, where XXX is the name of the corresponding
|
||||
@REM tool chain. Replace the '<libsupport_plugin>' parameter
|
||||
@REM below with the appropriate file name. Other plugins loaded by
|
||||
@REM C-SPY are usually not needed by, or will not work in, cspybat
|
||||
@REM but they are listed at the end of this file for reference.
|
||||
|
||||
|
||||
"C:\Program Files\IAR Systems\Embedded Workbench 5.0 Kickstart\common\bin\cspybat" "C:\Program Files\IAR Systems\Embedded Workbench 5.0 Kickstart\ARM\bin\armproc.dll" "C:\Program Files\IAR Systems\Embedded Workbench 5.0 Kickstart\ARM\bin\armjlink.dll" %1 --plugin "C:\Program Files\IAR Systems\Embedded Workbench 5.0 Kickstart\ARM\bin\<libsupport_plugin>" --macro "C:\svn\cmock\iar\iar_v5\Resource\SAM7_RAM.mac" --backend -B "--endian=little" "--cpu=ARM7TDMI" "--fpu=None" "-p" "C:\Program Files\IAR Systems\Embedded Workbench 5.0 Kickstart\ARM\CONFIG\debugger\Atmel\ioAT91SAM7X256.ddf" "--drv_verify_download" "--semihosting" "--device=AT91SAM7X256" "-d" "jlink" "--drv_communication=USB0" "--jlink_speed=adaptive"
|
||||
|
||||
|
||||
@REM Loaded plugins:
|
||||
@REM C:\Program Files\IAR Systems\Embedded Workbench 5.0 Kickstart\ARM\bin\armlibsupport.dll
|
||||
@REM C:\Program Files\IAR Systems\Embedded Workbench 5.0 Kickstart\common\plugins\CodeCoverage\CodeCoverage.dll
|
||||
@REM C:\Program Files\IAR Systems\Embedded Workbench 5.0 Kickstart\common\plugins\Profiling\Profiling.dll
|
||||
@REM C:\Program Files\IAR Systems\Embedded Workbench 5.0 Kickstart\common\plugins\stack\stack.dll
|
||||
@REM C:\Program Files\IAR Systems\Embedded Workbench 5.0 Kickstart\common\plugins\SymList\SymList.dll
|
||||
|
||||
@@ -1,12 +1,12 @@
|
||||
[FLASH]
|
||||
SkipProgOnCRCMatch = 1
|
||||
VerifyDownload = 1
|
||||
AllowCaching = 1
|
||||
EnableFlashDL = 2
|
||||
Override = 0
|
||||
Device="ADUC7020X62"
|
||||
[BREAKPOINTS]
|
||||
ShowInfoWin = 1
|
||||
EnableFlashBP = 2
|
||||
[CPU]
|
||||
AllowSimulation = 1
|
||||
[FLASH]
|
||||
SkipProgOnCRCMatch = 1
|
||||
VerifyDownload = 1
|
||||
AllowCaching = 1
|
||||
EnableFlashDL = 2
|
||||
Override = 0
|
||||
Device="ADUC7020X62"
|
||||
[BREAKPOINTS]
|
||||
ShowInfoWin = 1
|
||||
EnableFlashBP = 2
|
||||
[CPU]
|
||||
AllowSimulation = 1
|
||||
|
||||
@@ -1,12 +1,12 @@
|
||||
[FLASH]
|
||||
SkipProgOnCRCMatch = 1
|
||||
VerifyDownload = 1
|
||||
AllowCaching = 1
|
||||
EnableFlashDL = 2
|
||||
Override = 0
|
||||
Device="ADUC7020X62"
|
||||
[BREAKPOINTS]
|
||||
ShowInfoWin = 1
|
||||
EnableFlashBP = 2
|
||||
[CPU]
|
||||
AllowSimulation = 1
|
||||
[FLASH]
|
||||
SkipProgOnCRCMatch = 1
|
||||
VerifyDownload = 1
|
||||
AllowCaching = 1
|
||||
EnableFlashDL = 2
|
||||
Override = 0
|
||||
Device="ADUC7020X62"
|
||||
[BREAKPOINTS]
|
||||
ShowInfoWin = 1
|
||||
EnableFlashBP = 2
|
||||
[CPU]
|
||||
AllowSimulation = 1
|
||||
|
||||
@@ -1,12 +1,12 @@
|
||||
[FLASH]
|
||||
SkipProgOnCRCMatch = 1
|
||||
VerifyDownload = 1
|
||||
AllowCaching = 1
|
||||
EnableFlashDL = 2
|
||||
Override = 0
|
||||
Device="ADUC7020X62"
|
||||
[BREAKPOINTS]
|
||||
ShowInfoWin = 1
|
||||
EnableFlashBP = 2
|
||||
[CPU]
|
||||
AllowSimulation = 1
|
||||
[FLASH]
|
||||
SkipProgOnCRCMatch = 1
|
||||
VerifyDownload = 1
|
||||
AllowCaching = 1
|
||||
EnableFlashDL = 2
|
||||
Override = 0
|
||||
Device="ADUC7020X62"
|
||||
[BREAKPOINTS]
|
||||
ShowInfoWin = 1
|
||||
EnableFlashBP = 2
|
||||
[CPU]
|
||||
AllowSimulation = 1
|
||||
|
||||
+299
-299
@@ -1,299 +1,299 @@
|
||||
;* ----------------------------------------------------------------------------
|
||||
;* ATMEL Microcontroller Software Support - ROUSSET -
|
||||
;* ----------------------------------------------------------------------------
|
||||
;* Copyright (c) 2006, Atmel Corporation
|
||||
;
|
||||
;* All rights reserved.
|
||||
;*
|
||||
;* Redistribution and use in source and binary forms, with or without
|
||||
;* modification, are permitted provided that the following conditions are met:
|
||||
;*
|
||||
;* - Redistributions of source code must retain the above copyright notice,
|
||||
;* this list of conditions and the disclaimer below.
|
||||
;*
|
||||
;* - Redistributions in binary form must reproduce the above copyright notice,
|
||||
;* this list of conditions and the disclaimer below in the documentation and/or
|
||||
;* other materials provided with the distribution.
|
||||
;*
|
||||
;* Atmel's name may not be used to endorse or promote products derived from
|
||||
;* this software without specific prior written permission.
|
||||
;*
|
||||
;* DISCLAIMER: THIS SOFTWARE IS PROVIDED BY ATMEL "AS IS" AND ANY EXPRESS OR
|
||||
;* IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
|
||||
;* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT ARE
|
||||
;* DISCLAIMED. IN NO EVENT SHALL ATMEL BE LIABLE FOR ANY DIRECT, INDIRECT,
|
||||
;* INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
|
||||
;* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA,
|
||||
;* OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
|
||||
;* LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
|
||||
;* NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,
|
||||
;* EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
;* ----------------------------------------------------------------------------
|
||||
|
||||
;------------------------------------------------------------------------------
|
||||
; Include your AT91 Library files
|
||||
;------------------------------------------------------------------------------
|
||||
#include "AT91SAM7X256_inc.h"
|
||||
;------------------------------------------------------------------------------
|
||||
|
||||
#define TOP_OF_MEMORY (AT91C_ISRAM + AT91C_ISRAM_SIZE)
|
||||
#define IRQ_STACK_SIZE (3*8*4)
|
||||
; 3 words to be saved per interrupt priority level
|
||||
|
||||
; Mode, correspords to bits 0-5 in CPSR
|
||||
MODE_BITS DEFINE 0x1F ; Bit mask for mode bits in CPSR
|
||||
USR_MODE DEFINE 0x10 ; User mode
|
||||
FIQ_MODE DEFINE 0x11 ; Fast Interrupt Request mode
|
||||
IRQ_MODE DEFINE 0x12 ; Interrupt Request mode
|
||||
SVC_MODE DEFINE 0x13 ; Supervisor mode
|
||||
ABT_MODE DEFINE 0x17 ; Abort mode
|
||||
UND_MODE DEFINE 0x1B ; Undefined Instruction mode
|
||||
SYS_MODE DEFINE 0x1F ; System mode
|
||||
|
||||
I_BIT DEFINE 0x80
|
||||
F_BIT DEFINE 0x40
|
||||
|
||||
;------------------------------------------------------------------------------
|
||||
; ?RESET
|
||||
; Reset Vector.
|
||||
; Normally, segment INTVEC is linked at address 0.
|
||||
; For debugging purposes, INTVEC may be placed at other addresses.
|
||||
; A debugger that honors the entry point will start the
|
||||
; program in a normal way even if INTVEC is not at address 0.
|
||||
;------------------------------------------------------------------------------
|
||||
SECTION .intvec:CODE:NOROOT(2)
|
||||
PUBLIC __vector
|
||||
PUBLIC __iar_program_start
|
||||
|
||||
ARM
|
||||
__vector:
|
||||
ldr pc,[pc,#+24] ;; Reset
|
||||
__und_handler:
|
||||
ldr pc,[pc,#+24] ;; Undefined instructions
|
||||
__swi_handler:
|
||||
ldr pc,[pc,#+24] ;; Software interrupt (SWI/SVC)
|
||||
__prefetch_handler:
|
||||
ldr pc,[pc,#+24] ;; Prefetch abort
|
||||
__data_handler:
|
||||
ldr pc,[pc,#+24] ;; Data abort
|
||||
DC32 0xFFFFFFFF ;; RESERVED
|
||||
__irq_handler:
|
||||
ldr pc,[pc,#+24] ;; IRQ
|
||||
__fiq_handler:
|
||||
ldr pc,[pc,#+24] ;; FIQ
|
||||
|
||||
DC32 __iar_program_start
|
||||
DC32 __und_handler
|
||||
DC32 __swi_handler
|
||||
DC32 __prefetch_handler
|
||||
DC32 __data_handler
|
||||
B .
|
||||
DC32 IRQ_Handler_Entry
|
||||
DC32 FIQ_Handler_Entry
|
||||
|
||||
;------------------------------------------------------------------------------
|
||||
;- Manage exception: The exception must be ensure in ARM mode
|
||||
;------------------------------------------------------------------------------
|
||||
SECTION text:CODE:NOROOT(2)
|
||||
ARM
|
||||
;------------------------------------------------------------------------------
|
||||
;- Function : FIQ_Handler_Entry
|
||||
;- Treatments : FIQ Controller Interrupt Handler.
|
||||
;- R8 is initialize in Cstartup
|
||||
;- Called Functions : None only by FIQ
|
||||
;------------------------------------------------------------------------------
|
||||
FIQ_Handler_Entry:
|
||||
|
||||
;- Switch in SVC/User Mode to allow User Stack access for C code
|
||||
; because the FIQ is not yet acknowledged
|
||||
|
||||
;- Save and r0 in FIQ_Register
|
||||
mov r9,r0
|
||||
ldr r0 , [r8, #AIC_FVR]
|
||||
msr CPSR_c,#I_BIT | F_BIT | SVC_MODE
|
||||
;- Save scratch/used registers and LR in User Stack
|
||||
stmfd sp!, { r1-r3, r12, lr}
|
||||
|
||||
;- Branch to the routine pointed by the AIC_FVR
|
||||
mov r14, pc
|
||||
bx r0
|
||||
|
||||
;- Restore scratch/used registers and LR from User Stack
|
||||
ldmia sp!, { r1-r3, r12, lr}
|
||||
|
||||
;- Leave Interrupts disabled and switch back in FIQ mode
|
||||
msr CPSR_c, #I_BIT | F_BIT | FIQ_MODE
|
||||
|
||||
;- Restore the R0 ARM_MODE_SVC register
|
||||
mov r0,r9
|
||||
|
||||
;- Restore the Program Counter using the LR_fiq directly in the PC
|
||||
subs pc,lr,#4
|
||||
;------------------------------------------------------------------------------
|
||||
;- Function : IRQ_Handler_Entry
|
||||
;- Treatments : IRQ Controller Interrupt Handler.
|
||||
;- Called Functions : AIC_IVR[interrupt]
|
||||
;------------------------------------------------------------------------------
|
||||
IRQ_Handler_Entry:
|
||||
;-------------------------
|
||||
;- Manage Exception Entry
|
||||
;-------------------------
|
||||
;- Adjust and save LR_irq in IRQ stack
|
||||
sub lr, lr, #4
|
||||
stmfd sp!, {lr}
|
||||
|
||||
;- Save r0 and SPSR (need to be saved for nested interrupt)
|
||||
mrs r14, SPSR
|
||||
stmfd sp!, {r0,r14}
|
||||
|
||||
;- Write in the IVR to support Protect Mode
|
||||
;- No effect in Normal Mode
|
||||
;- De-assert the NIRQ and clear the source in Protect Mode
|
||||
ldr r14, =AT91C_BASE_AIC
|
||||
ldr r0 , [r14, #AIC_IVR]
|
||||
str r14, [r14, #AIC_IVR]
|
||||
|
||||
;- Enable Interrupt and Switch in Supervisor Mode
|
||||
msr CPSR_c, #SVC_MODE
|
||||
|
||||
;- Save scratch/used registers and LR in User Stack
|
||||
stmfd sp!, { r1-r3, r12, r14}
|
||||
|
||||
;----------------------------------------------
|
||||
;- Branch to the routine pointed by the AIC_IVR
|
||||
;----------------------------------------------
|
||||
mov r14, pc
|
||||
bx r0
|
||||
|
||||
;----------------------------------------------
|
||||
;- Manage Exception Exit
|
||||
;----------------------------------------------
|
||||
;- Restore scratch/used registers and LR from User Stack
|
||||
ldmia sp!, { r1-r3, r12, r14}
|
||||
|
||||
;- Disable Interrupt and switch back in IRQ mode
|
||||
msr CPSR_c, #I_BIT | IRQ_MODE
|
||||
|
||||
;- Mark the End of Interrupt on the AIC
|
||||
ldr r14, =AT91C_BASE_AIC
|
||||
str r14, [r14, #AIC_EOICR]
|
||||
|
||||
;- Restore SPSR_irq and r0 from IRQ stack
|
||||
ldmia sp!, {r0,r14}
|
||||
msr SPSR_cxsf, r14
|
||||
|
||||
;- Restore adjusted LR_irq from IRQ stack directly in the PC
|
||||
ldmia sp!, {pc}^
|
||||
|
||||
;------------------------------------------------------------------------------
|
||||
;- Exception Vectors
|
||||
;------------------------------------------------------------------------------
|
||||
PUBLIC AT91F_Default_FIQ_handler
|
||||
PUBLIC AT91F_Default_IRQ_handler
|
||||
PUBLIC AT91F_Spurious_handler
|
||||
|
||||
ARM ; Always ARM mode after exeption
|
||||
|
||||
AT91F_Default_FIQ_handler
|
||||
b AT91F_Default_FIQ_handler
|
||||
|
||||
AT91F_Default_IRQ_handler
|
||||
b AT91F_Default_IRQ_handler
|
||||
|
||||
AT91F_Spurious_handler
|
||||
b AT91F_Spurious_handler
|
||||
|
||||
|
||||
;------------------------------------------------------------------------------
|
||||
; ?INIT
|
||||
; Program entry.
|
||||
;------------------------------------------------------------------------------
|
||||
|
||||
SECTION FIQ_STACK:DATA:NOROOT(3)
|
||||
SECTION IRQ_STACK:DATA:NOROOT(3)
|
||||
SECTION SVC_STACK:DATA:NOROOT(3)
|
||||
SECTION ABT_STACK:DATA:NOROOT(3)
|
||||
SECTION UND_STACK:DATA:NOROOT(3)
|
||||
SECTION CSTACK:DATA:NOROOT(3)
|
||||
SECTION text:CODE:NOROOT(2)
|
||||
REQUIRE __vector
|
||||
EXTERN ?main
|
||||
PUBLIC __iar_program_start
|
||||
EXTERN AT91F_LowLevelInit
|
||||
|
||||
|
||||
__iar_program_start:
|
||||
|
||||
;------------------------------------------------------------------------------
|
||||
;- Low level Init is performed in a C function: AT91F_LowLevelInit
|
||||
;- Init Stack Pointer to a valid memory area before calling AT91F_LowLevelInit
|
||||
;------------------------------------------------------------------------------
|
||||
|
||||
;- Retrieve end of RAM address
|
||||
|
||||
ldr r13,=TOP_OF_MEMORY ;- Temporary stack in internal RAM for Low Level Init execution
|
||||
ldr r0,=AT91F_LowLevelInit
|
||||
mov lr, pc
|
||||
bx r0 ;- Branch on C function (with interworking)
|
||||
|
||||
; Initialize the stack pointers.
|
||||
; The pattern below can be used for any of the exception stacks:
|
||||
; FIQ, IRQ, SVC, ABT, UND, SYS.
|
||||
; The USR mode uses the same stack as SYS.
|
||||
; The stack segments must be defined in the linker command file,
|
||||
; and be declared above.
|
||||
|
||||
mrs r0,cpsr ; Original PSR value
|
||||
bic r0,r0,#MODE_BITS ; Clear the mode bits
|
||||
orr r0,r0,#SVC_MODE ; Set SVC mode bits
|
||||
msr cpsr_c,r0 ; Change the mode
|
||||
ldr sp,=SFE(SVC_STACK) ; End of SVC_STACK
|
||||
|
||||
bic r0,r0,#MODE_BITS ; Clear the mode bits
|
||||
orr r0,r0,#UND_MODE ; Set UND mode bits
|
||||
msr cpsr_c,r0 ; Change the mode
|
||||
ldr sp,=SFE(UND_STACK) ; End of UND_STACK
|
||||
|
||||
bic r0,r0,#MODE_BITS ; Clear the mode bits
|
||||
orr r0,r0,#ABT_MODE ; Set ABT mode bits
|
||||
msr cpsr_c,r0 ; Change the mode
|
||||
ldr sp,=SFE(ABT_STACK) ; End of ABT_STACK
|
||||
|
||||
bic r0,r0,#MODE_BITS ; Clear the mode bits
|
||||
orr r0,r0,#FIQ_MODE ; Set FIQ mode bits
|
||||
msr cpsr_c,r0 ; Change the mode
|
||||
ldr sp,=SFE(FIQ_STACK) ; End of FIQ_STACK
|
||||
;- Init the FIQ register
|
||||
ldr r8, =AT91C_BASE_AIC
|
||||
|
||||
bic r0,r0,#MODE_BITS ; Clear the mode bits
|
||||
orr r0,r0,#IRQ_MODE ; Set IRQ mode bits
|
||||
msr cpsr_c,r0 ; Change the mode
|
||||
ldr sp,=SFE(IRQ_STACK) ; End of IRQ_STACK
|
||||
|
||||
bic r0,r0,#MODE_BITS ; Clear the mode bits
|
||||
orr r0,r0,#SYS_MODE ; Set System mode bits
|
||||
msr cpsr_c,r0 ; Change the mode
|
||||
ldr sp,=SFE(CSTACK) ; End of CSTACK
|
||||
|
||||
#ifdef __ARMVFP__
|
||||
; Enable the VFP coprocessor.
|
||||
mov r0, #0x40000000 ; Set EN bit in VFP
|
||||
fmxr fpexc, r0 ; FPEXC, clear others.
|
||||
|
||||
; Disable underflow exceptions by setting flush to zero mode.
|
||||
; For full IEEE 754 underflow compliance this code should be removed
|
||||
; and the appropriate exception handler installed.
|
||||
mov r0, #0x01000000 ; Set FZ bit in VFP
|
||||
fmxr fpscr, r0 ; FPSCR, clear others.
|
||||
#endif
|
||||
|
||||
; Add more initialization here
|
||||
|
||||
|
||||
; Continue to ?main for more IAR specific system startup
|
||||
|
||||
ldr r0,=?main
|
||||
bx r0
|
||||
|
||||
END ;- Terminates the assembly of the last module in a file
|
||||
;* ----------------------------------------------------------------------------
|
||||
;* ATMEL Microcontroller Software Support - ROUSSET -
|
||||
;* ----------------------------------------------------------------------------
|
||||
;* Copyright (c) 2006, Atmel Corporation
|
||||
;
|
||||
;* All rights reserved.
|
||||
;*
|
||||
;* Redistribution and use in source and binary forms, with or without
|
||||
;* modification, are permitted provided that the following conditions are met:
|
||||
;*
|
||||
;* - Redistributions of source code must retain the above copyright notice,
|
||||
;* this list of conditions and the disclaimer below.
|
||||
;*
|
||||
;* - Redistributions in binary form must reproduce the above copyright notice,
|
||||
;* this list of conditions and the disclaimer below in the documentation and/or
|
||||
;* other materials provided with the distribution.
|
||||
;*
|
||||
;* Atmel's name may not be used to endorse or promote products derived from
|
||||
;* this software without specific prior written permission.
|
||||
;*
|
||||
;* DISCLAIMER: THIS SOFTWARE IS PROVIDED BY ATMEL "AS IS" AND ANY EXPRESS OR
|
||||
;* IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
|
||||
;* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT ARE
|
||||
;* DISCLAIMED. IN NO EVENT SHALL ATMEL BE LIABLE FOR ANY DIRECT, INDIRECT,
|
||||
;* INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
|
||||
;* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA,
|
||||
;* OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
|
||||
;* LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
|
||||
;* NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,
|
||||
;* EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
;* ----------------------------------------------------------------------------
|
||||
|
||||
;------------------------------------------------------------------------------
|
||||
; Include your AT91 Library files
|
||||
;------------------------------------------------------------------------------
|
||||
#include "AT91SAM7X256_inc.h"
|
||||
;------------------------------------------------------------------------------
|
||||
|
||||
#define TOP_OF_MEMORY (AT91C_ISRAM + AT91C_ISRAM_SIZE)
|
||||
#define IRQ_STACK_SIZE (3*8*4)
|
||||
; 3 words to be saved per interrupt priority level
|
||||
|
||||
; Mode, correspords to bits 0-5 in CPSR
|
||||
MODE_BITS DEFINE 0x1F ; Bit mask for mode bits in CPSR
|
||||
USR_MODE DEFINE 0x10 ; User mode
|
||||
FIQ_MODE DEFINE 0x11 ; Fast Interrupt Request mode
|
||||
IRQ_MODE DEFINE 0x12 ; Interrupt Request mode
|
||||
SVC_MODE DEFINE 0x13 ; Supervisor mode
|
||||
ABT_MODE DEFINE 0x17 ; Abort mode
|
||||
UND_MODE DEFINE 0x1B ; Undefined Instruction mode
|
||||
SYS_MODE DEFINE 0x1F ; System mode
|
||||
|
||||
I_BIT DEFINE 0x80
|
||||
F_BIT DEFINE 0x40
|
||||
|
||||
;------------------------------------------------------------------------------
|
||||
; ?RESET
|
||||
; Reset Vector.
|
||||
; Normally, segment INTVEC is linked at address 0.
|
||||
; For debugging purposes, INTVEC may be placed at other addresses.
|
||||
; A debugger that honors the entry point will start the
|
||||
; program in a normal way even if INTVEC is not at address 0.
|
||||
;------------------------------------------------------------------------------
|
||||
SECTION .intvec:CODE:NOROOT(2)
|
||||
PUBLIC __vector
|
||||
PUBLIC __iar_program_start
|
||||
|
||||
ARM
|
||||
__vector:
|
||||
ldr pc,[pc,#+24] ;; Reset
|
||||
__und_handler:
|
||||
ldr pc,[pc,#+24] ;; Undefined instructions
|
||||
__swi_handler:
|
||||
ldr pc,[pc,#+24] ;; Software interrupt (SWI/SVC)
|
||||
__prefetch_handler:
|
||||
ldr pc,[pc,#+24] ;; Prefetch abort
|
||||
__data_handler:
|
||||
ldr pc,[pc,#+24] ;; Data abort
|
||||
DC32 0xFFFFFFFF ;; RESERVED
|
||||
__irq_handler:
|
||||
ldr pc,[pc,#+24] ;; IRQ
|
||||
__fiq_handler:
|
||||
ldr pc,[pc,#+24] ;; FIQ
|
||||
|
||||
DC32 __iar_program_start
|
||||
DC32 __und_handler
|
||||
DC32 __swi_handler
|
||||
DC32 __prefetch_handler
|
||||
DC32 __data_handler
|
||||
B .
|
||||
DC32 IRQ_Handler_Entry
|
||||
DC32 FIQ_Handler_Entry
|
||||
|
||||
;------------------------------------------------------------------------------
|
||||
;- Manage exception: The exception must be ensure in ARM mode
|
||||
;------------------------------------------------------------------------------
|
||||
SECTION text:CODE:NOROOT(2)
|
||||
ARM
|
||||
;------------------------------------------------------------------------------
|
||||
;- Function : FIQ_Handler_Entry
|
||||
;- Treatments : FIQ Controller Interrupt Handler.
|
||||
;- R8 is initialize in Cstartup
|
||||
;- Called Functions : None only by FIQ
|
||||
;------------------------------------------------------------------------------
|
||||
FIQ_Handler_Entry:
|
||||
|
||||
;- Switch in SVC/User Mode to allow User Stack access for C code
|
||||
; because the FIQ is not yet acknowledged
|
||||
|
||||
;- Save and r0 in FIQ_Register
|
||||
mov r9,r0
|
||||
ldr r0 , [r8, #AIC_FVR]
|
||||
msr CPSR_c,#I_BIT | F_BIT | SVC_MODE
|
||||
;- Save scratch/used registers and LR in User Stack
|
||||
stmfd sp!, { r1-r3, r12, lr}
|
||||
|
||||
;- Branch to the routine pointed by the AIC_FVR
|
||||
mov r14, pc
|
||||
bx r0
|
||||
|
||||
;- Restore scratch/used registers and LR from User Stack
|
||||
ldmia sp!, { r1-r3, r12, lr}
|
||||
|
||||
;- Leave Interrupts disabled and switch back in FIQ mode
|
||||
msr CPSR_c, #I_BIT | F_BIT | FIQ_MODE
|
||||
|
||||
;- Restore the R0 ARM_MODE_SVC register
|
||||
mov r0,r9
|
||||
|
||||
;- Restore the Program Counter using the LR_fiq directly in the PC
|
||||
subs pc,lr,#4
|
||||
;------------------------------------------------------------------------------
|
||||
;- Function : IRQ_Handler_Entry
|
||||
;- Treatments : IRQ Controller Interrupt Handler.
|
||||
;- Called Functions : AIC_IVR[interrupt]
|
||||
;------------------------------------------------------------------------------
|
||||
IRQ_Handler_Entry:
|
||||
;-------------------------
|
||||
;- Manage Exception Entry
|
||||
;-------------------------
|
||||
;- Adjust and save LR_irq in IRQ stack
|
||||
sub lr, lr, #4
|
||||
stmfd sp!, {lr}
|
||||
|
||||
;- Save r0 and SPSR (need to be saved for nested interrupt)
|
||||
mrs r14, SPSR
|
||||
stmfd sp!, {r0,r14}
|
||||
|
||||
;- Write in the IVR to support Protect Mode
|
||||
;- No effect in Normal Mode
|
||||
;- De-assert the NIRQ and clear the source in Protect Mode
|
||||
ldr r14, =AT91C_BASE_AIC
|
||||
ldr r0 , [r14, #AIC_IVR]
|
||||
str r14, [r14, #AIC_IVR]
|
||||
|
||||
;- Enable Interrupt and Switch in Supervisor Mode
|
||||
msr CPSR_c, #SVC_MODE
|
||||
|
||||
;- Save scratch/used registers and LR in User Stack
|
||||
stmfd sp!, { r1-r3, r12, r14}
|
||||
|
||||
;----------------------------------------------
|
||||
;- Branch to the routine pointed by the AIC_IVR
|
||||
;----------------------------------------------
|
||||
mov r14, pc
|
||||
bx r0
|
||||
|
||||
;----------------------------------------------
|
||||
;- Manage Exception Exit
|
||||
;----------------------------------------------
|
||||
;- Restore scratch/used registers and LR from User Stack
|
||||
ldmia sp!, { r1-r3, r12, r14}
|
||||
|
||||
;- Disable Interrupt and switch back in IRQ mode
|
||||
msr CPSR_c, #I_BIT | IRQ_MODE
|
||||
|
||||
;- Mark the End of Interrupt on the AIC
|
||||
ldr r14, =AT91C_BASE_AIC
|
||||
str r14, [r14, #AIC_EOICR]
|
||||
|
||||
;- Restore SPSR_irq and r0 from IRQ stack
|
||||
ldmia sp!, {r0,r14}
|
||||
msr SPSR_cxsf, r14
|
||||
|
||||
;- Restore adjusted LR_irq from IRQ stack directly in the PC
|
||||
ldmia sp!, {pc}^
|
||||
|
||||
;------------------------------------------------------------------------------
|
||||
;- Exception Vectors
|
||||
;------------------------------------------------------------------------------
|
||||
PUBLIC AT91F_Default_FIQ_handler
|
||||
PUBLIC AT91F_Default_IRQ_handler
|
||||
PUBLIC AT91F_Spurious_handler
|
||||
|
||||
ARM ; Always ARM mode after exeption
|
||||
|
||||
AT91F_Default_FIQ_handler
|
||||
b AT91F_Default_FIQ_handler
|
||||
|
||||
AT91F_Default_IRQ_handler
|
||||
b AT91F_Default_IRQ_handler
|
||||
|
||||
AT91F_Spurious_handler
|
||||
b AT91F_Spurious_handler
|
||||
|
||||
|
||||
;------------------------------------------------------------------------------
|
||||
; ?INIT
|
||||
; Program entry.
|
||||
;------------------------------------------------------------------------------
|
||||
|
||||
SECTION FIQ_STACK:DATA:NOROOT(3)
|
||||
SECTION IRQ_STACK:DATA:NOROOT(3)
|
||||
SECTION SVC_STACK:DATA:NOROOT(3)
|
||||
SECTION ABT_STACK:DATA:NOROOT(3)
|
||||
SECTION UND_STACK:DATA:NOROOT(3)
|
||||
SECTION CSTACK:DATA:NOROOT(3)
|
||||
SECTION text:CODE:NOROOT(2)
|
||||
REQUIRE __vector
|
||||
EXTERN ?main
|
||||
PUBLIC __iar_program_start
|
||||
EXTERN AT91F_LowLevelInit
|
||||
|
||||
|
||||
__iar_program_start:
|
||||
|
||||
;------------------------------------------------------------------------------
|
||||
;- Low level Init is performed in a C function: AT91F_LowLevelInit
|
||||
;- Init Stack Pointer to a valid memory area before calling AT91F_LowLevelInit
|
||||
;------------------------------------------------------------------------------
|
||||
|
||||
;- Retrieve end of RAM address
|
||||
|
||||
ldr r13,=TOP_OF_MEMORY ;- Temporary stack in internal RAM for Low Level Init execution
|
||||
ldr r0,=AT91F_LowLevelInit
|
||||
mov lr, pc
|
||||
bx r0 ;- Branch on C function (with interworking)
|
||||
|
||||
; Initialize the stack pointers.
|
||||
; The pattern below can be used for any of the exception stacks:
|
||||
; FIQ, IRQ, SVC, ABT, UND, SYS.
|
||||
; The USR mode uses the same stack as SYS.
|
||||
; The stack segments must be defined in the linker command file,
|
||||
; and be declared above.
|
||||
|
||||
mrs r0,cpsr ; Original PSR value
|
||||
bic r0,r0,#MODE_BITS ; Clear the mode bits
|
||||
orr r0,r0,#SVC_MODE ; Set SVC mode bits
|
||||
msr cpsr_c,r0 ; Change the mode
|
||||
ldr sp,=SFE(SVC_STACK) ; End of SVC_STACK
|
||||
|
||||
bic r0,r0,#MODE_BITS ; Clear the mode bits
|
||||
orr r0,r0,#UND_MODE ; Set UND mode bits
|
||||
msr cpsr_c,r0 ; Change the mode
|
||||
ldr sp,=SFE(UND_STACK) ; End of UND_STACK
|
||||
|
||||
bic r0,r0,#MODE_BITS ; Clear the mode bits
|
||||
orr r0,r0,#ABT_MODE ; Set ABT mode bits
|
||||
msr cpsr_c,r0 ; Change the mode
|
||||
ldr sp,=SFE(ABT_STACK) ; End of ABT_STACK
|
||||
|
||||
bic r0,r0,#MODE_BITS ; Clear the mode bits
|
||||
orr r0,r0,#FIQ_MODE ; Set FIQ mode bits
|
||||
msr cpsr_c,r0 ; Change the mode
|
||||
ldr sp,=SFE(FIQ_STACK) ; End of FIQ_STACK
|
||||
;- Init the FIQ register
|
||||
ldr r8, =AT91C_BASE_AIC
|
||||
|
||||
bic r0,r0,#MODE_BITS ; Clear the mode bits
|
||||
orr r0,r0,#IRQ_MODE ; Set IRQ mode bits
|
||||
msr cpsr_c,r0 ; Change the mode
|
||||
ldr sp,=SFE(IRQ_STACK) ; End of IRQ_STACK
|
||||
|
||||
bic r0,r0,#MODE_BITS ; Clear the mode bits
|
||||
orr r0,r0,#SYS_MODE ; Set System mode bits
|
||||
msr cpsr_c,r0 ; Change the mode
|
||||
ldr sp,=SFE(CSTACK) ; End of CSTACK
|
||||
|
||||
#ifdef __ARMVFP__
|
||||
; Enable the VFP coprocessor.
|
||||
mov r0, #0x40000000 ; Set EN bit in VFP
|
||||
fmxr fpexc, r0 ; FPEXC, clear others.
|
||||
|
||||
; Disable underflow exceptions by setting flush to zero mode.
|
||||
; For full IEEE 754 underflow compliance this code should be removed
|
||||
; and the appropriate exception handler installed.
|
||||
mov r0, #0x01000000 ; Set FZ bit in VFP
|
||||
fmxr fpscr, r0 ; FPSCR, clear others.
|
||||
#endif
|
||||
|
||||
; Add more initialization here
|
||||
|
||||
|
||||
; Continue to ?main for more IAR specific system startup
|
||||
|
||||
ldr r0,=?main
|
||||
bx r0
|
||||
|
||||
END ;- Terminates the assembly of the last module in a file
|
||||
|
||||
@@ -1,98 +1,98 @@
|
||||
//-----------------------------------------------------------------------------
|
||||
// ATMEL Microcontroller Software Support - ROUSSET -
|
||||
//-----------------------------------------------------------------------------
|
||||
// DISCLAIMER: THIS SOFTWARE IS PROVIDED BY ATMEL "AS IS" AND ANY EXPRESS OR
|
||||
// IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
|
||||
// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT ARE
|
||||
// DISCLAIMED. IN NO EVENT SHALL ATMEL BE LIABLE FOR ANY DIRECT, INDIRECT,
|
||||
// INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
|
||||
// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA,
|
||||
// OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
|
||||
// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
|
||||
// NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,
|
||||
// EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
//-----------------------------------------------------------------------------
|
||||
// File Name : Cstartup_SAM7.c
|
||||
// Object : Low level initialisations written in C for Tools
|
||||
// For AT91SAM7X256 with 2 flash plane
|
||||
// Creation : JPP 14-Sep-2006
|
||||
//-----------------------------------------------------------------------------
|
||||
|
||||
#include "project.h"
|
||||
|
||||
|
||||
// The following functions must be write in ARM mode this function called
|
||||
// directly by exception vector
|
||||
extern void AT91F_Spurious_handler(void);
|
||||
extern void AT91F_Default_IRQ_handler(void);
|
||||
extern void AT91F_Default_FIQ_handler(void);
|
||||
|
||||
//*----------------------------------------------------------------------------
|
||||
//* \fn AT91F_LowLevelInit
|
||||
//* \brief This function performs very low level HW initialization
|
||||
//* this function can use a Stack, depending the compilation
|
||||
//* optimization mode
|
||||
//*----------------------------------------------------------------------------
|
||||
void AT91F_LowLevelInit(void) @ "ICODE"
|
||||
{
|
||||
unsigned char i;
|
||||
///////////////////////////////////////////////////////////////////////////
|
||||
// EFC Init
|
||||
///////////////////////////////////////////////////////////////////////////
|
||||
AT91C_BASE_MC->MC_FMR = AT91C_MC_FWS_1FWS ;
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////
|
||||
// Init PMC Step 1. Enable Main Oscillator
|
||||
// Main Oscillator startup time is board specific:
|
||||
// Main Oscillator Startup Time worst case (3MHz) corresponds to 15ms
|
||||
// (0x40 for AT91C_CKGR_OSCOUNT field)
|
||||
///////////////////////////////////////////////////////////////////////////
|
||||
AT91C_BASE_PMC->PMC_MOR = (( AT91C_CKGR_OSCOUNT & (0x40 <<8) | AT91C_CKGR_MOSCEN ));
|
||||
// Wait Main Oscillator stabilization
|
||||
while(!(AT91C_BASE_PMC->PMC_SR & AT91C_PMC_MOSCS));
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////
|
||||
// Init PMC Step 2.
|
||||
// Set PLL to 96MHz (96,109MHz) and UDP Clock to 48MHz
|
||||
// PLL Startup time depends on PLL RC filter: worst case is choosen
|
||||
// UDP Clock (48,058MHz) is compliant with the Universal Serial Bus
|
||||
// Specification (+/- 0.25% for full speed)
|
||||
///////////////////////////////////////////////////////////////////////////
|
||||
AT91C_BASE_PMC->PMC_PLLR = AT91C_CKGR_USBDIV_1 |
|
||||
(16 << 8) |
|
||||
(AT91C_CKGR_MUL & (72 << 16)) |
|
||||
(AT91C_CKGR_DIV & 14);
|
||||
// Wait for PLL stabilization
|
||||
while( !(AT91C_BASE_PMC->PMC_SR & AT91C_PMC_LOCK) );
|
||||
// Wait until the master clock is established for the case we already
|
||||
// turn on the PLL
|
||||
while( !(AT91C_BASE_PMC->PMC_SR & AT91C_PMC_MCKRDY) );
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////
|
||||
// Init PMC Step 3.
|
||||
// Selection of Master Clock MCK equal to (Processor Clock PCK) PLL/2=48MHz
|
||||
// The PMC_MCKR register must not be programmed in a single write operation
|
||||
// (see. Product Errata Sheet)
|
||||
///////////////////////////////////////////////////////////////////////////
|
||||
AT91C_BASE_PMC->PMC_MCKR = AT91C_PMC_PRES_CLK_2;
|
||||
// Wait until the master clock is established
|
||||
while( !(AT91C_BASE_PMC->PMC_SR & AT91C_PMC_MCKRDY) );
|
||||
|
||||
AT91C_BASE_PMC->PMC_MCKR |= AT91C_PMC_CSS_PLL_CLK;
|
||||
// Wait until the master clock is established
|
||||
while( !(AT91C_BASE_PMC->PMC_SR & AT91C_PMC_MCKRDY) );
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////
|
||||
// Disable Watchdog (write once register)
|
||||
///////////////////////////////////////////////////////////////////////////
|
||||
AT91C_BASE_WDTC->WDTC_WDMR = AT91C_WDTC_WDDIS;
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////
|
||||
// Init AIC: assign corresponding handler for each interrupt source
|
||||
///////////////////////////////////////////////////////////////////////////
|
||||
AT91C_BASE_AIC->AIC_SVR[0] = (int) AT91F_Default_FIQ_handler ;
|
||||
for (i = 1; i < 31; i++) {
|
||||
AT91C_BASE_AIC->AIC_SVR[i] = (int) AT91F_Default_IRQ_handler ;
|
||||
}
|
||||
AT91C_BASE_AIC->AIC_SPU = (unsigned int) AT91F_Spurious_handler;
|
||||
}
|
||||
//-----------------------------------------------------------------------------
|
||||
// ATMEL Microcontroller Software Support - ROUSSET -
|
||||
//-----------------------------------------------------------------------------
|
||||
// DISCLAIMER: THIS SOFTWARE IS PROVIDED BY ATMEL "AS IS" AND ANY EXPRESS OR
|
||||
// IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
|
||||
// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT ARE
|
||||
// DISCLAIMED. IN NO EVENT SHALL ATMEL BE LIABLE FOR ANY DIRECT, INDIRECT,
|
||||
// INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
|
||||
// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA,
|
||||
// OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
|
||||
// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
|
||||
// NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,
|
||||
// EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
//-----------------------------------------------------------------------------
|
||||
// File Name : Cstartup_SAM7.c
|
||||
// Object : Low level initialisations written in C for Tools
|
||||
// For AT91SAM7X256 with 2 flash plane
|
||||
// Creation : JPP 14-Sep-2006
|
||||
//-----------------------------------------------------------------------------
|
||||
|
||||
#include "project.h"
|
||||
|
||||
|
||||
// The following functions must be write in ARM mode this function called
|
||||
// directly by exception vector
|
||||
extern void AT91F_Spurious_handler(void);
|
||||
extern void AT91F_Default_IRQ_handler(void);
|
||||
extern void AT91F_Default_FIQ_handler(void);
|
||||
|
||||
//*----------------------------------------------------------------------------
|
||||
//* \fn AT91F_LowLevelInit
|
||||
//* \brief This function performs very low level HW initialization
|
||||
//* this function can use a Stack, depending the compilation
|
||||
//* optimization mode
|
||||
//*----------------------------------------------------------------------------
|
||||
void AT91F_LowLevelInit(void) @ "ICODE"
|
||||
{
|
||||
unsigned char i;
|
||||
///////////////////////////////////////////////////////////////////////////
|
||||
// EFC Init
|
||||
///////////////////////////////////////////////////////////////////////////
|
||||
AT91C_BASE_MC->MC_FMR = AT91C_MC_FWS_1FWS ;
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////
|
||||
// Init PMC Step 1. Enable Main Oscillator
|
||||
// Main Oscillator startup time is board specific:
|
||||
// Main Oscillator Startup Time worst case (3MHz) corresponds to 15ms
|
||||
// (0x40 for AT91C_CKGR_OSCOUNT field)
|
||||
///////////////////////////////////////////////////////////////////////////
|
||||
AT91C_BASE_PMC->PMC_MOR = (( AT91C_CKGR_OSCOUNT & (0x40 <<8) | AT91C_CKGR_MOSCEN ));
|
||||
// Wait Main Oscillator stabilization
|
||||
while(!(AT91C_BASE_PMC->PMC_SR & AT91C_PMC_MOSCS));
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////
|
||||
// Init PMC Step 2.
|
||||
// Set PLL to 96MHz (96,109MHz) and UDP Clock to 48MHz
|
||||
// PLL Startup time depends on PLL RC filter: worst case is choosen
|
||||
// UDP Clock (48,058MHz) is compliant with the Universal Serial Bus
|
||||
// Specification (+/- 0.25% for full speed)
|
||||
///////////////////////////////////////////////////////////////////////////
|
||||
AT91C_BASE_PMC->PMC_PLLR = AT91C_CKGR_USBDIV_1 |
|
||||
(16 << 8) |
|
||||
(AT91C_CKGR_MUL & (72 << 16)) |
|
||||
(AT91C_CKGR_DIV & 14);
|
||||
// Wait for PLL stabilization
|
||||
while( !(AT91C_BASE_PMC->PMC_SR & AT91C_PMC_LOCK) );
|
||||
// Wait until the master clock is established for the case we already
|
||||
// turn on the PLL
|
||||
while( !(AT91C_BASE_PMC->PMC_SR & AT91C_PMC_MCKRDY) );
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////
|
||||
// Init PMC Step 3.
|
||||
// Selection of Master Clock MCK equal to (Processor Clock PCK) PLL/2=48MHz
|
||||
// The PMC_MCKR register must not be programmed in a single write operation
|
||||
// (see. Product Errata Sheet)
|
||||
///////////////////////////////////////////////////////////////////////////
|
||||
AT91C_BASE_PMC->PMC_MCKR = AT91C_PMC_PRES_CLK_2;
|
||||
// Wait until the master clock is established
|
||||
while( !(AT91C_BASE_PMC->PMC_SR & AT91C_PMC_MCKRDY) );
|
||||
|
||||
AT91C_BASE_PMC->PMC_MCKR |= AT91C_PMC_CSS_PLL_CLK;
|
||||
// Wait until the master clock is established
|
||||
while( !(AT91C_BASE_PMC->PMC_SR & AT91C_PMC_MCKRDY) );
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////
|
||||
// Disable Watchdog (write once register)
|
||||
///////////////////////////////////////////////////////////////////////////
|
||||
AT91C_BASE_WDTC->WDTC_WDMR = AT91C_WDTC_WDDIS;
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////
|
||||
// Init AIC: assign corresponding handler for each interrupt source
|
||||
///////////////////////////////////////////////////////////////////////////
|
||||
AT91C_BASE_AIC->AIC_SVR[0] = (int) AT91F_Default_FIQ_handler ;
|
||||
for (i = 1; i < 31; i++) {
|
||||
AT91C_BASE_AIC->AIC_SVR[i] = (int) AT91F_Default_IRQ_handler ;
|
||||
}
|
||||
AT91C_BASE_AIC->AIC_SPU = (unsigned int) AT91F_Spurious_handler;
|
||||
}
|
||||
|
||||
+40
-40
@@ -1,40 +1,40 @@
|
||||
# ==========================================
|
||||
# CMock Project - Automatic Mock Generation for C
|
||||
# Copyright (c) 2007 Mike Karlesky, Mark VanderVoord, Greg Williams
|
||||
# [Released under MIT License. Please refer to license.txt for details]
|
||||
# ==========================================
|
||||
|
||||
class CMockPluginManager
|
||||
|
||||
attr_accessor :plugins
|
||||
|
||||
def initialize(config, utils)
|
||||
@plugins = []
|
||||
plugins_to_load = [:expect, config.plugins].flatten.uniq.compact
|
||||
plugins_to_load.each do |plugin|
|
||||
plugin_name = plugin.to_s
|
||||
object_name = "CMockGeneratorPlugin" + camelize(plugin_name)
|
||||
begin
|
||||
unless (Object.const_defined? object_name)
|
||||
require "#{File.expand_path(File.dirname(__FILE__))}/cmock_generator_plugin_#{plugin_name.downcase}.rb"
|
||||
end
|
||||
@plugins << eval("#{object_name}.new(config, utils)")
|
||||
rescue
|
||||
raise "ERROR: CMock unable to load plugin '#{plugin_name}'"
|
||||
end
|
||||
end
|
||||
@plugins.sort! {|a,b| a.priority <=> b.priority }
|
||||
end
|
||||
|
||||
def run(method, args=nil)
|
||||
if args.nil?
|
||||
return @plugins.collect{ |plugin| plugin.send(method) if plugin.respond_to?(method) }.flatten.join
|
||||
else
|
||||
return @plugins.collect{ |plugin| plugin.send(method, args) if plugin.respond_to?(method) }.flatten.join
|
||||
end
|
||||
end
|
||||
|
||||
def camelize(lower_case_and_underscored_word)
|
||||
lower_case_and_underscored_word.gsub(/\/(.?)/) { "::" + $1.upcase }.gsub(/(^|_)(.)/) { $2.upcase }
|
||||
end
|
||||
end
|
||||
# ==========================================
|
||||
# CMock Project - Automatic Mock Generation for C
|
||||
# Copyright (c) 2007 Mike Karlesky, Mark VanderVoord, Greg Williams
|
||||
# [Released under MIT License. Please refer to license.txt for details]
|
||||
# ==========================================
|
||||
|
||||
class CMockPluginManager
|
||||
|
||||
attr_accessor :plugins
|
||||
|
||||
def initialize(config, utils)
|
||||
@plugins = []
|
||||
plugins_to_load = [:expect, config.plugins].flatten.uniq.compact
|
||||
plugins_to_load.each do |plugin|
|
||||
plugin_name = plugin.to_s
|
||||
object_name = "CMockGeneratorPlugin" + camelize(plugin_name)
|
||||
begin
|
||||
unless (Object.const_defined? object_name)
|
||||
require "#{File.expand_path(File.dirname(__FILE__))}/cmock_generator_plugin_#{plugin_name.downcase}.rb"
|
||||
end
|
||||
@plugins << eval("#{object_name}.new(config, utils)")
|
||||
rescue
|
||||
raise "ERROR: CMock unable to load plugin '#{plugin_name}'"
|
||||
end
|
||||
end
|
||||
@plugins.sort! {|a,b| a.priority <=> b.priority }
|
||||
end
|
||||
|
||||
def run(method, args=nil)
|
||||
if args.nil?
|
||||
return @plugins.collect{ |plugin| plugin.send(method) if plugin.respond_to?(method) }.flatten.join
|
||||
else
|
||||
return @plugins.collect{ |plugin| plugin.send(method, args) if plugin.respond_to?(method) }.flatten.join
|
||||
end
|
||||
end
|
||||
|
||||
def camelize(lower_case_and_underscored_word)
|
||||
lower_case_and_underscored_word.gsub(/\/(.?)/) { "::" + $1.upcase }.gsub(/(^|_)(.)/) { $2.upcase }
|
||||
end
|
||||
end
|
||||
|
||||
@@ -1,75 +1,75 @@
|
||||
# ==========================================
|
||||
# CMock Project - Automatic Mock Generation for C
|
||||
# Copyright (c) 2007 Mike Karlesky, Mark VanderVoord, Greg Williams
|
||||
# [Released under MIT License. Please refer to license.txt for details]
|
||||
# ==========================================
|
||||
|
||||
class CMockUnityHelperParser
|
||||
|
||||
attr_accessor :c_types
|
||||
|
||||
def initialize(config)
|
||||
@config = config
|
||||
@fallback = @config.plugins.include?(:array) ? 'UNITY_TEST_ASSERT_EQUAL_MEMORY_ARRAY' : 'UNITY_TEST_ASSERT_EQUAL_MEMORY'
|
||||
@c_types = map_C_types.merge(import_source)
|
||||
end
|
||||
|
||||
def get_helper(ctype)
|
||||
lookup = ctype.gsub(/(?:^|(\S?)(\s*)|(\W))const(?:$|(\s*)(\S)|(\W))/,'\1\3\5\6').strip.gsub(/\s+/,'_')
|
||||
return [@c_types[lookup], ''] if (@c_types[lookup])
|
||||
if (lookup =~ /\*$/)
|
||||
lookup = lookup.gsub(/\*$/,'')
|
||||
return [@c_types[lookup], '*'] if (@c_types[lookup])
|
||||
else
|
||||
lookup = lookup + '*'
|
||||
return [@c_types[lookup], '&'] if (@c_types[lookup])
|
||||
end
|
||||
return ['UNITY_TEST_ASSERT_EQUAL_PTR', ''] if (ctype =~ /cmock_\w+_ptr\d+/)
|
||||
raise("Don't know how to test #{ctype} and memory tests are disabled!") unless @config.memcmp_if_unknown
|
||||
return (lookup =~ /\*$/) ? [@fallback, '&'] : [@fallback, '']
|
||||
end
|
||||
|
||||
private ###########################
|
||||
|
||||
def map_C_types
|
||||
c_types = {}
|
||||
@config.treat_as.each_pair do |ctype, expecttype|
|
||||
c_type = ctype.gsub(/\s+/,'_')
|
||||
if (expecttype =~ /\*/)
|
||||
c_types[c_type] = "UNITY_TEST_ASSERT_EQUAL_#{expecttype.gsub(/\*/,'')}_ARRAY"
|
||||
else
|
||||
c_types[c_type] = "UNITY_TEST_ASSERT_EQUAL_#{expecttype}"
|
||||
c_types[c_type+'*'] ||= "UNITY_TEST_ASSERT_EQUAL_#{expecttype}_ARRAY"
|
||||
end
|
||||
end
|
||||
c_types
|
||||
end
|
||||
|
||||
def import_source
|
||||
source = @config.load_unity_helper
|
||||
return {} if source.nil?
|
||||
c_types = {}
|
||||
source = source.gsub(/\/\/.*$/, '') #remove line comments
|
||||
source = source.gsub(/\/\*.*?\*\//m, '') #remove block comments
|
||||
|
||||
#scan for comparison helpers
|
||||
match_regex = Regexp.new('^\s*#define\s+(UNITY_TEST_ASSERT_EQUAL_(\w+))\s*\(' + Array.new(4,'\s*\w+\s*').join(',') + '\)')
|
||||
pairs = source.scan(match_regex).flatten.compact
|
||||
(pairs.size/2).times do |i|
|
||||
expect = pairs[i*2]
|
||||
ctype = pairs[(i*2)+1]
|
||||
c_types[ctype] = expect unless expect.include?("_ARRAY")
|
||||
end
|
||||
|
||||
#scan for array variants of those helpers
|
||||
match_regex = Regexp.new('^\s*#define\s+(UNITY_TEST_ASSERT_EQUAL_(\w+_ARRAY))\s*\(' + Array.new(5,'\s*\w+\s*').join(',') + '\)')
|
||||
pairs = source.scan(match_regex).flatten.compact
|
||||
(pairs.size/2).times do |i|
|
||||
expect = pairs[i*2]
|
||||
ctype = pairs[(i*2)+1]
|
||||
c_types[ctype.gsub('_ARRAY','*')] = expect
|
||||
end
|
||||
|
||||
c_types
|
||||
end
|
||||
end
|
||||
# ==========================================
|
||||
# CMock Project - Automatic Mock Generation for C
|
||||
# Copyright (c) 2007 Mike Karlesky, Mark VanderVoord, Greg Williams
|
||||
# [Released under MIT License. Please refer to license.txt for details]
|
||||
# ==========================================
|
||||
|
||||
class CMockUnityHelperParser
|
||||
|
||||
attr_accessor :c_types
|
||||
|
||||
def initialize(config)
|
||||
@config = config
|
||||
@fallback = @config.plugins.include?(:array) ? 'UNITY_TEST_ASSERT_EQUAL_MEMORY_ARRAY' : 'UNITY_TEST_ASSERT_EQUAL_MEMORY'
|
||||
@c_types = map_C_types.merge(import_source)
|
||||
end
|
||||
|
||||
def get_helper(ctype)
|
||||
lookup = ctype.gsub(/(?:^|(\S?)(\s*)|(\W))const(?:$|(\s*)(\S)|(\W))/,'\1\3\5\6').strip.gsub(/\s+/,'_')
|
||||
return [@c_types[lookup], ''] if (@c_types[lookup])
|
||||
if (lookup =~ /\*$/)
|
||||
lookup = lookup.gsub(/\*$/,'')
|
||||
return [@c_types[lookup], '*'] if (@c_types[lookup])
|
||||
else
|
||||
lookup = lookup + '*'
|
||||
return [@c_types[lookup], '&'] if (@c_types[lookup])
|
||||
end
|
||||
return ['UNITY_TEST_ASSERT_EQUAL_PTR', ''] if (ctype =~ /cmock_\w+_ptr\d+/)
|
||||
raise("Don't know how to test #{ctype} and memory tests are disabled!") unless @config.memcmp_if_unknown
|
||||
return (lookup =~ /\*$/) ? [@fallback, '&'] : [@fallback, '']
|
||||
end
|
||||
|
||||
private ###########################
|
||||
|
||||
def map_C_types
|
||||
c_types = {}
|
||||
@config.treat_as.each_pair do |ctype, expecttype|
|
||||
c_type = ctype.gsub(/\s+/,'_')
|
||||
if (expecttype =~ /\*/)
|
||||
c_types[c_type] = "UNITY_TEST_ASSERT_EQUAL_#{expecttype.gsub(/\*/,'')}_ARRAY"
|
||||
else
|
||||
c_types[c_type] = "UNITY_TEST_ASSERT_EQUAL_#{expecttype}"
|
||||
c_types[c_type+'*'] ||= "UNITY_TEST_ASSERT_EQUAL_#{expecttype}_ARRAY"
|
||||
end
|
||||
end
|
||||
c_types
|
||||
end
|
||||
|
||||
def import_source
|
||||
source = @config.load_unity_helper
|
||||
return {} if source.nil?
|
||||
c_types = {}
|
||||
source = source.gsub(/\/\/.*$/, '') #remove line comments
|
||||
source = source.gsub(/\/\*.*?\*\//m, '') #remove block comments
|
||||
|
||||
#scan for comparison helpers
|
||||
match_regex = Regexp.new('^\s*#define\s+(UNITY_TEST_ASSERT_EQUAL_(\w+))\s*\(' + Array.new(4,'\s*\w+\s*').join(',') + '\)')
|
||||
pairs = source.scan(match_regex).flatten.compact
|
||||
(pairs.size/2).times do |i|
|
||||
expect = pairs[i*2]
|
||||
ctype = pairs[(i*2)+1]
|
||||
c_types[ctype] = expect unless expect.include?("_ARRAY")
|
||||
end
|
||||
|
||||
#scan for array variants of those helpers
|
||||
match_regex = Regexp.new('^\s*#define\s+(UNITY_TEST_ASSERT_EQUAL_(\w+_ARRAY))\s*\(' + Array.new(5,'\s*\w+\s*').join(',') + '\)')
|
||||
pairs = source.scan(match_regex).flatten.compact
|
||||
(pairs.size/2).times do |i|
|
||||
expect = pairs[i*2]
|
||||
ctype = pairs[(i*2)+1]
|
||||
c_types[ctype.gsub('_ARRAY','*')] = expect
|
||||
end
|
||||
|
||||
c_types
|
||||
end
|
||||
end
|
||||
|
||||
+186
-186
@@ -1,186 +1,186 @@
|
||||
/* ==========================================
|
||||
CMock Project - Automatic Mock Generation for C
|
||||
Copyright (c) 2007 Mike Karlesky, Mark VanderVoord, Greg Williams
|
||||
[Released under MIT License. Please refer to license.txt for details]
|
||||
========================================== */
|
||||
|
||||
#include "unity.h"
|
||||
#include "cmock.h"
|
||||
|
||||
#define TEST_MEM_INDEX_SIZE (CMOCK_MEM_INDEX_TYPE)(sizeof(CMOCK_MEM_INDEX_TYPE))
|
||||
#define TEST_MEM_INDEX_PAD (CMOCK_MEM_INDEX_TYPE)(((CMOCK_MEM_INDEX_TYPE)sizeof(CMOCK_MEM_INDEX_TYPE) + 7) & ~7) //round up to nearest 4 byte boundary
|
||||
|
||||
CMOCK_MEM_INDEX_TYPE StartingSize;
|
||||
|
||||
void setUp(void)
|
||||
{
|
||||
CMock_Guts_MemFreeAll();
|
||||
StartingSize = CMock_Guts_MemBytesFree();
|
||||
TEST_ASSERT_EQUAL(0, CMock_Guts_MemBytesUsed());
|
||||
}
|
||||
|
||||
void tearDown(void)
|
||||
{
|
||||
}
|
||||
|
||||
void test_MemNewWillReturnNullIfGivenIllegalSizes(void)
|
||||
{
|
||||
TEST_ASSERT_EQUAL_HEX( CMOCK_GUTS_NONE, CMock_Guts_MemNew(0) );
|
||||
|
||||
//verify we're cleared still
|
||||
TEST_ASSERT_EQUAL(0, CMock_Guts_MemBytesUsed());
|
||||
TEST_ASSERT_EQUAL(0, CMock_Guts_MemBytesFree());
|
||||
}
|
||||
|
||||
void test_MemNewWillNowSupportSizesGreaterThanTheDefinesCMockSize(void)
|
||||
{
|
||||
TEST_ASSERT_EQUAL(0, CMock_Guts_MemBytesFree());
|
||||
|
||||
TEST_ASSERT_MESSAGE(CMock_Guts_MemNew(CMOCK_MEM_SIZE - TEST_MEM_INDEX_SIZE + 1) != CMOCK_GUTS_NONE, "Should Not Have Returned CMOCK_GUTS_NONE");
|
||||
|
||||
TEST_ASSERT_EQUAL(((CMOCK_MEM_INDEX_TYPE)CMOCK_MEM_SIZE + TEST_MEM_INDEX_PAD), CMock_Guts_MemBytesUsed());
|
||||
TEST_ASSERT_EQUAL((CMOCK_MEM_INDEX_TYPE)CMOCK_MEM_SIZE, CMock_Guts_MemBytesFree());
|
||||
}
|
||||
|
||||
void test_MemChainWillReturnNullAndDoNothingIfGivenIllegalInformation(void)
|
||||
{
|
||||
CMOCK_MEM_INDEX_TYPE next = CMock_Guts_MemNew(8);
|
||||
TEST_ASSERT_EQUAL(8 + TEST_MEM_INDEX_PAD, CMock_Guts_MemBytesUsed());
|
||||
TEST_ASSERT_EQUAL(StartingSize - 8 - TEST_MEM_INDEX_PAD, CMock_Guts_MemBytesFree());
|
||||
|
||||
TEST_ASSERT_EQUAL_HEX( CMOCK_GUTS_NONE, CMock_Guts_MemChain(next + CMOCK_MEM_SIZE, next) );
|
||||
TEST_ASSERT_EQUAL_HEX( CMOCK_GUTS_NONE, CMock_Guts_MemChain(next, next + CMOCK_MEM_SIZE) );
|
||||
|
||||
//verify we're still the same
|
||||
TEST_ASSERT_EQUAL(8 + TEST_MEM_INDEX_PAD, CMock_Guts_MemBytesUsed());
|
||||
TEST_ASSERT_EQUAL(StartingSize - 8 - TEST_MEM_INDEX_PAD, CMock_Guts_MemBytesFree());
|
||||
}
|
||||
|
||||
void test_MemNextWillReturnNullIfGivenABadRoot(void)
|
||||
{
|
||||
TEST_ASSERT_EQUAL_HEX( CMOCK_GUTS_NONE, CMock_Guts_MemNext(0) );
|
||||
TEST_ASSERT_EQUAL_HEX( CMOCK_GUTS_NONE, CMock_Guts_MemNext(2) );
|
||||
TEST_ASSERT_EQUAL_HEX( CMOCK_GUTS_NONE, CMock_Guts_MemNext( CMOCK_MEM_SIZE - 4 ) );
|
||||
|
||||
//verify we're cleared still
|
||||
TEST_ASSERT_EQUAL(0, CMock_Guts_MemBytesUsed());
|
||||
TEST_ASSERT_EQUAL(StartingSize, CMock_Guts_MemBytesFree());
|
||||
}
|
||||
|
||||
void test_ThatWeCanClaimAndChainAFewElementsTogether(void)
|
||||
{
|
||||
unsigned int i;
|
||||
CMOCK_MEM_INDEX_TYPE first = CMOCK_GUTS_NONE;
|
||||
CMOCK_MEM_INDEX_TYPE next;
|
||||
CMOCK_MEM_INDEX_TYPE element[4];
|
||||
|
||||
//verify we're cleared first
|
||||
TEST_ASSERT_EQUAL(0, CMock_Guts_MemBytesUsed());
|
||||
TEST_ASSERT_EQUAL(StartingSize, CMock_Guts_MemBytesFree());
|
||||
|
||||
//first element
|
||||
element[0] = CMock_Guts_MemNew(sizeof(unsigned int));
|
||||
TEST_ASSERT_MESSAGE(element[0] != CMOCK_GUTS_NONE, "Should Not Have Returned CMOCK_GUTS_NONE");
|
||||
first = CMock_Guts_MemChain(first, element[0]);
|
||||
TEST_ASSERT_EQUAL(element[0], first);
|
||||
*((unsigned int*)CMock_Guts_GetAddressFor(element[0])) = 0;
|
||||
|
||||
//verify we're using the right amount of memory
|
||||
TEST_ASSERT_EQUAL(1 * (TEST_MEM_INDEX_PAD + 8), CMock_Guts_MemBytesUsed());
|
||||
TEST_ASSERT_EQUAL(StartingSize - 1 * (TEST_MEM_INDEX_PAD + 8), CMock_Guts_MemBytesFree());
|
||||
|
||||
//second element
|
||||
element[1] = CMock_Guts_MemNew(sizeof(unsigned int));
|
||||
TEST_ASSERT_MESSAGE(element[1] != CMOCK_GUTS_NONE, "Should Not Have Returned CMOCK_GUTS_NONE");
|
||||
TEST_ASSERT_NOT_EQUAL(element[0], element[1]);
|
||||
TEST_ASSERT_EQUAL(first, CMock_Guts_MemChain(first, element[1]));
|
||||
*((unsigned int*)CMock_Guts_GetAddressFor(element[1])) = 1;
|
||||
|
||||
//verify we're using the right amount of memory
|
||||
TEST_ASSERT_EQUAL(2 * (TEST_MEM_INDEX_PAD + 8), CMock_Guts_MemBytesUsed());
|
||||
TEST_ASSERT_EQUAL(StartingSize - 2 * (TEST_MEM_INDEX_PAD + 8), CMock_Guts_MemBytesFree());
|
||||
|
||||
//third element
|
||||
element[2] = CMock_Guts_MemNew(sizeof(unsigned int));
|
||||
TEST_ASSERT_MESSAGE(element[2] != CMOCK_GUTS_NONE, "Should Not Have Returned CMOCK_GUTS_NONE");
|
||||
TEST_ASSERT_NOT_EQUAL(element[0], element[2]);
|
||||
TEST_ASSERT_NOT_EQUAL(element[1], element[2]);
|
||||
TEST_ASSERT_EQUAL(first, CMock_Guts_MemChain(first, element[2]));
|
||||
*((unsigned int*)CMock_Guts_GetAddressFor(element[2])) = 2;
|
||||
|
||||
//verify we're using the right amount of memory
|
||||
TEST_ASSERT_EQUAL(3 * (TEST_MEM_INDEX_PAD + 8), CMock_Guts_MemBytesUsed());
|
||||
TEST_ASSERT_EQUAL(StartingSize - 3 * (TEST_MEM_INDEX_PAD + 8), CMock_Guts_MemBytesFree());
|
||||
|
||||
//fourth element
|
||||
element[3] = CMock_Guts_MemNew(sizeof(unsigned int));
|
||||
TEST_ASSERT_MESSAGE(element[3] != CMOCK_GUTS_NONE, "Should Not Have Returned CMOCK_GUTS_NONE");
|
||||
TEST_ASSERT_NOT_EQUAL(element[0], element[3]);
|
||||
TEST_ASSERT_NOT_EQUAL(element[1], element[3]);
|
||||
TEST_ASSERT_NOT_EQUAL(element[2], element[3]);
|
||||
TEST_ASSERT_EQUAL(first, CMock_Guts_MemChain(first, element[3]));
|
||||
*((unsigned int*)CMock_Guts_GetAddressFor(element[3])) = 3;
|
||||
|
||||
//verify we're using the right amount of memory
|
||||
TEST_ASSERT_EQUAL(4 * (TEST_MEM_INDEX_PAD + 8), CMock_Guts_MemBytesUsed());
|
||||
TEST_ASSERT_EQUAL(StartingSize - 4 * (TEST_MEM_INDEX_PAD + 8), CMock_Guts_MemBytesFree());
|
||||
|
||||
//traverse list
|
||||
next = first;
|
||||
for (i = 0; i < 4; i++)
|
||||
{
|
||||
TEST_ASSERT_EQUAL(element[i], next);
|
||||
TEST_ASSERT_EQUAL(i, *((unsigned int*)CMock_Guts_GetAddressFor(element[i])));
|
||||
next = CMock_Guts_MemNext(next);
|
||||
}
|
||||
|
||||
//verify we get a null at the end of the list
|
||||
TEST_ASSERT_EQUAL_HEX( CMOCK_GUTS_NONE, next);
|
||||
|
||||
//verify we're using the right amount of memory
|
||||
TEST_ASSERT_EQUAL(4 * (TEST_MEM_INDEX_PAD + 8), CMock_Guts_MemBytesUsed());
|
||||
TEST_ASSERT_EQUAL(StartingSize - 4 * (TEST_MEM_INDEX_PAD + 8), CMock_Guts_MemBytesFree());
|
||||
|
||||
//Free it all
|
||||
CMock_Guts_MemFreeAll();
|
||||
|
||||
//verify we're cleared
|
||||
TEST_ASSERT_EQUAL(0, CMock_Guts_MemBytesUsed());
|
||||
TEST_ASSERT_EQUAL(StartingSize, CMock_Guts_MemBytesFree());
|
||||
}
|
||||
|
||||
void test_ThatWeCanAskForAllSortsOfSizes(void)
|
||||
{
|
||||
CMOCK_MEM_INDEX_TYPE i;
|
||||
CMOCK_MEM_INDEX_TYPE first = CMOCK_GUTS_NONE;
|
||||
CMOCK_MEM_INDEX_TYPE next;
|
||||
CMOCK_MEM_INDEX_TYPE sizes[10] = {3, 1, 80, 5, 8, 31, 7, 911, 2, 80};
|
||||
CMOCK_MEM_INDEX_TYPE sizes_buffered[10] = {16, 16, 88, 16, 16, 40, 16, 920, 16, 88}; //includes counter
|
||||
CMOCK_MEM_INDEX_TYPE sum = 0;
|
||||
CMOCK_MEM_INDEX_TYPE cap;
|
||||
|
||||
for (i = 0; i < 10; i++)
|
||||
{
|
||||
next = CMock_Guts_MemNew(sizes[i]);
|
||||
TEST_ASSERT_MESSAGE(next != CMOCK_GUTS_NONE, "Should Not Have Returned CMOCK_GUTS_NONE");
|
||||
|
||||
first = CMock_Guts_MemChain(first, next);
|
||||
TEST_ASSERT_MESSAGE(first != CMOCK_GUTS_NONE, "Should Not Have Returned CMOCK_GUTS_NONE");
|
||||
|
||||
sum += sizes_buffered[i];
|
||||
cap = (StartingSize > (sum + CMOCK_MEM_SIZE)) ? StartingSize : (sum + CMOCK_MEM_SIZE);
|
||||
TEST_ASSERT_EQUAL(sum, CMock_Guts_MemBytesUsed());
|
||||
TEST_ASSERT(cap >= CMock_Guts_MemBytesFree());
|
||||
}
|
||||
|
||||
//verify we can still walk through the elements allocated
|
||||
next = first;
|
||||
for (i = 0; i < 10; i++)
|
||||
{
|
||||
TEST_ASSERT_MESSAGE(next != CMOCK_GUTS_NONE, "Should Not Have Returned CMOCK_GUTS_NONE");
|
||||
next = CMock_Guts_MemNext(next);
|
||||
}
|
||||
|
||||
//there aren't any after that
|
||||
TEST_ASSERT_EQUAL_HEX( CMOCK_GUTS_NONE, next);
|
||||
}
|
||||
/* ==========================================
|
||||
CMock Project - Automatic Mock Generation for C
|
||||
Copyright (c) 2007 Mike Karlesky, Mark VanderVoord, Greg Williams
|
||||
[Released under MIT License. Please refer to license.txt for details]
|
||||
========================================== */
|
||||
|
||||
#include "unity.h"
|
||||
#include "cmock.h"
|
||||
|
||||
#define TEST_MEM_INDEX_SIZE (CMOCK_MEM_INDEX_TYPE)(sizeof(CMOCK_MEM_INDEX_TYPE))
|
||||
#define TEST_MEM_INDEX_PAD (CMOCK_MEM_INDEX_TYPE)(((CMOCK_MEM_INDEX_TYPE)sizeof(CMOCK_MEM_INDEX_TYPE) + 7) & ~7) //round up to nearest 4 byte boundary
|
||||
|
||||
CMOCK_MEM_INDEX_TYPE StartingSize;
|
||||
|
||||
void setUp(void)
|
||||
{
|
||||
CMock_Guts_MemFreeAll();
|
||||
StartingSize = CMock_Guts_MemBytesFree();
|
||||
TEST_ASSERT_EQUAL(0, CMock_Guts_MemBytesUsed());
|
||||
}
|
||||
|
||||
void tearDown(void)
|
||||
{
|
||||
}
|
||||
|
||||
void test_MemNewWillReturnNullIfGivenIllegalSizes(void)
|
||||
{
|
||||
TEST_ASSERT_EQUAL_HEX( CMOCK_GUTS_NONE, CMock_Guts_MemNew(0) );
|
||||
|
||||
//verify we're cleared still
|
||||
TEST_ASSERT_EQUAL(0, CMock_Guts_MemBytesUsed());
|
||||
TEST_ASSERT_EQUAL(0, CMock_Guts_MemBytesFree());
|
||||
}
|
||||
|
||||
void test_MemNewWillNowSupportSizesGreaterThanTheDefinesCMockSize(void)
|
||||
{
|
||||
TEST_ASSERT_EQUAL(0, CMock_Guts_MemBytesFree());
|
||||
|
||||
TEST_ASSERT_MESSAGE(CMock_Guts_MemNew(CMOCK_MEM_SIZE - TEST_MEM_INDEX_SIZE + 1) != CMOCK_GUTS_NONE, "Should Not Have Returned CMOCK_GUTS_NONE");
|
||||
|
||||
TEST_ASSERT_EQUAL(((CMOCK_MEM_INDEX_TYPE)CMOCK_MEM_SIZE + TEST_MEM_INDEX_PAD), CMock_Guts_MemBytesUsed());
|
||||
TEST_ASSERT_EQUAL((CMOCK_MEM_INDEX_TYPE)CMOCK_MEM_SIZE, CMock_Guts_MemBytesFree());
|
||||
}
|
||||
|
||||
void test_MemChainWillReturnNullAndDoNothingIfGivenIllegalInformation(void)
|
||||
{
|
||||
CMOCK_MEM_INDEX_TYPE next = CMock_Guts_MemNew(8);
|
||||
TEST_ASSERT_EQUAL(8 + TEST_MEM_INDEX_PAD, CMock_Guts_MemBytesUsed());
|
||||
TEST_ASSERT_EQUAL(StartingSize - 8 - TEST_MEM_INDEX_PAD, CMock_Guts_MemBytesFree());
|
||||
|
||||
TEST_ASSERT_EQUAL_HEX( CMOCK_GUTS_NONE, CMock_Guts_MemChain(next + CMOCK_MEM_SIZE, next) );
|
||||
TEST_ASSERT_EQUAL_HEX( CMOCK_GUTS_NONE, CMock_Guts_MemChain(next, next + CMOCK_MEM_SIZE) );
|
||||
|
||||
//verify we're still the same
|
||||
TEST_ASSERT_EQUAL(8 + TEST_MEM_INDEX_PAD, CMock_Guts_MemBytesUsed());
|
||||
TEST_ASSERT_EQUAL(StartingSize - 8 - TEST_MEM_INDEX_PAD, CMock_Guts_MemBytesFree());
|
||||
}
|
||||
|
||||
void test_MemNextWillReturnNullIfGivenABadRoot(void)
|
||||
{
|
||||
TEST_ASSERT_EQUAL_HEX( CMOCK_GUTS_NONE, CMock_Guts_MemNext(0) );
|
||||
TEST_ASSERT_EQUAL_HEX( CMOCK_GUTS_NONE, CMock_Guts_MemNext(2) );
|
||||
TEST_ASSERT_EQUAL_HEX( CMOCK_GUTS_NONE, CMock_Guts_MemNext( CMOCK_MEM_SIZE - 4 ) );
|
||||
|
||||
//verify we're cleared still
|
||||
TEST_ASSERT_EQUAL(0, CMock_Guts_MemBytesUsed());
|
||||
TEST_ASSERT_EQUAL(StartingSize, CMock_Guts_MemBytesFree());
|
||||
}
|
||||
|
||||
void test_ThatWeCanClaimAndChainAFewElementsTogether(void)
|
||||
{
|
||||
unsigned int i;
|
||||
CMOCK_MEM_INDEX_TYPE first = CMOCK_GUTS_NONE;
|
||||
CMOCK_MEM_INDEX_TYPE next;
|
||||
CMOCK_MEM_INDEX_TYPE element[4];
|
||||
|
||||
//verify we're cleared first
|
||||
TEST_ASSERT_EQUAL(0, CMock_Guts_MemBytesUsed());
|
||||
TEST_ASSERT_EQUAL(StartingSize, CMock_Guts_MemBytesFree());
|
||||
|
||||
//first element
|
||||
element[0] = CMock_Guts_MemNew(sizeof(unsigned int));
|
||||
TEST_ASSERT_MESSAGE(element[0] != CMOCK_GUTS_NONE, "Should Not Have Returned CMOCK_GUTS_NONE");
|
||||
first = CMock_Guts_MemChain(first, element[0]);
|
||||
TEST_ASSERT_EQUAL(element[0], first);
|
||||
*((unsigned int*)CMock_Guts_GetAddressFor(element[0])) = 0;
|
||||
|
||||
//verify we're using the right amount of memory
|
||||
TEST_ASSERT_EQUAL(1 * (TEST_MEM_INDEX_PAD + 8), CMock_Guts_MemBytesUsed());
|
||||
TEST_ASSERT_EQUAL(StartingSize - 1 * (TEST_MEM_INDEX_PAD + 8), CMock_Guts_MemBytesFree());
|
||||
|
||||
//second element
|
||||
element[1] = CMock_Guts_MemNew(sizeof(unsigned int));
|
||||
TEST_ASSERT_MESSAGE(element[1] != CMOCK_GUTS_NONE, "Should Not Have Returned CMOCK_GUTS_NONE");
|
||||
TEST_ASSERT_NOT_EQUAL(element[0], element[1]);
|
||||
TEST_ASSERT_EQUAL(first, CMock_Guts_MemChain(first, element[1]));
|
||||
*((unsigned int*)CMock_Guts_GetAddressFor(element[1])) = 1;
|
||||
|
||||
//verify we're using the right amount of memory
|
||||
TEST_ASSERT_EQUAL(2 * (TEST_MEM_INDEX_PAD + 8), CMock_Guts_MemBytesUsed());
|
||||
TEST_ASSERT_EQUAL(StartingSize - 2 * (TEST_MEM_INDEX_PAD + 8), CMock_Guts_MemBytesFree());
|
||||
|
||||
//third element
|
||||
element[2] = CMock_Guts_MemNew(sizeof(unsigned int));
|
||||
TEST_ASSERT_MESSAGE(element[2] != CMOCK_GUTS_NONE, "Should Not Have Returned CMOCK_GUTS_NONE");
|
||||
TEST_ASSERT_NOT_EQUAL(element[0], element[2]);
|
||||
TEST_ASSERT_NOT_EQUAL(element[1], element[2]);
|
||||
TEST_ASSERT_EQUAL(first, CMock_Guts_MemChain(first, element[2]));
|
||||
*((unsigned int*)CMock_Guts_GetAddressFor(element[2])) = 2;
|
||||
|
||||
//verify we're using the right amount of memory
|
||||
TEST_ASSERT_EQUAL(3 * (TEST_MEM_INDEX_PAD + 8), CMock_Guts_MemBytesUsed());
|
||||
TEST_ASSERT_EQUAL(StartingSize - 3 * (TEST_MEM_INDEX_PAD + 8), CMock_Guts_MemBytesFree());
|
||||
|
||||
//fourth element
|
||||
element[3] = CMock_Guts_MemNew(sizeof(unsigned int));
|
||||
TEST_ASSERT_MESSAGE(element[3] != CMOCK_GUTS_NONE, "Should Not Have Returned CMOCK_GUTS_NONE");
|
||||
TEST_ASSERT_NOT_EQUAL(element[0], element[3]);
|
||||
TEST_ASSERT_NOT_EQUAL(element[1], element[3]);
|
||||
TEST_ASSERT_NOT_EQUAL(element[2], element[3]);
|
||||
TEST_ASSERT_EQUAL(first, CMock_Guts_MemChain(first, element[3]));
|
||||
*((unsigned int*)CMock_Guts_GetAddressFor(element[3])) = 3;
|
||||
|
||||
//verify we're using the right amount of memory
|
||||
TEST_ASSERT_EQUAL(4 * (TEST_MEM_INDEX_PAD + 8), CMock_Guts_MemBytesUsed());
|
||||
TEST_ASSERT_EQUAL(StartingSize - 4 * (TEST_MEM_INDEX_PAD + 8), CMock_Guts_MemBytesFree());
|
||||
|
||||
//traverse list
|
||||
next = first;
|
||||
for (i = 0; i < 4; i++)
|
||||
{
|
||||
TEST_ASSERT_EQUAL(element[i], next);
|
||||
TEST_ASSERT_EQUAL(i, *((unsigned int*)CMock_Guts_GetAddressFor(element[i])));
|
||||
next = CMock_Guts_MemNext(next);
|
||||
}
|
||||
|
||||
//verify we get a null at the end of the list
|
||||
TEST_ASSERT_EQUAL_HEX( CMOCK_GUTS_NONE, next);
|
||||
|
||||
//verify we're using the right amount of memory
|
||||
TEST_ASSERT_EQUAL(4 * (TEST_MEM_INDEX_PAD + 8), CMock_Guts_MemBytesUsed());
|
||||
TEST_ASSERT_EQUAL(StartingSize - 4 * (TEST_MEM_INDEX_PAD + 8), CMock_Guts_MemBytesFree());
|
||||
|
||||
//Free it all
|
||||
CMock_Guts_MemFreeAll();
|
||||
|
||||
//verify we're cleared
|
||||
TEST_ASSERT_EQUAL(0, CMock_Guts_MemBytesUsed());
|
||||
TEST_ASSERT_EQUAL(StartingSize, CMock_Guts_MemBytesFree());
|
||||
}
|
||||
|
||||
void test_ThatWeCanAskForAllSortsOfSizes(void)
|
||||
{
|
||||
CMOCK_MEM_INDEX_TYPE i;
|
||||
CMOCK_MEM_INDEX_TYPE first = CMOCK_GUTS_NONE;
|
||||
CMOCK_MEM_INDEX_TYPE next;
|
||||
CMOCK_MEM_INDEX_TYPE sizes[10] = {3, 1, 80, 5, 8, 31, 7, 911, 2, 80};
|
||||
CMOCK_MEM_INDEX_TYPE sizes_buffered[10] = {16, 16, 88, 16, 16, 40, 16, 920, 16, 88}; //includes counter
|
||||
CMOCK_MEM_INDEX_TYPE sum = 0;
|
||||
CMOCK_MEM_INDEX_TYPE cap;
|
||||
|
||||
for (i = 0; i < 10; i++)
|
||||
{
|
||||
next = CMock_Guts_MemNew(sizes[i]);
|
||||
TEST_ASSERT_MESSAGE(next != CMOCK_GUTS_NONE, "Should Not Have Returned CMOCK_GUTS_NONE");
|
||||
|
||||
first = CMock_Guts_MemChain(first, next);
|
||||
TEST_ASSERT_MESSAGE(first != CMOCK_GUTS_NONE, "Should Not Have Returned CMOCK_GUTS_NONE");
|
||||
|
||||
sum += sizes_buffered[i];
|
||||
cap = (StartingSize > (sum + CMOCK_MEM_SIZE)) ? StartingSize : (sum + CMOCK_MEM_SIZE);
|
||||
TEST_ASSERT_EQUAL(sum, CMock_Guts_MemBytesUsed());
|
||||
TEST_ASSERT(cap >= CMock_Guts_MemBytesFree());
|
||||
}
|
||||
|
||||
//verify we can still walk through the elements allocated
|
||||
next = first;
|
||||
for (i = 0; i < 10; i++)
|
||||
{
|
||||
TEST_ASSERT_MESSAGE(next != CMOCK_GUTS_NONE, "Should Not Have Returned CMOCK_GUTS_NONE");
|
||||
next = CMock_Guts_MemNext(next);
|
||||
}
|
||||
|
||||
//there aren't any after that
|
||||
TEST_ASSERT_EQUAL_HEX( CMOCK_GUTS_NONE, next);
|
||||
}
|
||||
|
||||
@@ -1,11 +1,11 @@
|
||||
/* ==========================================
|
||||
CMock Project - Automatic Mock Generation for C
|
||||
Copyright (c) 2007 Mike Karlesky, Mark VanderVoord, Greg Williams
|
||||
[Released under MIT License. Please refer to license.txt for details]
|
||||
========================================== */
|
||||
|
||||
#ifndef __stdcall
|
||||
#define __stdcall
|
||||
#endif
|
||||
|
||||
int __stdcall this_uses_calling_conventions(int b);
|
||||
/* ==========================================
|
||||
CMock Project - Automatic Mock Generation for C
|
||||
Copyright (c) 2007 Mike Karlesky, Mark VanderVoord, Greg Williams
|
||||
[Released under MIT License. Please refer to license.txt for details]
|
||||
========================================== */
|
||||
|
||||
#ifndef __stdcall
|
||||
#define __stdcall
|
||||
#endif
|
||||
|
||||
int __stdcall this_uses_calling_conventions(int b);
|
||||
|
||||
+275
-275
@@ -1,275 +1,275 @@
|
||||
/* ==========================================
|
||||
CMock Project - Automatic Mock Generation for C
|
||||
Copyright (c) 2007 Mike Karlesky, Mark VanderVoord, Greg Williams
|
||||
[Released under MIT License. Please refer to license.txt for details]
|
||||
========================================== */
|
||||
|
||||
typedef unsigned char OSServiceIdType;
|
||||
typedef void (*OSEKOS_VOIDFUNCPTR)(void);
|
||||
|
||||
typedef unsigned char StatusType;
|
||||
typedef unsigned char OSEK_U8;
|
||||
typedef unsigned short OSEK_U16;
|
||||
typedef unsigned long OSEK_U32;
|
||||
|
||||
void OSEKOSDisableAll(void);
|
||||
void OSEKOSEnableAll(void);
|
||||
|
||||
typedef unsigned long * OSEKOSSaveType;
|
||||
typedef void OSEK_TASK;
|
||||
typedef OSEK_U8 OSEKOSPrioType;
|
||||
|
||||
enum {
|
||||
Task_DbgCAN
|
||||
,
|
||||
Task_ALS
|
||||
,
|
||||
CalibrateMagTask
|
||||
,
|
||||
Task_IAQ
|
||||
,
|
||||
SmartBeam
|
||||
,
|
||||
Task_QbertTestImage
|
||||
,
|
||||
Task_TestQbertMem
|
||||
,
|
||||
Task_Cyclic1000
|
||||
,
|
||||
ProcessMagForCompass
|
||||
,
|
||||
ReadMag
|
||||
,
|
||||
Task_Cyclic10
|
||||
,
|
||||
Task_Wdm
|
||||
,
|
||||
BackgroundTask
|
||||
,
|
||||
Task_Cyclic20
|
||||
,
|
||||
Task_Cyclic2
|
||||
};
|
||||
|
||||
OSEK_TASK OSEKOS_T_Task_DbgCAN(void);
|
||||
OSEK_TASK OSEKOS_T_Task_ALS(void);
|
||||
OSEK_TASK OSEKOS_T_CalibrateMagTask(void);
|
||||
OSEK_TASK OSEKOS_T_Task_IAQ(void);
|
||||
OSEK_TASK OSEKOS_T_SmartBeam(void);
|
||||
OSEK_TASK OSEKOS_T_Task_QbertTestImage(void);
|
||||
OSEK_TASK OSEKOS_T_Task_TestQbertMem(void);
|
||||
OSEK_TASK OSEKOS_T_Task_Cyclic1000(void);
|
||||
OSEK_TASK OSEKOS_T_ProcessMagForCompass(void);
|
||||
OSEK_TASK OSEKOS_T_ReadMag(void);
|
||||
OSEK_TASK OSEKOS_T_Task_Cyclic10(void);
|
||||
OSEK_TASK OSEKOS_T_Task_Wdm(void);
|
||||
OSEK_TASK OSEKOS_T_BackgroundTask(void);
|
||||
OSEK_TASK OSEKOS_T_Task_Cyclic20(void);
|
||||
OSEK_TASK OSEKOS_T_Task_Cyclic2(void);
|
||||
OSEK_TASK OSEKOS_Twrap_Task_DbgCAN(void);
|
||||
OSEK_TASK OSEKOS_Twrap_Task_ALS(void);
|
||||
OSEK_TASK OSEKOS_Twrap_CalibrateMagTask(void);
|
||||
OSEK_TASK OSEKOS_Twrap_Task_IAQ(void);
|
||||
OSEK_TASK OSEKOS_Twrap_SmartBeam(void);
|
||||
OSEK_TASK OSEKOS_Twrap_Task_QbertTestImage(void);
|
||||
OSEK_TASK OSEKOS_Twrap_Task_TestQbertMem(void);
|
||||
OSEK_TASK OSEKOS_Twrap_Task_Cyclic1000(void);
|
||||
OSEK_TASK OSEKOS_Twrap_ProcessMagForCompass(void);
|
||||
OSEK_TASK OSEKOS_Twrap_ReadMag(void);
|
||||
OSEK_TASK OSEKOS_Twrap_Task_Cyclic10(void);
|
||||
OSEK_TASK OSEKOS_Twrap_Task_Wdm(void);
|
||||
OSEK_TASK OSEKOS_Twrap_BackgroundTask(void);
|
||||
OSEK_TASK OSEKOS_Twrap_Task_Cyclic20(void);
|
||||
OSEK_TASK OSEKOS_Twrap_Task_Cyclic2(void);
|
||||
|
||||
typedef OSEK_U8 TaskType;
|
||||
typedef OSEK_U8 TaskStateType;
|
||||
typedef OSEK_U16 EventMaskType;
|
||||
typedef OSEK_U8 ResourceType;
|
||||
|
||||
void OSEKOSEnableSystemTimers(void);
|
||||
|
||||
typedef OSEK_U8 CounterType;
|
||||
typedef OSEK_U32 TickType;
|
||||
typedef OSEK_U8 AlarmType;
|
||||
|
||||
void OSEKOS_ISR_CanTxInterrupt(void);
|
||||
void OSEKOS_ISR_CanRxInterrupt(void);
|
||||
void OSEKOS_ISR_CanErrInterrupt(void);
|
||||
void OSEKOS_ISR_SCIRxInterrupt(void);
|
||||
void OSEKOS_ISR_SCITxInterrupt(void);
|
||||
void OSEKOS_ISR_UP_DMA_Interrupt_0(void);
|
||||
void OSEKOS_ISR_UP_DMA_Interrupt_1(void);
|
||||
void OSEKOS_ISR_UP_DMA_Interrupt_2(void);
|
||||
void OSEKOS_ISR_UP_DMA_Interrupt_3(void);
|
||||
void OSEKOS_ISR_CompFreqHandler(void);
|
||||
void OSEKOS_ISR_AmbientReturnInt(void);
|
||||
void OSEKOS_ISR_GlareReturnInt(void);
|
||||
void OSEKOS_ISR_ALSTimeoutInt(void);
|
||||
void OSEKOS_ISR_LINTimerInt(void);
|
||||
void OSEKOS_ISR_LINDelayInt(void);
|
||||
void OSEKOS_ISR_TimerMExpire(void);
|
||||
void OSEKOS_ISR_LINRxTx_SCI1(void);
|
||||
void OSEKOS_ISR_CanRxInterrupt_1(void);
|
||||
void OSEKOS_ISR_LINError_SCI1(void);
|
||||
void OSEKOS_ISR_SysCounter(void);
|
||||
|
||||
|
||||
// defined multiple times (slightly different forms) These should be ignored because they are externed
|
||||
extern void OSEKOS_ISR_CanTxInterrupt( void );
|
||||
extern void OSEKOS_ISR_CanRxInterrupt( void );
|
||||
|
||||
|
||||
unsigned long OSEKOSrtcGetSeconds ( void );
|
||||
void OSEKOSrtcIncrement ( unsigned long nsec );
|
||||
|
||||
enum
|
||||
{
|
||||
E_OS_ACCESS = 1,
|
||||
E_OS_CALLEVEL = 2,
|
||||
E_OS_ID = 3,
|
||||
E_OS_LIMIT = 4,
|
||||
E_OS_NOFUNC = 5,
|
||||
E_OS_RESOURCE = 6,
|
||||
E_OS_STATE = 7,
|
||||
E_OS_VALUE = 8,
|
||||
E_OS_SYS_StackOverflow = 20,
|
||||
E_OS_SYS_StackUnderflow = 21,
|
||||
E_OS_SYS_INIT = 22,
|
||||
E_OS_SYS_CONFIG = 23,
|
||||
E_OS_SYS_CODE = 24,
|
||||
E_OS_SYS_TOOL = 25,
|
||||
E_OS_SYS_TimerRange = 26
|
||||
};
|
||||
|
||||
enum
|
||||
{
|
||||
SUSPENDED = 0x00,
|
||||
READY = 0x01,
|
||||
RUNNING = 0x02,
|
||||
WAITING = 0x03,
|
||||
INTSTART = 0x08,
|
||||
SETSTART = 0x10,
|
||||
NPRTASK = 0x20,
|
||||
USEFP = 0x40
|
||||
};
|
||||
|
||||
typedef struct
|
||||
{
|
||||
TickType maxallowedvalue;
|
||||
TickType ticksperbase;
|
||||
} AlarmBaseType;
|
||||
|
||||
typedef TaskType *TaskRefType;
|
||||
typedef TaskStateType *TaskStateRefType;
|
||||
typedef EventMaskType *EventMaskRefType;
|
||||
typedef TickType *TickRefType;
|
||||
typedef AlarmBaseType *AlarmBaseRefType;
|
||||
typedef OSEK_U8 AppModeType;
|
||||
typedef OSEK_U8 OSEKOSTaskActCntType;
|
||||
|
||||
TaskType OSEKOStidact;
|
||||
OSEKOSPrioType OSEKOSrunprio;
|
||||
|
||||
StatusType OSEKOSError ( register StatusType );
|
||||
void ErrorHook ( StatusType );
|
||||
void StartupHook ( void );
|
||||
void ShutdownHook ( StatusType );
|
||||
|
||||
int getUsedTaskStack ( TaskType );
|
||||
int getUnusedTaskStack ( TaskType );
|
||||
int getUsedIsrStack ( void );
|
||||
int getUnusedIsrStack ( void );
|
||||
void OSEKOStaskStackCheckInit ( void );
|
||||
signed char OSEKOStaskStackCheck ( OSEK_U8 * );
|
||||
signed char OSEKOSisrStackCheck ( OSEK_U8 * );
|
||||
void OSEKOStaskStackCheckFatal ( OSEK_U8 * );
|
||||
void OSEKOSisrStackCheckFatal ( OSEK_U8 * );
|
||||
OSEK_U8 * OSEKOSgetStackPointer ( void );
|
||||
void OSEKOSTaskSwitch ( void );
|
||||
StatusType OSEKOSReturn ( StatusType );
|
||||
StatusType OSEKOSActivateTask ( register TaskType );
|
||||
void OSEKOSTerminateTask ( TaskType, TaskType );
|
||||
|
||||
extern void OSEKOSGetResource ( ResourceType );
|
||||
extern void OSEKOSReleaseResource ( ResourceType );
|
||||
|
||||
int OSEKOSSetEvent ( TaskType, EventMaskType );
|
||||
int OSEKOSWaitEvent ( EventMaskType );
|
||||
TickType OSEKOSGetAlarm(register AlarmType);
|
||||
void OSEKOSSetAlarm ( AlarmType, TickType, TickType );
|
||||
StatusType OSEKOSSetAbsAlarm ( AlarmType a, TickType b, TickType c );
|
||||
|
||||
StatusType OSEKOSCancelAlarm ( register AlarmType );
|
||||
void OSEKOSAdvCntr ( void );
|
||||
AppModeType GetActiveApplicationMode ( void );
|
||||
|
||||
void StartOS ( AppModeType );
|
||||
|
||||
void OSEKOSShutdownOS ( StatusType );
|
||||
|
||||
StatusType ActivateTask ( TaskType A );
|
||||
StatusType TerminateTask ( void );
|
||||
StatusType ChainTask ( TaskType A );
|
||||
StatusType GetTaskState ( TaskType A, TaskStateRefType B );
|
||||
StatusType GetTaskID ( TaskRefType A );
|
||||
StatusType Schedule ( void );
|
||||
StatusType GetResource ( ResourceType A );
|
||||
StatusType ReleaseResource ( ResourceType A );
|
||||
StatusType SetEvent ( TaskType A, EventMaskType B );
|
||||
StatusType ClearEvent ( EventMaskType A );
|
||||
StatusType WaitEvent ( EventMaskType A );
|
||||
StatusType GetEvent ( TaskType A, EventMaskRefType B );
|
||||
StatusType GetAlarm ( AlarmType A, TickRefType B );
|
||||
StatusType GetAlarmBase ( AlarmType A, AlarmBaseRefType B );
|
||||
StatusType SetRelAlarm ( AlarmType A, TickType B, TickType C );
|
||||
StatusType SetAbsAlarm ( AlarmType A, TickType B, TickType C );
|
||||
StatusType CancelAlarm ( AlarmType A );
|
||||
StatusType AdvCntr ( CounterType A );
|
||||
StatusType IAdvCntr ( CounterType A );
|
||||
void SuspendOSInterrupts ( void );
|
||||
void ResumeOSInterrupts ( void );
|
||||
void SuspendAllInterrupts ( void );
|
||||
void ResumeAllInterrupts ( void );
|
||||
void DisableAllInterrupts ( void );
|
||||
void EnableAllInterrupts ( void );
|
||||
|
||||
void OSEKOSDisable(void);
|
||||
void OSEKOSEnable(void);
|
||||
void OSEKOSAsmIDispatch(unsigned long *);
|
||||
void OSEKOSAsmDispatch(OSEKOSPrioType p);
|
||||
void OSEKOSStartupEnable(void);
|
||||
void OSEKOSNop(void);
|
||||
unsigned int OSEKOSV850CheckIsrSwitch(void);
|
||||
void OSEKOSV850InitInterrupts(void);
|
||||
void OSEKOSV850SetupInterrupts();
|
||||
void OSEKOSV850SyncContextLoad(OSEKOSSaveType);
|
||||
void OSEKOSV850SyncContextLoadFromIRQ(OSEKOSSaveType);
|
||||
void OSEKOSV850ASyncContextLoad(OSEKOSSaveType);
|
||||
void OSEKOSV850ASyncContextLoadFromIRQ(OSEKOSSaveType);
|
||||
|
||||
// arrays of function pointers - they look like function prototypes
|
||||
void ( ( * const OSEKOStaskStartAddress [10] ) ( void ) );
|
||||
StatusType (* OSEKOStaskStatuses [10][5]) ( void );
|
||||
|
||||
void OSEKOSV850StartContext
|
||||
(
|
||||
OSEK_TASK (( * const ) ( void )),
|
||||
OSEK_U8 * const
|
||||
);
|
||||
void OSEKOSV850StartContextFromIRQ
|
||||
(
|
||||
OSEK_TASK (( * const ) ( void )),
|
||||
OSEK_U8 * const
|
||||
);
|
||||
|
||||
void OSEKOSSuspendOSInterrupts(void);
|
||||
void OSEKOSResumeOSInterrupts(void);
|
||||
void OSEKOSSuspendAllInterrupts(void);
|
||||
void OSEKOSResumeAllInterrupts(void);
|
||||
void OSEKOScheckSuspendResumeNesting(void);
|
||||
|
||||
|
||||
void OSEKOSgetSR(void);
|
||||
void OSEKOSEnableInterrupt_intern(int nr);
|
||||
void OSEKOSDisableInterrupt_intern(int nr);
|
||||
/* ==========================================
|
||||
CMock Project - Automatic Mock Generation for C
|
||||
Copyright (c) 2007 Mike Karlesky, Mark VanderVoord, Greg Williams
|
||||
[Released under MIT License. Please refer to license.txt for details]
|
||||
========================================== */
|
||||
|
||||
typedef unsigned char OSServiceIdType;
|
||||
typedef void (*OSEKOS_VOIDFUNCPTR)(void);
|
||||
|
||||
typedef unsigned char StatusType;
|
||||
typedef unsigned char OSEK_U8;
|
||||
typedef unsigned short OSEK_U16;
|
||||
typedef unsigned long OSEK_U32;
|
||||
|
||||
void OSEKOSDisableAll(void);
|
||||
void OSEKOSEnableAll(void);
|
||||
|
||||
typedef unsigned long * OSEKOSSaveType;
|
||||
typedef void OSEK_TASK;
|
||||
typedef OSEK_U8 OSEKOSPrioType;
|
||||
|
||||
enum {
|
||||
Task_DbgCAN
|
||||
,
|
||||
Task_ALS
|
||||
,
|
||||
CalibrateMagTask
|
||||
,
|
||||
Task_IAQ
|
||||
,
|
||||
SmartBeam
|
||||
,
|
||||
Task_QbertTestImage
|
||||
,
|
||||
Task_TestQbertMem
|
||||
,
|
||||
Task_Cyclic1000
|
||||
,
|
||||
ProcessMagForCompass
|
||||
,
|
||||
ReadMag
|
||||
,
|
||||
Task_Cyclic10
|
||||
,
|
||||
Task_Wdm
|
||||
,
|
||||
BackgroundTask
|
||||
,
|
||||
Task_Cyclic20
|
||||
,
|
||||
Task_Cyclic2
|
||||
};
|
||||
|
||||
OSEK_TASK OSEKOS_T_Task_DbgCAN(void);
|
||||
OSEK_TASK OSEKOS_T_Task_ALS(void);
|
||||
OSEK_TASK OSEKOS_T_CalibrateMagTask(void);
|
||||
OSEK_TASK OSEKOS_T_Task_IAQ(void);
|
||||
OSEK_TASK OSEKOS_T_SmartBeam(void);
|
||||
OSEK_TASK OSEKOS_T_Task_QbertTestImage(void);
|
||||
OSEK_TASK OSEKOS_T_Task_TestQbertMem(void);
|
||||
OSEK_TASK OSEKOS_T_Task_Cyclic1000(void);
|
||||
OSEK_TASK OSEKOS_T_ProcessMagForCompass(void);
|
||||
OSEK_TASK OSEKOS_T_ReadMag(void);
|
||||
OSEK_TASK OSEKOS_T_Task_Cyclic10(void);
|
||||
OSEK_TASK OSEKOS_T_Task_Wdm(void);
|
||||
OSEK_TASK OSEKOS_T_BackgroundTask(void);
|
||||
OSEK_TASK OSEKOS_T_Task_Cyclic20(void);
|
||||
OSEK_TASK OSEKOS_T_Task_Cyclic2(void);
|
||||
OSEK_TASK OSEKOS_Twrap_Task_DbgCAN(void);
|
||||
OSEK_TASK OSEKOS_Twrap_Task_ALS(void);
|
||||
OSEK_TASK OSEKOS_Twrap_CalibrateMagTask(void);
|
||||
OSEK_TASK OSEKOS_Twrap_Task_IAQ(void);
|
||||
OSEK_TASK OSEKOS_Twrap_SmartBeam(void);
|
||||
OSEK_TASK OSEKOS_Twrap_Task_QbertTestImage(void);
|
||||
OSEK_TASK OSEKOS_Twrap_Task_TestQbertMem(void);
|
||||
OSEK_TASK OSEKOS_Twrap_Task_Cyclic1000(void);
|
||||
OSEK_TASK OSEKOS_Twrap_ProcessMagForCompass(void);
|
||||
OSEK_TASK OSEKOS_Twrap_ReadMag(void);
|
||||
OSEK_TASK OSEKOS_Twrap_Task_Cyclic10(void);
|
||||
OSEK_TASK OSEKOS_Twrap_Task_Wdm(void);
|
||||
OSEK_TASK OSEKOS_Twrap_BackgroundTask(void);
|
||||
OSEK_TASK OSEKOS_Twrap_Task_Cyclic20(void);
|
||||
OSEK_TASK OSEKOS_Twrap_Task_Cyclic2(void);
|
||||
|
||||
typedef OSEK_U8 TaskType;
|
||||
typedef OSEK_U8 TaskStateType;
|
||||
typedef OSEK_U16 EventMaskType;
|
||||
typedef OSEK_U8 ResourceType;
|
||||
|
||||
void OSEKOSEnableSystemTimers(void);
|
||||
|
||||
typedef OSEK_U8 CounterType;
|
||||
typedef OSEK_U32 TickType;
|
||||
typedef OSEK_U8 AlarmType;
|
||||
|
||||
void OSEKOS_ISR_CanTxInterrupt(void);
|
||||
void OSEKOS_ISR_CanRxInterrupt(void);
|
||||
void OSEKOS_ISR_CanErrInterrupt(void);
|
||||
void OSEKOS_ISR_SCIRxInterrupt(void);
|
||||
void OSEKOS_ISR_SCITxInterrupt(void);
|
||||
void OSEKOS_ISR_UP_DMA_Interrupt_0(void);
|
||||
void OSEKOS_ISR_UP_DMA_Interrupt_1(void);
|
||||
void OSEKOS_ISR_UP_DMA_Interrupt_2(void);
|
||||
void OSEKOS_ISR_UP_DMA_Interrupt_3(void);
|
||||
void OSEKOS_ISR_CompFreqHandler(void);
|
||||
void OSEKOS_ISR_AmbientReturnInt(void);
|
||||
void OSEKOS_ISR_GlareReturnInt(void);
|
||||
void OSEKOS_ISR_ALSTimeoutInt(void);
|
||||
void OSEKOS_ISR_LINTimerInt(void);
|
||||
void OSEKOS_ISR_LINDelayInt(void);
|
||||
void OSEKOS_ISR_TimerMExpire(void);
|
||||
void OSEKOS_ISR_LINRxTx_SCI1(void);
|
||||
void OSEKOS_ISR_CanRxInterrupt_1(void);
|
||||
void OSEKOS_ISR_LINError_SCI1(void);
|
||||
void OSEKOS_ISR_SysCounter(void);
|
||||
|
||||
|
||||
// defined multiple times (slightly different forms) These should be ignored because they are externed
|
||||
extern void OSEKOS_ISR_CanTxInterrupt( void );
|
||||
extern void OSEKOS_ISR_CanRxInterrupt( void );
|
||||
|
||||
|
||||
unsigned long OSEKOSrtcGetSeconds ( void );
|
||||
void OSEKOSrtcIncrement ( unsigned long nsec );
|
||||
|
||||
enum
|
||||
{
|
||||
E_OS_ACCESS = 1,
|
||||
E_OS_CALLEVEL = 2,
|
||||
E_OS_ID = 3,
|
||||
E_OS_LIMIT = 4,
|
||||
E_OS_NOFUNC = 5,
|
||||
E_OS_RESOURCE = 6,
|
||||
E_OS_STATE = 7,
|
||||
E_OS_VALUE = 8,
|
||||
E_OS_SYS_StackOverflow = 20,
|
||||
E_OS_SYS_StackUnderflow = 21,
|
||||
E_OS_SYS_INIT = 22,
|
||||
E_OS_SYS_CONFIG = 23,
|
||||
E_OS_SYS_CODE = 24,
|
||||
E_OS_SYS_TOOL = 25,
|
||||
E_OS_SYS_TimerRange = 26
|
||||
};
|
||||
|
||||
enum
|
||||
{
|
||||
SUSPENDED = 0x00,
|
||||
READY = 0x01,
|
||||
RUNNING = 0x02,
|
||||
WAITING = 0x03,
|
||||
INTSTART = 0x08,
|
||||
SETSTART = 0x10,
|
||||
NPRTASK = 0x20,
|
||||
USEFP = 0x40
|
||||
};
|
||||
|
||||
typedef struct
|
||||
{
|
||||
TickType maxallowedvalue;
|
||||
TickType ticksperbase;
|
||||
} AlarmBaseType;
|
||||
|
||||
typedef TaskType *TaskRefType;
|
||||
typedef TaskStateType *TaskStateRefType;
|
||||
typedef EventMaskType *EventMaskRefType;
|
||||
typedef TickType *TickRefType;
|
||||
typedef AlarmBaseType *AlarmBaseRefType;
|
||||
typedef OSEK_U8 AppModeType;
|
||||
typedef OSEK_U8 OSEKOSTaskActCntType;
|
||||
|
||||
TaskType OSEKOStidact;
|
||||
OSEKOSPrioType OSEKOSrunprio;
|
||||
|
||||
StatusType OSEKOSError ( register StatusType );
|
||||
void ErrorHook ( StatusType );
|
||||
void StartupHook ( void );
|
||||
void ShutdownHook ( StatusType );
|
||||
|
||||
int getUsedTaskStack ( TaskType );
|
||||
int getUnusedTaskStack ( TaskType );
|
||||
int getUsedIsrStack ( void );
|
||||
int getUnusedIsrStack ( void );
|
||||
void OSEKOStaskStackCheckInit ( void );
|
||||
signed char OSEKOStaskStackCheck ( OSEK_U8 * );
|
||||
signed char OSEKOSisrStackCheck ( OSEK_U8 * );
|
||||
void OSEKOStaskStackCheckFatal ( OSEK_U8 * );
|
||||
void OSEKOSisrStackCheckFatal ( OSEK_U8 * );
|
||||
OSEK_U8 * OSEKOSgetStackPointer ( void );
|
||||
void OSEKOSTaskSwitch ( void );
|
||||
StatusType OSEKOSReturn ( StatusType );
|
||||
StatusType OSEKOSActivateTask ( register TaskType );
|
||||
void OSEKOSTerminateTask ( TaskType, TaskType );
|
||||
|
||||
extern void OSEKOSGetResource ( ResourceType );
|
||||
extern void OSEKOSReleaseResource ( ResourceType );
|
||||
|
||||
int OSEKOSSetEvent ( TaskType, EventMaskType );
|
||||
int OSEKOSWaitEvent ( EventMaskType );
|
||||
TickType OSEKOSGetAlarm(register AlarmType);
|
||||
void OSEKOSSetAlarm ( AlarmType, TickType, TickType );
|
||||
StatusType OSEKOSSetAbsAlarm ( AlarmType a, TickType b, TickType c );
|
||||
|
||||
StatusType OSEKOSCancelAlarm ( register AlarmType );
|
||||
void OSEKOSAdvCntr ( void );
|
||||
AppModeType GetActiveApplicationMode ( void );
|
||||
|
||||
void StartOS ( AppModeType );
|
||||
|
||||
void OSEKOSShutdownOS ( StatusType );
|
||||
|
||||
StatusType ActivateTask ( TaskType A );
|
||||
StatusType TerminateTask ( void );
|
||||
StatusType ChainTask ( TaskType A );
|
||||
StatusType GetTaskState ( TaskType A, TaskStateRefType B );
|
||||
StatusType GetTaskID ( TaskRefType A );
|
||||
StatusType Schedule ( void );
|
||||
StatusType GetResource ( ResourceType A );
|
||||
StatusType ReleaseResource ( ResourceType A );
|
||||
StatusType SetEvent ( TaskType A, EventMaskType B );
|
||||
StatusType ClearEvent ( EventMaskType A );
|
||||
StatusType WaitEvent ( EventMaskType A );
|
||||
StatusType GetEvent ( TaskType A, EventMaskRefType B );
|
||||
StatusType GetAlarm ( AlarmType A, TickRefType B );
|
||||
StatusType GetAlarmBase ( AlarmType A, AlarmBaseRefType B );
|
||||
StatusType SetRelAlarm ( AlarmType A, TickType B, TickType C );
|
||||
StatusType SetAbsAlarm ( AlarmType A, TickType B, TickType C );
|
||||
StatusType CancelAlarm ( AlarmType A );
|
||||
StatusType AdvCntr ( CounterType A );
|
||||
StatusType IAdvCntr ( CounterType A );
|
||||
void SuspendOSInterrupts ( void );
|
||||
void ResumeOSInterrupts ( void );
|
||||
void SuspendAllInterrupts ( void );
|
||||
void ResumeAllInterrupts ( void );
|
||||
void DisableAllInterrupts ( void );
|
||||
void EnableAllInterrupts ( void );
|
||||
|
||||
void OSEKOSDisable(void);
|
||||
void OSEKOSEnable(void);
|
||||
void OSEKOSAsmIDispatch(unsigned long *);
|
||||
void OSEKOSAsmDispatch(OSEKOSPrioType p);
|
||||
void OSEKOSStartupEnable(void);
|
||||
void OSEKOSNop(void);
|
||||
unsigned int OSEKOSV850CheckIsrSwitch(void);
|
||||
void OSEKOSV850InitInterrupts(void);
|
||||
void OSEKOSV850SetupInterrupts();
|
||||
void OSEKOSV850SyncContextLoad(OSEKOSSaveType);
|
||||
void OSEKOSV850SyncContextLoadFromIRQ(OSEKOSSaveType);
|
||||
void OSEKOSV850ASyncContextLoad(OSEKOSSaveType);
|
||||
void OSEKOSV850ASyncContextLoadFromIRQ(OSEKOSSaveType);
|
||||
|
||||
// arrays of function pointers - they look like function prototypes
|
||||
void ( ( * const OSEKOStaskStartAddress [10] ) ( void ) );
|
||||
StatusType (* OSEKOStaskStatuses [10][5]) ( void );
|
||||
|
||||
void OSEKOSV850StartContext
|
||||
(
|
||||
OSEK_TASK (( * const ) ( void )),
|
||||
OSEK_U8 * const
|
||||
);
|
||||
void OSEKOSV850StartContextFromIRQ
|
||||
(
|
||||
OSEK_TASK (( * const ) ( void )),
|
||||
OSEK_U8 * const
|
||||
);
|
||||
|
||||
void OSEKOSSuspendOSInterrupts(void);
|
||||
void OSEKOSResumeOSInterrupts(void);
|
||||
void OSEKOSSuspendAllInterrupts(void);
|
||||
void OSEKOSResumeAllInterrupts(void);
|
||||
void OSEKOScheckSuspendResumeNesting(void);
|
||||
|
||||
|
||||
void OSEKOSgetSR(void);
|
||||
void OSEKOSEnableInterrupt_intern(int nr);
|
||||
void OSEKOSDisableInterrupt_intern(int nr);
|
||||
|
||||
@@ -1,375 +1,375 @@
|
||||
---
|
||||
#this test is different than all_plugins_coexist primarily because of these options
|
||||
:cmock:
|
||||
:enforce_strict_ordering: 1
|
||||
:treat_externs: :include
|
||||
:plugins:
|
||||
- :array
|
||||
- :cexception
|
||||
- :ignore
|
||||
- :callback
|
||||
- :return_thru_ptr
|
||||
- :ignore_arg
|
||||
- :expect_any_args
|
||||
|
||||
:systest:
|
||||
:types: |
|
||||
typedef struct _POINT_T {
|
||||
int x;
|
||||
int y;
|
||||
} POINT_T;
|
||||
|
||||
:mockable: |
|
||||
#include "CException.h"
|
||||
void foo(POINT_T* a);
|
||||
POINT_T* bar(void);
|
||||
void fooa(POINT_T a[]);
|
||||
void foos(const char * a);
|
||||
extern const char* bars(void);
|
||||
void no_pointers(int a, const char* b);
|
||||
int mixed(int a, int* b, int c);
|
||||
void no_args(void);
|
||||
|
||||
:source:
|
||||
:header: |
|
||||
#include "CException.h"
|
||||
void function_a(void);
|
||||
void function_b(void);
|
||||
void function_c(void);
|
||||
int function_d(void);
|
||||
void function_e(void);
|
||||
|
||||
:code: |
|
||||
void function_a(void)
|
||||
{
|
||||
foo(bar());
|
||||
}
|
||||
|
||||
void function_b(void) {
|
||||
fooa(bar());
|
||||
}
|
||||
|
||||
void function_c(void) {
|
||||
CEXCEPTION_T e;
|
||||
Try {
|
||||
foos(bars());
|
||||
} Catch(e) { foos("err"); }
|
||||
}
|
||||
|
||||
int function_d(void) {
|
||||
int test_list[] = { 1, 2, 3, 4, 5 };
|
||||
no_pointers(1, "silly");
|
||||
return mixed(6, test_list, 7);
|
||||
}
|
||||
|
||||
void function_e(void) {
|
||||
foos("Hello");
|
||||
foos("Tuna");
|
||||
foos("Oranges");
|
||||
}
|
||||
|
||||
:tests:
|
||||
:common: |
|
||||
#include "CException.h"
|
||||
void setUp(void) {}
|
||||
void tearDown(void) {}
|
||||
|
||||
:units:
|
||||
- :pass: TRUE
|
||||
:should: 'handle the situation where we pass nulls to pointers'
|
||||
:code: |
|
||||
test()
|
||||
{
|
||||
bar_ExpectAndReturn(NULL);
|
||||
foo_Expect(NULL);
|
||||
|
||||
function_a();
|
||||
}
|
||||
|
||||
- :pass: FALSE
|
||||
:should: 'handle the situation where we expected nulls to pointers but did not get that'
|
||||
:code: |
|
||||
test()
|
||||
{
|
||||
POINT_T pt = {1, 2};
|
||||
bar_ExpectAndReturn(&pt);
|
||||
foo_Expect(NULL);
|
||||
|
||||
function_a();
|
||||
}
|
||||
|
||||
- :pass: FALSE
|
||||
:should: 'handle the situation where we did not expect nulls to pointers but got null'
|
||||
:code: |
|
||||
test()
|
||||
{
|
||||
POINT_T ex = {1, 2};
|
||||
bar_ExpectAndReturn(NULL);
|
||||
foo_Expect(&ex);
|
||||
|
||||
function_a();
|
||||
}
|
||||
|
||||
- :pass: FALSE
|
||||
:should: 'handle the situation where we pass single object with expect and it is wrong'
|
||||
:code: |
|
||||
test()
|
||||
{
|
||||
POINT_T pt = {1, 2};
|
||||
POINT_T ex = {1, 3};
|
||||
bar_ExpectAndReturn(&pt);
|
||||
foo_Expect(&ex);
|
||||
|
||||
function_a();
|
||||
}
|
||||
|
||||
- :pass: TRUE
|
||||
:should: 'handle the situation where we pass single object with expect and use array handler'
|
||||
:code: |
|
||||
test()
|
||||
{
|
||||
POINT_T pt = {1, 2};
|
||||
POINT_T ex = {1, 2};
|
||||
bar_ExpectAndReturn(&pt);
|
||||
foo_ExpectWithArray(&ex, 1);
|
||||
|
||||
function_a();
|
||||
}
|
||||
|
||||
- :pass: FALSE
|
||||
:should: 'handle the situation where we pass single object with expect and use array handler and it is wrong'
|
||||
:code: |
|
||||
test()
|
||||
{
|
||||
POINT_T pt = {1, 2};
|
||||
POINT_T ex = {1, 3};
|
||||
bar_ExpectAndReturn(&pt);
|
||||
foo_ExpectWithArray(&ex, 1);
|
||||
|
||||
function_a();
|
||||
}
|
||||
|
||||
- :pass: TRUE
|
||||
:should: 'handle the situation where we pass multiple objects with expect and use array handler'
|
||||
:code: |
|
||||
test()
|
||||
{
|
||||
POINT_T pt[] = {{1, 2}, {3, 4}, {5, 6}};
|
||||
POINT_T ex[] = {{1, 2}, {3, 4}, {5, 6}};
|
||||
bar_ExpectAndReturn(pt);
|
||||
foo_ExpectWithArray(ex, 3);
|
||||
|
||||
function_a();
|
||||
}
|
||||
|
||||
- :pass: FALSE
|
||||
:should: 'handle the situation where we pass multiple objects with expect and use array handler and it is wrong at end'
|
||||
:code: |
|
||||
test()
|
||||
{
|
||||
POINT_T pt[] = {{1, 2}, {3, 4}, {5, 6}};
|
||||
POINT_T ex[] = {{1, 2}, {3, 4}, {5, 9}};
|
||||
bar_ExpectAndReturn(pt);
|
||||
foo_ExpectWithArray(ex, 3);
|
||||
|
||||
function_a();
|
||||
}
|
||||
|
||||
- :pass: TRUE
|
||||
:should: 'handle the situation where we pass single array element with expect'
|
||||
:code: |
|
||||
test()
|
||||
{
|
||||
POINT_T pt = {1, 2};
|
||||
POINT_T ex = {1, 2};
|
||||
bar_ExpectAndReturn(&pt);
|
||||
fooa_Expect(&ex);
|
||||
|
||||
function_b();
|
||||
}
|
||||
|
||||
- :pass: TRUE
|
||||
:should: 'handle standard c string as null terminated and not do crappy memory compares of a byte, passing'
|
||||
:code: |
|
||||
test()
|
||||
{
|
||||
const char* constretval = "This is a\0 silly string";
|
||||
char* retval = (char*)constretval;
|
||||
bars_ExpectAndReturn(retval);
|
||||
foos_Expect("This is a\0 wacky string");
|
||||
|
||||
function_c();
|
||||
}
|
||||
|
||||
- :pass: FALSE
|
||||
:should: 'handle standard c string as null terminated and not do crappy memory compares of a byte, finding failures'
|
||||
:code: |
|
||||
test()
|
||||
{
|
||||
const char* constretval = "This is a silly string";
|
||||
char* retval = (char*)constretval;
|
||||
bars_ExpectAndReturn(retval);
|
||||
foos_Expect("This is a wacky string");
|
||||
|
||||
function_c();
|
||||
}
|
||||
|
||||
- :pass: TRUE
|
||||
:should: 'handle creating array expects when we have mixed arguments for single object'
|
||||
:code: |
|
||||
test()
|
||||
{
|
||||
int expect_list[] = { 1, 9 };
|
||||
no_pointers_Expect(1, "silly");
|
||||
mixed_ExpectAndReturn(6, expect_list, 7, 13);
|
||||
|
||||
TEST_ASSERT_EQUAL(13, function_d());
|
||||
}
|
||||
|
||||
- :pass: FALSE
|
||||
:should: 'handle creating array expects when we have mixed arguments and handle failures for single object'
|
||||
:code: |
|
||||
test()
|
||||
{
|
||||
int expect_list[] = { 9, 1 };
|
||||
no_pointers_Expect(1, "silly");
|
||||
mixed_ExpectAndReturn(6, expect_list, 7, 13);
|
||||
|
||||
TEST_ASSERT_EQUAL(13, function_d());
|
||||
}
|
||||
|
||||
- :pass: TRUE
|
||||
:should: 'handle creating array expects when we have mixed arguments for multiple objects'
|
||||
:code: |
|
||||
test()
|
||||
{
|
||||
int expect_list[] = { 1, 2, 3, 4, 6 };
|
||||
no_pointers_Expect(1, "silly");
|
||||
mixed_ExpectWithArrayAndReturn(6, expect_list, 4, 7, 13);
|
||||
|
||||
TEST_ASSERT_EQUAL(13, function_d());
|
||||
}
|
||||
|
||||
- :pass: FALSE
|
||||
:should: 'handle creating array expects when we have mixed arguments and handle failures for multiple objects'
|
||||
:code: |
|
||||
test()
|
||||
{
|
||||
int expect_list[] = { 1, 2, 3, 4, 6 };
|
||||
no_pointers_Expect(1, "silly");
|
||||
mixed_ExpectWithArrayAndReturn(6, expect_list, 5, 7, 13);
|
||||
|
||||
TEST_ASSERT_EQUAL(13, function_d());
|
||||
}
|
||||
|
||||
- :pass: TRUE
|
||||
:should: 'handle an exception being caught'
|
||||
:code: |
|
||||
test()
|
||||
{
|
||||
const char* constretval = "This is a\0 silly string";
|
||||
char* retval = (char*)constretval;
|
||||
bars_ExpectAndReturn(retval);
|
||||
foos_ExpectAndThrow("This is a\0 wacky string", 55);
|
||||
foos_Expect("err");
|
||||
|
||||
function_c();
|
||||
}
|
||||
|
||||
- :pass: FALSE
|
||||
:should: 'handle an exception being caught but still catch following errors'
|
||||
:code: |
|
||||
test()
|
||||
{
|
||||
const char* constretval = "This is a\0 silly string";
|
||||
char* retval = (char*)constretval;
|
||||
bars_ExpectAndReturn(retval);
|
||||
foos_ExpectAndThrow("This is a\0 wacky string", 55);
|
||||
foos_Expect("wrong error");
|
||||
|
||||
function_c();
|
||||
}
|
||||
|
||||
- :pass: FALSE
|
||||
:should: 'fail strict ordering problems even though we would otherwise have passed'
|
||||
:code: |
|
||||
test()
|
||||
{
|
||||
int expect_list[] = { 1, 2, 3, 4, 6 };
|
||||
mixed_ExpectWithArrayAndReturn(6, expect_list, 4, 7, 13);
|
||||
no_pointers_Expect(1, "silly");
|
||||
|
||||
TEST_ASSERT_EQUAL(13, function_d());
|
||||
}
|
||||
|
||||
- :pass: TRUE
|
||||
:should: 'properly ExpectAnyArgs first function but the other will work properly'
|
||||
:code: |
|
||||
test()
|
||||
{
|
||||
int expect_list[] = { 1, 2, 3, 4, 6 };
|
||||
no_pointers_ExpectAnyArgs();
|
||||
mixed_ExpectWithArrayAndReturn(6, expect_list, 4, 7, 13);
|
||||
|
||||
TEST_ASSERT_EQUAL(13, function_d());
|
||||
}
|
||||
|
||||
- :pass: TRUE
|
||||
:should: 'properly ExpectAnyArgs last function but the other will work properly'
|
||||
:code: |
|
||||
test()
|
||||
{
|
||||
no_pointers_Expect(1, "silly");
|
||||
mixed_ExpectAnyArgsAndReturn(13);
|
||||
|
||||
TEST_ASSERT_EQUAL(13, function_d());
|
||||
}
|
||||
|
||||
- :pass: TRUE
|
||||
:should: 'be ok if we ExpectAnyArgs a call each because we are counting calls'
|
||||
:code: |
|
||||
test()
|
||||
{
|
||||
foos_ExpectAnyArgs();
|
||||
foos_ExpectAnyArgs();
|
||||
foos_ExpectAnyArgs();
|
||||
|
||||
function_e();
|
||||
}
|
||||
|
||||
- :pass: TRUE
|
||||
:should: 'be ok if we ExpectAnyArgs and Expect intermixed because we are counting calls'
|
||||
:code: |
|
||||
test()
|
||||
{
|
||||
foos_Expect("Hello");
|
||||
foos_ExpectAnyArgs();
|
||||
foos_ExpectAnyArgs();
|
||||
|
||||
function_e();
|
||||
}
|
||||
|
||||
- :pass: FALSE
|
||||
:should: 'be able to detect Expect problem if we ExpectAnyArgs and Expect intermixed'
|
||||
:code: |
|
||||
test()
|
||||
{
|
||||
foos_Expect("Hello");
|
||||
foos_ExpectAnyArgs();
|
||||
foos_Expect("Wrong");
|
||||
|
||||
function_e();
|
||||
}
|
||||
|
||||
- :pass: FALSE
|
||||
:should: 'fail if we do not ExpectAnyArgs a call once because we are counting calls'
|
||||
:code: |
|
||||
test()
|
||||
{
|
||||
foos_ExpectAnyArgs();
|
||||
foos_ExpectAnyArgs();
|
||||
|
||||
function_e();
|
||||
}
|
||||
|
||||
...
|
||||
---
|
||||
#this test is different than all_plugins_coexist primarily because of these options
|
||||
:cmock:
|
||||
:enforce_strict_ordering: 1
|
||||
:treat_externs: :include
|
||||
:plugins:
|
||||
- :array
|
||||
- :cexception
|
||||
- :ignore
|
||||
- :callback
|
||||
- :return_thru_ptr
|
||||
- :ignore_arg
|
||||
- :expect_any_args
|
||||
|
||||
:systest:
|
||||
:types: |
|
||||
typedef struct _POINT_T {
|
||||
int x;
|
||||
int y;
|
||||
} POINT_T;
|
||||
|
||||
:mockable: |
|
||||
#include "CException.h"
|
||||
void foo(POINT_T* a);
|
||||
POINT_T* bar(void);
|
||||
void fooa(POINT_T a[]);
|
||||
void foos(const char * a);
|
||||
extern const char* bars(void);
|
||||
void no_pointers(int a, const char* b);
|
||||
int mixed(int a, int* b, int c);
|
||||
void no_args(void);
|
||||
|
||||
:source:
|
||||
:header: |
|
||||
#include "CException.h"
|
||||
void function_a(void);
|
||||
void function_b(void);
|
||||
void function_c(void);
|
||||
int function_d(void);
|
||||
void function_e(void);
|
||||
|
||||
:code: |
|
||||
void function_a(void)
|
||||
{
|
||||
foo(bar());
|
||||
}
|
||||
|
||||
void function_b(void) {
|
||||
fooa(bar());
|
||||
}
|
||||
|
||||
void function_c(void) {
|
||||
CEXCEPTION_T e;
|
||||
Try {
|
||||
foos(bars());
|
||||
} Catch(e) { foos("err"); }
|
||||
}
|
||||
|
||||
int function_d(void) {
|
||||
int test_list[] = { 1, 2, 3, 4, 5 };
|
||||
no_pointers(1, "silly");
|
||||
return mixed(6, test_list, 7);
|
||||
}
|
||||
|
||||
void function_e(void) {
|
||||
foos("Hello");
|
||||
foos("Tuna");
|
||||
foos("Oranges");
|
||||
}
|
||||
|
||||
:tests:
|
||||
:common: |
|
||||
#include "CException.h"
|
||||
void setUp(void) {}
|
||||
void tearDown(void) {}
|
||||
|
||||
:units:
|
||||
- :pass: TRUE
|
||||
:should: 'handle the situation where we pass nulls to pointers'
|
||||
:code: |
|
||||
test()
|
||||
{
|
||||
bar_ExpectAndReturn(NULL);
|
||||
foo_Expect(NULL);
|
||||
|
||||
function_a();
|
||||
}
|
||||
|
||||
- :pass: FALSE
|
||||
:should: 'handle the situation where we expected nulls to pointers but did not get that'
|
||||
:code: |
|
||||
test()
|
||||
{
|
||||
POINT_T pt = {1, 2};
|
||||
bar_ExpectAndReturn(&pt);
|
||||
foo_Expect(NULL);
|
||||
|
||||
function_a();
|
||||
}
|
||||
|
||||
- :pass: FALSE
|
||||
:should: 'handle the situation where we did not expect nulls to pointers but got null'
|
||||
:code: |
|
||||
test()
|
||||
{
|
||||
POINT_T ex = {1, 2};
|
||||
bar_ExpectAndReturn(NULL);
|
||||
foo_Expect(&ex);
|
||||
|
||||
function_a();
|
||||
}
|
||||
|
||||
- :pass: FALSE
|
||||
:should: 'handle the situation where we pass single object with expect and it is wrong'
|
||||
:code: |
|
||||
test()
|
||||
{
|
||||
POINT_T pt = {1, 2};
|
||||
POINT_T ex = {1, 3};
|
||||
bar_ExpectAndReturn(&pt);
|
||||
foo_Expect(&ex);
|
||||
|
||||
function_a();
|
||||
}
|
||||
|
||||
- :pass: TRUE
|
||||
:should: 'handle the situation where we pass single object with expect and use array handler'
|
||||
:code: |
|
||||
test()
|
||||
{
|
||||
POINT_T pt = {1, 2};
|
||||
POINT_T ex = {1, 2};
|
||||
bar_ExpectAndReturn(&pt);
|
||||
foo_ExpectWithArray(&ex, 1);
|
||||
|
||||
function_a();
|
||||
}
|
||||
|
||||
- :pass: FALSE
|
||||
:should: 'handle the situation where we pass single object with expect and use array handler and it is wrong'
|
||||
:code: |
|
||||
test()
|
||||
{
|
||||
POINT_T pt = {1, 2};
|
||||
POINT_T ex = {1, 3};
|
||||
bar_ExpectAndReturn(&pt);
|
||||
foo_ExpectWithArray(&ex, 1);
|
||||
|
||||
function_a();
|
||||
}
|
||||
|
||||
- :pass: TRUE
|
||||
:should: 'handle the situation where we pass multiple objects with expect and use array handler'
|
||||
:code: |
|
||||
test()
|
||||
{
|
||||
POINT_T pt[] = {{1, 2}, {3, 4}, {5, 6}};
|
||||
POINT_T ex[] = {{1, 2}, {3, 4}, {5, 6}};
|
||||
bar_ExpectAndReturn(pt);
|
||||
foo_ExpectWithArray(ex, 3);
|
||||
|
||||
function_a();
|
||||
}
|
||||
|
||||
- :pass: FALSE
|
||||
:should: 'handle the situation where we pass multiple objects with expect and use array handler and it is wrong at end'
|
||||
:code: |
|
||||
test()
|
||||
{
|
||||
POINT_T pt[] = {{1, 2}, {3, 4}, {5, 6}};
|
||||
POINT_T ex[] = {{1, 2}, {3, 4}, {5, 9}};
|
||||
bar_ExpectAndReturn(pt);
|
||||
foo_ExpectWithArray(ex, 3);
|
||||
|
||||
function_a();
|
||||
}
|
||||
|
||||
- :pass: TRUE
|
||||
:should: 'handle the situation where we pass single array element with expect'
|
||||
:code: |
|
||||
test()
|
||||
{
|
||||
POINT_T pt = {1, 2};
|
||||
POINT_T ex = {1, 2};
|
||||
bar_ExpectAndReturn(&pt);
|
||||
fooa_Expect(&ex);
|
||||
|
||||
function_b();
|
||||
}
|
||||
|
||||
- :pass: TRUE
|
||||
:should: 'handle standard c string as null terminated and not do crappy memory compares of a byte, passing'
|
||||
:code: |
|
||||
test()
|
||||
{
|
||||
const char* constretval = "This is a\0 silly string";
|
||||
char* retval = (char*)constretval;
|
||||
bars_ExpectAndReturn(retval);
|
||||
foos_Expect("This is a\0 wacky string");
|
||||
|
||||
function_c();
|
||||
}
|
||||
|
||||
- :pass: FALSE
|
||||
:should: 'handle standard c string as null terminated and not do crappy memory compares of a byte, finding failures'
|
||||
:code: |
|
||||
test()
|
||||
{
|
||||
const char* constretval = "This is a silly string";
|
||||
char* retval = (char*)constretval;
|
||||
bars_ExpectAndReturn(retval);
|
||||
foos_Expect("This is a wacky string");
|
||||
|
||||
function_c();
|
||||
}
|
||||
|
||||
- :pass: TRUE
|
||||
:should: 'handle creating array expects when we have mixed arguments for single object'
|
||||
:code: |
|
||||
test()
|
||||
{
|
||||
int expect_list[] = { 1, 9 };
|
||||
no_pointers_Expect(1, "silly");
|
||||
mixed_ExpectAndReturn(6, expect_list, 7, 13);
|
||||
|
||||
TEST_ASSERT_EQUAL(13, function_d());
|
||||
}
|
||||
|
||||
- :pass: FALSE
|
||||
:should: 'handle creating array expects when we have mixed arguments and handle failures for single object'
|
||||
:code: |
|
||||
test()
|
||||
{
|
||||
int expect_list[] = { 9, 1 };
|
||||
no_pointers_Expect(1, "silly");
|
||||
mixed_ExpectAndReturn(6, expect_list, 7, 13);
|
||||
|
||||
TEST_ASSERT_EQUAL(13, function_d());
|
||||
}
|
||||
|
||||
- :pass: TRUE
|
||||
:should: 'handle creating array expects when we have mixed arguments for multiple objects'
|
||||
:code: |
|
||||
test()
|
||||
{
|
||||
int expect_list[] = { 1, 2, 3, 4, 6 };
|
||||
no_pointers_Expect(1, "silly");
|
||||
mixed_ExpectWithArrayAndReturn(6, expect_list, 4, 7, 13);
|
||||
|
||||
TEST_ASSERT_EQUAL(13, function_d());
|
||||
}
|
||||
|
||||
- :pass: FALSE
|
||||
:should: 'handle creating array expects when we have mixed arguments and handle failures for multiple objects'
|
||||
:code: |
|
||||
test()
|
||||
{
|
||||
int expect_list[] = { 1, 2, 3, 4, 6 };
|
||||
no_pointers_Expect(1, "silly");
|
||||
mixed_ExpectWithArrayAndReturn(6, expect_list, 5, 7, 13);
|
||||
|
||||
TEST_ASSERT_EQUAL(13, function_d());
|
||||
}
|
||||
|
||||
- :pass: TRUE
|
||||
:should: 'handle an exception being caught'
|
||||
:code: |
|
||||
test()
|
||||
{
|
||||
const char* constretval = "This is a\0 silly string";
|
||||
char* retval = (char*)constretval;
|
||||
bars_ExpectAndReturn(retval);
|
||||
foos_ExpectAndThrow("This is a\0 wacky string", 55);
|
||||
foos_Expect("err");
|
||||
|
||||
function_c();
|
||||
}
|
||||
|
||||
- :pass: FALSE
|
||||
:should: 'handle an exception being caught but still catch following errors'
|
||||
:code: |
|
||||
test()
|
||||
{
|
||||
const char* constretval = "This is a\0 silly string";
|
||||
char* retval = (char*)constretval;
|
||||
bars_ExpectAndReturn(retval);
|
||||
foos_ExpectAndThrow("This is a\0 wacky string", 55);
|
||||
foos_Expect("wrong error");
|
||||
|
||||
function_c();
|
||||
}
|
||||
|
||||
- :pass: FALSE
|
||||
:should: 'fail strict ordering problems even though we would otherwise have passed'
|
||||
:code: |
|
||||
test()
|
||||
{
|
||||
int expect_list[] = { 1, 2, 3, 4, 6 };
|
||||
mixed_ExpectWithArrayAndReturn(6, expect_list, 4, 7, 13);
|
||||
no_pointers_Expect(1, "silly");
|
||||
|
||||
TEST_ASSERT_EQUAL(13, function_d());
|
||||
}
|
||||
|
||||
- :pass: TRUE
|
||||
:should: 'properly ExpectAnyArgs first function but the other will work properly'
|
||||
:code: |
|
||||
test()
|
||||
{
|
||||
int expect_list[] = { 1, 2, 3, 4, 6 };
|
||||
no_pointers_ExpectAnyArgs();
|
||||
mixed_ExpectWithArrayAndReturn(6, expect_list, 4, 7, 13);
|
||||
|
||||
TEST_ASSERT_EQUAL(13, function_d());
|
||||
}
|
||||
|
||||
- :pass: TRUE
|
||||
:should: 'properly ExpectAnyArgs last function but the other will work properly'
|
||||
:code: |
|
||||
test()
|
||||
{
|
||||
no_pointers_Expect(1, "silly");
|
||||
mixed_ExpectAnyArgsAndReturn(13);
|
||||
|
||||
TEST_ASSERT_EQUAL(13, function_d());
|
||||
}
|
||||
|
||||
- :pass: TRUE
|
||||
:should: 'be ok if we ExpectAnyArgs a call each because we are counting calls'
|
||||
:code: |
|
||||
test()
|
||||
{
|
||||
foos_ExpectAnyArgs();
|
||||
foos_ExpectAnyArgs();
|
||||
foos_ExpectAnyArgs();
|
||||
|
||||
function_e();
|
||||
}
|
||||
|
||||
- :pass: TRUE
|
||||
:should: 'be ok if we ExpectAnyArgs and Expect intermixed because we are counting calls'
|
||||
:code: |
|
||||
test()
|
||||
{
|
||||
foos_Expect("Hello");
|
||||
foos_ExpectAnyArgs();
|
||||
foos_ExpectAnyArgs();
|
||||
|
||||
function_e();
|
||||
}
|
||||
|
||||
- :pass: FALSE
|
||||
:should: 'be able to detect Expect problem if we ExpectAnyArgs and Expect intermixed'
|
||||
:code: |
|
||||
test()
|
||||
{
|
||||
foos_Expect("Hello");
|
||||
foos_ExpectAnyArgs();
|
||||
foos_Expect("Wrong");
|
||||
|
||||
function_e();
|
||||
}
|
||||
|
||||
- :pass: FALSE
|
||||
:should: 'fail if we do not ExpectAnyArgs a call once because we are counting calls'
|
||||
:code: |
|
||||
test()
|
||||
{
|
||||
foos_ExpectAnyArgs();
|
||||
foos_ExpectAnyArgs();
|
||||
|
||||
function_e();
|
||||
}
|
||||
|
||||
...
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
:cmock:
|
||||
:plugins:
|
||||
- 'soda'
|
||||
- 'pizza'
|
||||
:treat_externs: :include
|
||||
:cmock:
|
||||
:plugins:
|
||||
- 'soda'
|
||||
- 'pizza'
|
||||
:treat_externs: :include
|
||||
|
||||
Reference in New Issue
Block a user