|
From: <ak...@us...> - 2008-02-06 16:33:51
|
Revision: 833
http://can.svn.sourceforge.net/can/?rev=833&view=rev
Author: akhe
Date: 2008-02-06 08:33:43 -0800 (Wed, 06 Feb 2008)
Log Message:
-----------
Port of IAR CAN test to GCC
Added Paths:
-----------
trunk/firmware/arm/str/cantest_str73x_gcc/
trunk/firmware/arm/str/cantest_str73x_gcc/73x_lcd.c
trunk/firmware/arm/str/cantest_str73x_gcc/73x_lcd.h
trunk/firmware/arm/str/cantest_str73x_gcc/Makefile
trunk/firmware/arm/str/cantest_str73x_gcc/Readme.txt
trunk/firmware/arm/str/cantest_str73x_gcc/STR73x-RAM.ld
trunk/firmware/arm/str/cantest_str73x_gcc/STR73x-ROM.ld
trunk/firmware/arm/str/cantest_str73x_gcc/main.c
trunk/firmware/arm/str/cantest_str73x_gcc/startup.s
trunk/firmware/arm/str/cantest_str73x_gcc/vector.s
trunk/firmware/arm/str/cantest_str73x_gcc/vectors.c
trunk/firmware/arm/str/cantest_str73x_gcc/vectors.h
Added: trunk/firmware/arm/str/cantest_str73x_gcc/73x_lcd.c
===================================================================
--- trunk/firmware/arm/str/cantest_str73x_gcc/73x_lcd.c (rev 0)
+++ trunk/firmware/arm/str/cantest_str73x_gcc/73x_lcd.c 2008-02-06 16:33:43 UTC (rev 833)
@@ -0,0 +1,474 @@
+/******************** (C) COPYRIGHT 2005 STMicroelectronics **********************
+* File Name : 73x_lcd.c
+* Author : MCD Application Team
+* Date First Issued : 09/27/2005 : V1.0
+* Description : This file provides all the LCD software functions.
+**********************************************************************************
+* History:
+* 09/27/2005 : V1.0
+**********************************************************************************
+* THE PRESENT SOFTWARE WHICH IS FOR GUIDANCE ONLY AIMS AT PROVIDING CUSTOMERS WITH
+* CODING INFORMATION REGARDING THEIR PRODUCTS IN ORDER FOR THEM TO SAVE TIME.
+* AS A RESULT, STMICROELECTRONICS SHALL NOT BE HELD LIABLE FOR ANY DIRECT, INDIRECT
+* OR CONSEQUENTIAL DAMAGES WITH RESPECT TO ANY CLAIMS ARISING FROM THE CONTENT
+* OF SUCH SOFTWARE AND/OR THE USE MADE BY CUSTOMERS OF THE CODING INFORMATION
+* CONTAINED HEREIN IN CONNECTION WITH THEIR PRODUCTS.
+*********************************************************************************/
+/* Standard includes -----------------------------------------------------------*/
+#include "73x_lcd.h"
+#include "73x_lib.h"
+/* Include of other module interface headers -----------------------------------*/
+/* Local includes --------------------------------------------------------------*/
+/* Private typedef -------------------------------------------------------------*/
+/* Private define --------------------------------------------------------------*/
+/* Private macro ---------------------------------------------------------------*/
+/* Private variables -----------------------------------------------------------*/
+vu16 LCDDelay = 0;
+/* Private function prototypes -------------------------------------------------*/
+// Define GPIO Init Structure */
+GPIO_InitTypeDef GPIO_InitStructure0;
+/* Interface functions ---------------------------------------------------------*/
+/* Private functions -----------------------------------------------------------*/
+
+
+/*******************************************************************************
+* Function Name : LCD_Init
+* Description : Initializes the LCD driver.
+* Input : None
+* Output : None
+* Return : None
+*******************************************************************************/
+void LCD_Init(void)
+{
+ /* GPIO6 Clock Enable */
+ CFG_PeripheralClockConfig(CFG_CLK_GPIO6 , ENABLE);
+
+ /* GPIO6 Configuration */
+ GPIO_InitStructure0.GPIO_Mode = GPIO_Mode_OUT_PP;
+ GPIO_InitStructure0.GPIO_Pins = GPIO_PIN_0 | GPIO_PIN_1 |GPIO_PIN_10;
+ GPIO_Init(GPIO6, &GPIO_InitStructure0);
+
+ /* GPIO5 Clock Enable */
+ CFG_PeripheralClockConfig(CFG_CLK_GPIO5 , ENABLE);
+
+ /* GPIO5 Configuration */
+ GPIO_InitStructure0.GPIO_Mode = GPIO_Mode_OUT_PP;
+ GPIO_InitStructure0.GPIO_Pins = GPIO_PIN_12 | GPIO_PIN_13 |GPIO_PIN_14 |GPIO_PIN_15;
+ GPIO_Init(GPIO5, &GPIO_InitStructure0);
+
+ /* GPIO2 Clock Enable */
+ CFG_PeripheralClockConfig(CFG_CLK_GPIO2 , ENABLE);
+
+ /* GPIO2 Configuration */
+ GPIO_InitStructure0.GPIO_Mode = GPIO_Mode_OUT_PP;
+ GPIO_InitStructure0.GPIO_Pins = GPIO_PIN_0;
+ GPIO_Init(GPIO2, &GPIO_InitStructure0);
+ GPIO_BitWrite(GPIO2, GPIO_PIN_0, Bit_SET);
+
+ // Wait 40 ms
+ LCD_Wait(4000);
+ LCD_Send_Command_4bit(0x30);
+
+ // Wait 6 ms
+ LCD_Wait(600);
+ LCD_Send_Command_4bit(0x30);
+
+ // Wait 6 ms
+ LCD_Wait(600);
+ LCD_Send_Command_4bit(0x30);
+
+ // Wait 6 ms
+ LCD_Wait(600);
+ LCD_Send_Command_4bit(0x20);
+
+ // Wait 6 ms
+ LCD_Wait(600);
+ LCD_Send_Command_4bit(0x20);
+
+ // Wait 6 ms
+ LCD_Wait(600);
+ LCD_Send_Command_4bit(0xF0);
+
+ // Wait 6 ms
+ LCD_Wait(600);
+ LCD_Send_Command_4bit(0x00);
+
+ // Wait 6 ms
+ LCD_Wait(600);
+ LCD_Send_Command_4bit(0x80);
+
+ // Wait 6 ms
+ LCD_Wait(600);
+ LCD_Send_Command_4bit(0x00);
+
+ // Wait 6 ms
+ LCD_Wait(600);
+ LCD_Send_Command_4bit(0x10);
+
+ // Wait 6 ms
+ LCD_Wait(600);
+ LCD_Send_Command_4bit(0x00);
+
+ // Wait 6 ms
+ LCD_Wait(600);
+ LCD_Send_Command_4bit(0x60);
+
+ // Wait 6 ms
+ LCD_Wait(600);
+}
+
+/*******************************************************************************
+* Function Name : LCD_E_High
+* Description : Puts the LCD Enable line (E) high.
+* Input : None
+* Output : None
+* Return : None
+*******************************************************************************/
+void LCD_E_High(void)
+{
+ GPIO_BitWrite(GPIO6, LCD_PIN_E, Bit_SET);
+}
+
+/*******************************************************************************
+* Function Name : LCD_E_Low
+* Description : Puts the LCD Enable line (E) low.
+* Input : None
+* Output : None
+* Return : None
+*******************************************************************************/
+void LCD_E_Low(void)
+{
+ GPIO_BitWrite(GPIO6, LCD_PIN_E, Bit_RESET);
+}
+
+/*******************************************************************************
+* Function name : LCD_Send_Command_4bit
+* Description : Sends a command to the LCD.
+* Input param : Cmd: command to be sent.
+* Output param : None
+* Return : None
+*******************************************************************************/
+void LCD_Send_Command_4bit(u8 Cmd)
+{
+ // Reset RW bit
+ GPIO_BitWrite(GPIO6, LCD_PIN_RW, Bit_RESET);
+
+ // Reset RS bit
+ GPIO_BitWrite(GPIO6, LCD_PIN_RS, Bit_RESET);
+
+ // Set E bit
+ GPIO_BitWrite(GPIO6, LCD_PIN_E, Bit_SET);
+
+ // Send the command
+ GPIO_ByteWrite(GPIO5, GPIO_MSB, Cmd & 0xF0);
+
+ // Reset E bit
+ GPIO_BitWrite(GPIO6, LCD_PIN_E, Bit_RESET);
+
+ // Cmd Shift
+ Cmd = Cmd << 4;
+
+ // Set E bit
+ GPIO_BitWrite(GPIO6, LCD_PIN_E, Bit_SET);
+
+ // Send the command
+ GPIO_ByteWrite(GPIO5, GPIO_MSB, Cmd & 0xF0);
+
+ // Reset E bit
+ GPIO_BitWrite(GPIO6, LCD_PIN_E, Bit_RESET);
+
+ // Set RS bit
+ GPIO_BitWrite(GPIO6, LCD_PIN_RS, Bit_SET);
+
+ // Set RW bit
+ GPIO_BitWrite(GPIO6, LCD_PIN_RW, Bit_SET);
+}
+
+/*******************************************************************************
+* Function Name : LCD_SendData_4bit
+* Description : Sends data to the LCD.
+* Input : Data: data to be displayed.
+* Output : None
+* Return : None
+*******************************************************************************/
+void LCD_SendData_4bit(u8 Data)
+{
+
+ // Set RS bit
+ GPIO_BitWrite(GPIO6, LCD_PIN_RS, Bit_SET);
+
+ // Reset RW bit
+ GPIO_BitWrite(GPIO6, LCD_PIN_RW, Bit_RESET);
+
+ // Set E bit
+ GPIO_BitWrite(GPIO6, LCD_PIN_E, Bit_SET);
+
+ // Data on GPIO_MSB
+ GPIO_ByteWrite(GPIO5, GPIO_MSB, Data & 0xF0);
+
+
+ // Reset E bit
+ GPIO_BitWrite(GPIO6, LCD_PIN_E, Bit_RESET);
+
+ // Data Shift
+ Data = Data << 4;
+
+ // Set E bit
+ GPIO_BitWrite(GPIO6, LCD_PIN_E, Bit_SET);
+
+ // Data on GPIO_MSB
+ GPIO_ByteWrite(GPIO5, GPIO_MSB, Data);
+
+
+ // Reset E bit
+ GPIO_BitWrite(GPIO6, LCD_PIN_E, Bit_RESET);
+
+ // Reset RS bit
+ GPIO_BitWrite(GPIO6, LCD_PIN_RS, Bit_RESET);
+
+ // Reset RW bit
+ GPIO_BitWrite(GPIO6, LCD_PIN_RW, Bit_SET);
+}
+
+/*******************************************************************************
+* Function Name : LCD_SendString
+* Description : Displays a string on the LCD.
+* Input : - pBuffer: pointer to the buffer containing the data to be
+* displayed on the LCD.
+* - Line: specifies the line where the string will be displayed.
+* - Column: specifies the start column from where the string will
+* be displayed.
+* Output : None
+* Return : None
+*******************************************************************************/
+void LCD_SendString(u8 *pBuffer, u8 Line, u8 Column)
+{
+ u8 len = 0, count = 0;
+
+ len = strlen(( const char *)pBuffer);
+
+ if((len < (LCD_HALF_LENGTH + 2 - Column)))
+ {
+ LCD_SetPosCur(Line, Column);
+
+ for(count =0; count < len; count++)
+ {
+ LCD_SendData_4bit(pBuffer[count]);
+ }
+ }
+ else
+ {
+ LCD_SetPosCur(Line, Column);
+
+ for(count = 0; count <= (LCD_HALF_LENGTH-Column); count++)
+ {
+ LCD_SendData_4bit(pBuffer[count]);
+ }
+
+ LCD_SetPosCur(2, 1);
+
+ for(count = (LCD_HALF_LENGTH-Column+1); count < len; count++)
+ {
+ LCD_SendData_4bit(pBuffer[count]);
+ }
+ }
+}
+
+/*******************************************************************************
+* Function Name : LCD_SendStringByStep
+* Description : Displays a string on the LCD by step.
+* Input : - pBuffer: pointer to the buffer containing the data to be
+* displayed on the LCD.
+* - Line: specifies the line where the string will be displayed.
+* - Column: specifies the start column from where the string will
+* be displayed.
+* Output : None
+* Return : None
+*******************************************************************************/
+void LCD_SendStringByStep(u8 *pBuffer, u8 Line, u8 Column)
+{
+ u8 len = 0, count = 0;
+
+ len = strlen(( const char *)pBuffer);
+
+ if(len < (LCD_HALF_LENGTH + 2 - Column))
+ {
+ LCD_SetPosCur(Line, Column);
+
+ for(count =0; count < len; count++)
+ {
+ // wait 200 ms
+ LCD_Wait(20000);
+ LCD_SendData_4bit(pBuffer[count]);
+ }
+ }
+ else
+ {
+ LCD_SetPosCur(Line, Column);
+
+ for(count = 0; count <= (LCD_HALF_LENGTH-Column); count++)
+ {
+ // wait 200 ms
+ LCD_Wait(20000);
+ LCD_SendData_4bit(pBuffer[count]);
+ }
+
+ LCD_SetPosCur(2, 1);
+
+ for(count = (LCD_HALF_LENGTH-Column+1); count < len; count++)
+ {
+ // wait 200 ms
+ LCD_Wait(20000);
+ LCD_SendData_4bit(pBuffer[count]);
+ }
+ }
+}
+
+/*******************************************************************************
+* Function Name : LCD_SendStringPinPong
+* Description : Displays a string on the LCD as ping pong.
+* Input : - pBuffer: pointer to the buffer containing the data to be
+* displayed on the LCD.
+* - Line: specifies the line where the string will be displayed.
+* - nTime: number of ping pong.
+* Output :
+* Return : None
+*******************************************************************************/
+void LCD_SendStringPinPong(u8 *pBuffer, u8 Line, u32 nTime)
+{
+ u8 len = 0, index = 1;
+ bool Direction = TRUE;
+
+ len = strlen(( const char *)pBuffer);
+
+ while(nTime--)
+ {
+ if(Direction)
+ {
+ LCD_SendString(pBuffer, Line, index);
+ // wait 200 ms
+ LCD_Wait(20000);
+ index++;
+ LCD_LineClear(Line);
+ if(index == (LCD_HALF_LENGTH - len) + 1)
+ {
+ Direction = FALSE;
+ }
+ }
+ else
+ {
+ LCD_SendString(pBuffer, Line, index);
+ // wait 200 ms
+ LCD_Wait(20000);
+ index--;
+ LCD_LineClear(Line);
+ if(index == 1)
+ {
+ Direction = TRUE;
+ }
+ }
+ }
+}
+
+/*******************************************************************************
+* Function Name : LCD_SetPosCur
+* Description : Sets the line and column position of the LCD cursor.
+* Input : - Line: specifies the cursor's line position.
+* - Column: specifies cursor's column position.
+* Output : None
+* Return : None
+*******************************************************************************/
+void LCD_SetPosCur(u8 Line, u8 Column)
+{
+ if(Line == 1)
+ {
+ Column = Column - 1;
+ }
+ else
+ {
+ Column = Column -1 + 64;
+ }
+
+ LCD_Send_Command_4bit(Column | 0x80);
+}
+
+/*******************************************************************************
+* Function Name : LCD_Clear
+* Description : Clears the LCD display.
+* Input : None
+* Output : None
+* Return : None
+*******************************************************************************/
+void LCD_Clear(void)
+{
+ /* reset RS bit */
+ GPIO_BitWrite(GPIO6, LCD_PIN_RS, Bit_RESET);
+
+ /* send "DISPLAY CLEAR COMMAND" command */
+ LCD_Send_Command_4bit(LCD_CMD_CLR_DISP);
+
+}
+
+/*******************************************************************************
+* Function Name : LCD_LineClear
+* Description : Clears the LCD specified line.
+* Input : Line: line to be cleared.
+* Output : None
+* Return : None
+*******************************************************************************/
+void LCD_LineClear(u8 Line)
+{
+ u8 j = 0;
+
+ /* reset RS bit */
+ GPIO_BitWrite(GPIO6, LCD_PIN_RS, Bit_RESET);
+
+ LCD_SetPosCur(Line, 1);
+
+ /* set RS bit */
+ GPIO_BitWrite(GPIO6, LCD_PIN_RS, Bit_SET);
+
+ /* write LCD_HALF_LENGTH spaces to clear the line */
+ for(j = LCD_HALF_LENGTH; j != 0; j--)
+ {
+ LCD_SendData_4bit(' ');
+ }
+}
+
+/*******************************************************************************
+* Function Name : LCD_DigitDisplay
+* Description : Displays a digit on the LCD.
+* Input : - Digit: digit to be displayed.
+* - Line: specifies the line where the digit will be displayed.
+* - Column: specifies the start column from where the digit will
+* be displayed.
+* Output : None
+* Return : None
+*******************************************************************************/
+void LCD_DigitDisplay(u8 Digit, u8 Line, u8 Column)
+{
+ LCD_SetPosCur(Line, Column);
+
+ LCD_SendData_4bit(Digit + 48);
+}
+
+/*******************************************************************************
+* Function Name : LCD_Wait
+* Description : Inserts a delay.
+* Input : nTime: specifies the time-out value.
+* Output : LCDDelay: incremented each 125 \xB5s in TB1 interrupt handler
+* routine and used to define the time-out value.
+* Return : None
+*******************************************************************************/
+void LCD_Wait(u32 nTime)
+{
+ LCDDelay = 0;
+
+ while(LCDDelay < nTime)
+ {
+ LCDDelay++;
+ }
+}
+
+
+/******************* (C) COPYRIGHT 2005 STMicroelectronics *****END OF FILE****/
Added: trunk/firmware/arm/str/cantest_str73x_gcc/73x_lcd.h
===================================================================
--- trunk/firmware/arm/str/cantest_str73x_gcc/73x_lcd.h (rev 0)
+++ trunk/firmware/arm/str/cantest_str73x_gcc/73x_lcd.h 2008-02-06 16:33:43 UTC (rev 833)
@@ -0,0 +1,93 @@
+/******************** (C) COPYRIGHT 2005 STMicroelectronics ********************
+* File Name : 73x_lcd.h
+* Author : MCD Application Team
+* Date First Issued : 09/27/2005 : V1.0
+* Description : This file contains all the functions prototypes for the
+* LCD software library.
+**********************************************************************************
+* History:
+* 09/27/2005 : V1.0
+**********************************************************************************
+* THE PRESENT SOFTWARE WHICH IS FOR GUIDANCE ONLY AIMS AT PROVIDING CUSTOMERS WITH
+* CODING INFORMATION REGARDING THEIR PRODUCTS IN ORDER FOR THEM TO SAVE TIME.
+* AS A RESULT, STMICROELECTRONICS SHALL NOT BE HELD LIABLE FOR ANY DIRECT, INDIRECT
+* OR CONSEQUENTIAL DAMAGES WITH RESPECT TO ANY CLAIMS ARISING FROM THE CONTENT
+* OF SUCH SOFTWARE AND/OR THE USE MADE BY CUSTOMERS OF THE CODING INFORMATION
+* CONTAINED HEREIN IN CONNECTION WITH THEIR PRODUCTS.
+*********************************************************************************/
+
+/* Define to prevent recursive inclusion ---------------------------------------*/
+#ifndef __73x_LCD_H
+#define __73x_LCD_H
+
+/* Includes ----------------------------------------------------------------- */
+#include "73x_lib.h"
+#include "string.h"
+
+/* Exported types ----------------------------------------------------------- */
+
+#define LCD_LENGTH 32
+#define LCD_HALF_LENGTH (LCD_LENGTH/2)
+
+#define LCD_PORT_COMMAND GPIO6
+#define LCD_PORT_DATA GPIO6
+
+#define LCD_PIN_E GPIO_PIN_0
+#define LCD_PIN_RS GPIO_PIN_1
+#define LCD_PIN_RW GPIO_PIN_10
+
+#define LCD_CMD_4BIT 0x20
+
+#define LCD_CMD_CLR_DISP 0x01
+#define LCD_CMD_CRS_HOME 0x02
+#define LCD_CMD_DECREM_NOSHIFT 0x04
+#define LCD_CMD_DECREM_SHIFT 0x05
+#define LCD_CMD_INCREM_NOSHIFT 0x06
+#define LCD_CMD_INCREM_SHIFT 0x07
+
+#define LCD_CMD_DISPOFF_CURSOFF_BLKOFF 0x08
+#define LCD_CMD_DISPOFF_CURSOFF_BLKON 0x09
+#define LCD_CMD_DISPOFF_CURSON_BLKOFF 0x0A
+#define LCD_CMD_DISPOFF_CURSON_BLKON 0x0B
+#define LCD_CMD_DISPON_CURSOFF_BLKOFF 0x0C
+#define LCD_CMD_DISPON_CURSOFF_BLKON 0x0D
+#define LCD_CMD_DISPON_CURSON_BLKOFF 0x0E
+#define LCD_CMD_DISPON_CURSON_BLKON 0x0F
+
+#define LCD_CMD_CURSMOVE_SHIFTL 0x10
+#define LCD_CMD_CURSMOVE_SHIFTR 0x14
+#define LCD_CMD_DISPSHIFT_SHIFTL 0x18
+#define LCD_CMD_DISPSHIFT_SHIFTR 0x1C
+
+#define LCD_CMD_4BIT_1LINE_8DOT 0x20
+#define LCD_CMD_4BIT_1LINE_10DOT 0x24
+#define LCD_CMD_4BIT_2LINE_8DOT 0x28
+#define LCD_CMD_4BIT_2LINE_10DOT 0x2C
+
+
+/* Module private variables ----------------------------------------------------*/
+
+/* Exported macro --------------------------------------------------------------*/
+
+/* Private functions -----------------------------------------------------------*/
+
+/* Exported functions ----------------------------------------------------------*/
+void LCD_Init(void);
+void LCD_E_High(void);
+void LCD_E_Low(void);
+void LCD_Send_Command_4bit(u8 Cmd);
+void LCD_SendData_4bits(u8 Data);
+void LCD_SendString(u8 *pBuffer, u8 Line, u8 Column);
+void LCD_SendStringByStep(u8 *pBuffer, u8 Line, u8 Column);
+void LCD_SendStringPinPong(u8 *pBuffer, u8 Line, u32 nTime);
+void LCD_SetPosCur(u8 Line, u8 Column);
+void LCD_Clear(void);
+void LCD_LineClear(u8 Line);
+void LCD_DigitDisplay(u8 Digit, u8 Line, u8 Column);
+void LCD_Wait(u32 nTime);
+
+#endif /*__73x_LCD_H */
+
+/******************* (C) COPYRIGHT 2005 STMicroelectronics *****END OF FILE******/
+
+
Added: trunk/firmware/arm/str/cantest_str73x_gcc/Makefile
===================================================================
--- trunk/firmware/arm/str/cantest_str73x_gcc/Makefile (rev 0)
+++ trunk/firmware/arm/str/cantest_str73x_gcc/Makefile 2008-02-06 16:33:43 UTC (rev 833)
@@ -0,0 +1,497 @@
+# Hey Emacs, this is a -*- makefile -*-
+#
+# WinARM template makefile
+# by Giacomo Fazio and Antonio Nasca, Catania, Italy
+# <gia...@gm...>
+# <ant...@ho...>
+#
+# based on the WinARM template makefile written by Martin Thomas
+# Released to the Public Domain
+# Please read the make user manual!
+#
+#
+# On command line:
+#
+# make all = Make software.
+#
+# make clean = Clean out built project files.
+#
+# make program = Download the hex file to the device
+#
+# (TODO: make filename.s = Just compile filename.c into the assembler code only)
+#
+# To rebuild project do "make clean" then "make all".
+# Toolchain prefix (i.e arm-elf -> arm-elf-gcc.exe)
+TCHAIN = arm-elf
+#TCHAIN = arm-none-eabi
+
+#USE_THUMB_MODE = YES
+USE_THUMB_MODE = NO
+
+# MCU name and submodel
+MCU = arm7tdmi
+SUBMDL = STR73x
+
+## Create ROM-Image
+RUN_MODE=ROM_RUN
+## Create RAM-Image
+#RUN_MODE=RAM_RUN
+
+## not supported in this example:
+## Exception-Vector placement only supported for "ROM_RUN"
+## (placement settings ignored when using "RAM_RUN")
+## - Exception vectors in ROM:
+#VECTOR_LOCATION=VECTORS_IN_ROM
+## - Exception vectors in RAM:
+#VECTOR_LOCATION=VECTORS_IN_RAM
+
+
+# Target file name (without extension).
+TARGET = main
+
+# List C source files here. (C dependencies are automatically generated.)
+# use file-extension c for "c-only"-files
+SRC = $(TARGET).c ../common/73x_lcd.c ../common/sysTime.c ../common/delay.c
+
+# List C source files here which must be compiled in ARM-Mode.
+# use file-extension c for "c-only"-files
+SRCARM = vectors.c
+# thumb is possible too for vectors.c - keep ARM, TODO: profile
+
+# List C++ source files here.
+# use file-extension cpp for C++-files (use extension .cpp)
+CPPSRC =
+
+# List C++ source files here which must be compiled in ARM-Mode.
+# use file-extension cpp for C++-files (use extension .cpp)
+#CPPSRCARM = $(TARGET).cpp
+CPPSRCARM =
+
+# List Assembler source files here.
+# Make them always end in a capital .S. Files ending in a lowercase .s
+# will not be considered source files but generated files (assembler
+# output from the compiler), and will be deleted upon "make clean"!
+# Even though the DOS/Win* filesystem matches both .s and .S the same,
+# it will preserve the spelling of the filenames, and gcc itself does
+# care about how the name is spelled on its command-line.
+ASRC =
+
+# List Assembler source files here which must be assembled in ARM-Mode..
+ASRCARM = vector.S startup.S
+
+# Path to Linker-Scripts
+LINKERSCRIPTPATH = .
+
+## Output format. (can be ihex or binary or both)
+## (binary i.e. for openocd and SAM-BA, hex i.e. for lpc21isp and uVision)
+#FORMAT = ihex
+#FORMAT = binary
+FORMAT = both
+
+# Optimization level, can be [0, 1, 2, 3, s].
+# 0 = turn off optimization. s = optimize for size.
+# (Note: 3 is not always the best optimization level. See avr-libc FAQ.)
+#OPT = s
+OPT = 0
+
+## Using the Atmel AT91_lib produces warning with
+## the default warning-levels.
+## yes - disable these warnings; no - keep default settings
+#AT91LIBNOWARN = yes
+AT91LIBNOWARN = no
+
+# Debugging format.
+# Native formats for AVR-GCC's -g are stabs [default], or dwarf-2.
+# AVR (extended) COFF requires stabs, plus an avr-objcopy run.
+#DEBUG = stabs
+DEBUG = dwarf-2
+
+# List any extra directories to look for include files here.
+# Each directory must be seperated by a space.
+EXTRAINCDIRS = "K:/include" ../common/str73x_lib/include
+
+# List any extra directories to look for library files here.
+# Each directory must be seperated by a space.
+#EXTRA_LIBDIRS = ../arm7_efsl_0_2_4
+EXTRA_LIBDIRS = K:/lib ../common/str73x_lib
+
+
+# Compiler flag to set the C Standard level.
+# c89 - "ANSI" C
+# gnu89 - c89 plus GCC extensions
+# c99 - ISO C99 standard (not yet fully implemented)
+# gnu99 - c99 plus GCC extensions
+CSTANDARD = -std=gnu99
+
+# Place -D or -U options for C here
+CDEFS = -D$(RUN_MODE)
+
+# Place -I options here
+CINCS =
+
+# Place -D or -U options for ASM here
+ADEFS = -D$(RUN_MODE)
+
+ifdef VECTOR_LOCATION
+CDEFS += -D$(VECTOR_LOCATION)
+ADEFS += -D$(VECTOR_LOCATION)
+endif
+
+CDEFS += -D__WinARM__ -D__WINARMSUBMDL_$(SUBMDL)__
+ADEFS += -D__WinARM__ -D__WINARMSUBMDL_$(SUBMDL)__
+
+# Compiler flags.
+
+ifeq ($(USE_THUMB_MODE),YES)
+THUMB = -mthumb
+THUMB_IW = -mthumb-interwork
+else
+THUMB =
+THUMB_IW =
+endif
+
+# -g*: generate debugging information
+# -O*: optimization level
+# -f...: tuning, see GCC manual and avr-libc documentation
+# -Wall...: warning level
+# -Wa,...: tell GCC to pass this to the assembler.
+# -adhlns...: create assembler listing
+#
+# Flags for C and C++ (arm-elf-gcc/arm-elf-g++)
+CFLAGS = -g$(DEBUG)
+CFLAGS += $(CDEFS) $(CINCS)
+CFLAGS += -O$(OPT)
+CFLAGS += -Wall -Wcast-align -Wimplicit
+CFLAGS += -Wpointer-arith -Wswitch
+CFLAGS += -ffunction-sections -fdata-sections
+CFLAGS += -Wredundant-decls -Wreturn-type -Wshadow -Wunused
+CFLAGS += -Wa,-adhlns=$(subst $(suffix $<),.lst,$<)
+CFLAGS += $(patsubst %,-I%,$(EXTRAINCDIRS))
+
+# flags only for C
+CONLYFLAGS += -Wnested-externs
+CONLYFLAGS += $(CSTANDARD)
+
+ifneq ($(AT91LIBNOWARN),yes)
+#AT91-lib warnings with:
+CFLAGS += -Wcast-qual
+CONLYFLAGS += -Wmissing-prototypes
+CONLYFLAGS += -Wstrict-prototypes
+CONLYFLAGS += -Wmissing-declarations
+endif
+
+# flags only for C++ (arm-elf-g++)
+# CPPFLAGS = -fno-rtti -fno-exceptions
+CPPFLAGS =
+
+# Assembler flags.
+# -Wa,...: tell GCC to pass this to the assembler.
+# -ahlns: create listing
+# -g$(DEBUG): have the assembler create line number information
+ASFLAGS = $(ADEFS) -Wa,-adhlns=$(<:.S=.lst),-g$(DEBUG)
+
+
+#Additional libraries.
+
+# Extra libraries
+# Each library-name must be seperated by a space.
+# To add libxyz.a, libabc.a and libefsl.a:
+# EXTRA_LIBS = xyz abc efsl
+#EXTRA_LIBS = efsl
+EXTRA_LIBS = STR73x_lib
+
+#Support for newlibc-lpc (file: libnewlibc-lpc.a)
+#NEWLIBLPC = -lnewlib-lpc
+
+MATH_LIB = -lm
+
+# CPLUSPLUS_LIB = -lstdc++
+
+
+# Linker flags.
+# -Wl,...: tell GCC to pass this to linker.
+# -Map: create map file
+# --cref: add cross reference to map file
+LDFLAGS = -nostartfiles -Wl,-Map=$(TARGET).map,--cref,--gc-sections
+LDFLAGS += -lc
+LDFLAGS += $(NEWLIBLPC) $(MATH_LIB)
+LDFLAGS += -lc -lgcc
+LDFLAGS += $(CPLUSPLUS_LIB)
+LDFLAGS += $(patsubst %,-L%,$(EXTRA_LIBDIRS))
+LDFLAGS += $(patsubst %,-l%,$(EXTRA_LIBS))
+
+# Set Linker-Script Depending On Selected Memory and Controller
+ifeq ($(RUN_MODE),RAM_RUN)
+LDFLAGS +=-T$(LINKERSCRIPTPATH)/$(SUBMDL)-RAM.ld
+else
+LDFLAGS +=-T$(LINKERSCRIPTPATH)/$(SUBMDL)-ROM.ld
+endif
+
+
+# Define directories, if needed.
+## DIRARM = c:/WinARM/
+## DIRARMBIN = $(DIRAVR)/bin/
+## DIRAVRUTILS = $(DIRAVR)/utils/bin/
+
+# Define programs and commands.
+SHELL = sh
+CC = $(TCHAIN)-gcc
+CPP = $(TCHAIN)-g++
+AR = $(TCHAIN)-ar
+OBJCOPY = $(TCHAIN)-objcopy
+OBJDUMP = $(TCHAIN)-objdump
+SIZE = $(TCHAIN)-size
+NM = $(TCHAIN)-nm
+REMOVE = rm -f
+REMOVEDIR = rm -f -r
+COPY = cp
+
+# Define Messages
+# English
+MSG_ERRORS_NONE = Errors: none
+MSG_BEGIN = "-------- begin (mode: $(RUN_MODE)) --------"
+MSG_END = -------- end --------
+MSG_SIZE_BEFORE = Size before:
+MSG_SIZE_AFTER = Size after:
+MSG_FLASH = Creating load file for Flash:
+MSG_EXTENDED_LISTING = Creating Extended Listing:
+MSG_SYMBOL_TABLE = Creating Symbol Table:
+MSG_LINKING = Linking:
+MSG_COMPILING = Compiling C:
+MSG_COMPILING_ARM = "Compiling C (ARM-only):"
+MSG_COMPILINGCPP = Compiling C++:
+MSG_COMPILINGCPP_ARM = "Compiling C++ (ARM-only):"
+MSG_ASSEMBLING = Assembling:
+MSG_ASSEMBLING_ARM = "Assembling (ARM-only):"
+MSG_CLEANING = Cleaning project:
+MSG_FORMATERROR = Can not handle output-format
+MSG_LPC21_RESETREMINDER = You may have to bring the target in bootloader-mode now.
+
+# Define all object files.
+COBJ = $(SRC:.c=.o)
+AOBJ = $(ASRC:.S=.o)
+COBJARM = $(SRCARM:.c=.o)
+AOBJARM = $(ASRCARM:.S=.o)
+CPPOBJ = $(CPPSRC:.cpp=.o)
+CPPOBJARM = $(CPPSRCARM:.cpp=.o)
+
+# Define all listing files.
+LST = $(ASRC:.S=.lst) $(ASRCARM:.S=.lst) $(SRC:.c=.lst) $(SRCARM:.c=.lst)
+LST += $(CPPSRC:.cpp=.lst) $(CPPSRCARM:.cpp=.lst)
+
+# Compiler flags to generate dependency files.
+### GENDEPFLAGS = -Wp,-M,-MP,-MT,$(*F).o,-MF,.dep/$(@F).d
+GENDEPFLAGS = -MD -MP -MF .dep/$(@F).d
+
+# Combine all necessary flags and optional flags.
+# Add target processor to flags.
+ALL_CFLAGS = -mcpu=$(MCU) $(THUMB_IW) -I. $(CFLAGS) $(GENDEPFLAGS)
+ALL_ASFLAGS = -mcpu=$(MCU) $(THUMB_IW) -I. -x assembler-with-cpp $(ASFLAGS)
+
+
+# Default target.
+all: begin gccversion sizebefore build sizeafter finished end
+
+ifeq ($(FORMAT),ihex)
+build: elf hex lss sym
+hex: $(TARGET).hex
+IMGEXT=hex
+else
+ifeq ($(FORMAT),binary)
+build: elf bin lss sym
+bin: $(TARGET).bin
+IMGEXT=bin
+else
+ifeq ($(FORMAT),both)
+build: elf hex bin lss sym
+hex: $(TARGET).hex
+bin: $(TARGET).bin
+else
+$(error "$(MSG_FORMATERROR) $(FORMAT)")
+endif
+endif
+endif
+
+elf: $(TARGET).elf
+lss: $(TARGET).lss
+sym: $(TARGET).sym
+
+# Eye candy.
+begin:
+ @echo
+ @echo $(MSG_BEGIN)
+
+finished:
+ @echo $(MSG_ERRORS_NONE)
+
+end:
+ @echo $(MSG_END)
+ @echo
+
+
+# Display size of file.
+HEXSIZE = $(SIZE) --target=$(FORMAT) $(TARGET).hex
+ELFSIZE = $(SIZE) -A $(TARGET).elf
+sizebefore:
+ @if [ -f $(TARGET).elf ]; then echo; echo $(MSG_SIZE_BEFORE); $(ELFSIZE); echo; fi
+
+sizeafter:
+ @if [ -f $(TARGET).elf ]; then echo; echo $(MSG_SIZE_AFTER); $(ELFSIZE); echo; fi
+
+
+# Display compiler version information.
+gccversion :
+ @$(CC) --version
+
+# FLASH Programming with OPENOCD
+
+# specify the directory where openocd executable resides (openocd-ftd2xx.exe or openocd-pp.exe)
+# Note: you may have to adjust this if a newer version of YAGARTO has been downloaded
+OPENOCD_DIR = 'C:\Program Files\openocd-r247\bin\'
+
+# specify OpenOCD executable (pp is for the wiggler, ftd2xx is for the USB debugger)
+#OPENOCD = $(OPENOCD_DIR)openocd-pp.exe
+OPENOCD = $(OPENOCD_DIR)openocd-ftd2xx.exe
+
+# specify OpenOCD configuration file (pick the one for your device)
+#OPENOCD_CFG = C:\openocd-configs\str73x-configs\str73x_signalyzer-flash-program.cfg
+#OPENOCD_CFG = C:\openocd-configs\str73x-configs\str73x_jtagkey-flash-program.cfg
+#OPENOCD_CFG = C:\openocd-configs\str73x-configs\str73x_armusbocd-flash-program.cfg
+#OPENOCD_CFG = C:\openocd-configs\str73x-configs\str73x_pp-flash-program.cfg
+#OPENOCD_CFG = "D:\development\armdev\str73x open source development\Code\Windows\openocd-configs\str73x-configs\str73x_jtagkey-flash-program.cfg"
+OPENOCD_CFG = "c:\str73x_jtagkey-flash-program.cfg"
+
+program:
+ @echo
+ @echo "Flash Programming with OpenOCD..."
+ $(OPENOCD) -f $(OPENOCD_CFG)
+ @echo
+ @echo
+ @echo "Flash Programming Finished."
+
+
+# Create final output file (.hex) from ELF output file.
+%.hex: %.elf
+ @echo
+ @echo $(MSG_FLASH) $@
+ $(OBJCOPY) -O ihex $< $@
+
+# Create final output file (.bin) from ELF output file.
+%.bin: %.elf
+ @echo
+ @echo $(MSG_FLASH) $@
+ $(OBJCOPY) -O binary $< $@
+
+
+# Create extended listing file from ELF output file.
+# testing: option -C
+%.lss: %.elf
+ @echo
+ @echo $(MSG_EXTENDED_LISTING) $@
+ $(OBJDUMP) -h -S -C $< > $@
+
+
+# Create a symbol table from ELF output file.
+%.sym: %.elf
+ @echo
+ @echo $(MSG_SYMBOL_TABLE) $@
+ $(NM) -n $< > $@
+
+
+# Link: create ELF output file from object files.
+.SECONDARY : $(TARGET).elf
+.PRECIOUS : $(AOBJARM) $(AOBJ) $(COBJARM) $(COBJ) $(CPPOBJ) $(CPPOBJARM)
+%.elf: $(AOBJARM) $(AOBJ) $(COBJARM) $(COBJ) $(CPPOBJ) $(CPPOBJARM)
+ @echo
+ @echo $(MSG_LINKING) $@
+ $(CC) $(THUMB) $(ALL_CFLAGS) $(AOBJARM) $(AOBJ) $(COBJARM) $(COBJ) $(CPPOBJ) $(CPPOBJARM) --output $@ $(LDFLAGS)
+# $(CPP) $(THUMB) $(ALL_CFLAGS) $(AOBJARM) $(AOBJ) $(COBJARM) $(COBJ) $(CPPOBJ) $(CPPOBJARM) --output $@ $(LDFLAGS)
+
+# Compile: create object files from C source files. ARM/Thumb
+$(COBJ) : %.o : %.c
+ @echo
+ @echo $(MSG_COMPILING) $<
+ $(CC) -c $(THUMB) $(ALL_CFLAGS) $(CONLYFLAGS) $< -o $@
+
+# Compile: create object files from C source files. ARM-only
+$(COBJARM) : %.o : %.c
+ @echo
+ @echo $(MSG_COMPILING_ARM) $<
+ $(CC) -c $(ALL_CFLAGS) $(CONLYFLAGS) $< -o $@
+
+# Compile: create object files from C++ source files. ARM/Thumb
+$(CPPOBJ) : %.o : %.cpp
+ @echo
+ @echo $(MSG_COMPILINGCPP) $<
+ $(CPP) -c $(THUMB) $(ALL_CFLAGS) $(CPPFLAGS) $< -o $@
+
+# Compile: create object files from C++ source files. ARM-only
+$(CPPOBJARM) : %.o : %.cpp
+ @echo
+ @echo $(MSG_COMPILINGCPP_ARM) $<
+ $(CPP) -c $(ALL_CFLAGS) $(CPPFLAGS) $< -o $@
+
+
+# Compile: create assembler files from C source files. ARM/Thumb
+## does not work - TODO - hints welcome
+##$(COBJ) : %.s : %.c
+## $(CC) $(THUMB) -S $(ALL_CFLAGS) $< -o $@
+
+
+# Assemble: create object files from assembler source files. ARM/Thumb
+$(AOBJ) : %.o : %.S
+ @echo
+ @echo $(MSG_ASSEMBLING) $<
+ $(CC) -c $(THUMB) $(ALL_ASFLAGS) $< -o $@
+
+
+# Assemble: create object files from assembler source files. ARM-only
+$(AOBJARM) : %.o : %.S
+ @echo
+ @echo $(MSG_ASSEMBLING_ARM) $<
+ $(CC) -c $(ALL_ASFLAGS) $< -o $@
+
+
+# Target: clean project.
+clean: begin clean_list finished end
+
+
+clean_list :
+ @echo
+ @echo $(MSG_CLEANING)
+ $(REMOVE) $(TARGET).hex
+ $(REMOVE) $(TARGET).bin
+ $(REMOVE) $(TARGET).obj
+ $(REMOVE) $(TARGET).elf
+ $(REMOVE) $(TARGET).map
+ $(REMOVE) $(TARGET).obj
+ $(REMOVE) $(TARGET).a90
+ $(REMOVE) $(TARGET).sym
+ $(REMOVE) $(TARGET).lnk
+ $(REMOVE) $(TARGET).lss
+ $(REMOVE) $(COBJ)
+ $(REMOVE) $(CPPOBJ)
+ $(REMOVE) $(AOBJ)
+ $(REMOVE) $(COBJARM)
+ $(REMOVE) $(CPPOBJARM)
+ $(REMOVE) $(AOBJARM)
+ $(REMOVE) $(LST)
+ $(REMOVE) $(SRC:.c=.s)
+ $(REMOVE) $(SRC:.c=.d)
+ $(REMOVE) $(SRCARM:.c=.s)
+ $(REMOVE) $(SRCARM:.c=.d)
+ $(REMOVE) $(CPPSRC:.cpp=.s)
+ $(REMOVE) $(CPPSRC:.cpp=.d)
+ $(REMOVE) $(CPPSRCARM:.cpp=.s)
+ $(REMOVE) $(CPPSRCARM:.cpp=.d)
+ $(REMOVEDIR) .dep | exit 0
+
+
+# Include the dependency files.
+-include $(shell mkdir .dep 2>/dev/null) $(wildcard .dep/*)
+
+
+# Listing of phony targets.
+.PHONY : all begin finish end sizebefore sizeafter gccversion \
+build elf hex bin lss sym clean clean_list program
+
Added: trunk/firmware/arm/str/cantest_str73x_gcc/Readme.txt
===================================================================
--- trunk/firmware/arm/str/cantest_str73x_gcc/Readme.txt (rev 0)
+++ trunk/firmware/arm/str/cantest_str73x_gcc/Readme.txt 2008-02-06 16:33:43 UTC (rev 833)
@@ -0,0 +1,80 @@
+/******************** (C) COPYRIGHT 2005 STMicroelectronics **********************
+* File Name : Readme.txt
+* Author : MCD Application Team
+* Date First Issued : 09/27/2005 : V1.0
+* Description : Description of the LCD example
+**********************************************************************************
+* History:
+* 09/27/2005 : V1.0
+*********************************************************************************
+ THE PRESENT SOFTWARE WHICH IS FOR GUIDANCE ONLY AIMS AT PROVIDING CUSTOMERS WITH
+ CODING INFORMATION REGARDING THEIR PRODUCTS IN ORDER FOR THEM TO SAVE TIME.
+ AS A RESULT, STMICROELECTRONICS SHALL NOT BE HELD LIABLE FOR ANY DIRECT, INDIRECT
+ OR CONSEQUENTIAL DAMAGES WITH RESPECT TO ANY CLAIMS ARISING FROM THE CONTENT
+ OF SUCH SOFTWARE AND/OR THE USE MADE BY CUSTOMERS OF THE CODING INFORMATION
+ CONTAINED HEREIN IN CONNECTION WITH THEIR PRODUCTS.
+**********************************************************************************
+
+Example description
+===================
+This example allows displaying "STR730 IAR BOARD" message and the ADC End Of
+Conversion interrupt result on the LCD display.
+
+It is made of 6 steps :
+1) Analog input configuration (in the GPIOx_InitStructure )
+ + Configure the used analog input to High impedance Analog input (Channel0)
+
+
+2) EIC configuration
+ - ADC channel priority configuration
+ - Enable ADC channel interrupt
+ - Enable the EIC
+
+3) Clock configuration
+ + Select the desired ADC clock input: MCLK = 4Mhz
+
+
+4) ADC configuration (in the ADC_InitStructure )
+ - Initialize the converter
+ - Configure the prescaler register: Sampling prescaler = 0x2 and Conversion prescaler = 0x4
+ - Configure the conversion mode: Scan mode conversion
+ - Select the channel to be converted: only channel0
+ + First channel = ADC_CHANNEL0
+ + Channel number = 1
+
+ - Enable EOC interrupt (using the ADC_ITConfig function )
+ - Enable the ADC peripheral (using the ADC_Cmd function )
+
+5) LCD configuration
+ - Initialize the LCD
+ - Clear Line 1 & 2
+ - Set cursor position:Line 1, column 1
+ - Display "STR730 IAR BOARD" message on LCD: Line 1
+ - Set cursor position:Line 2, column 1
+ - Display "ADC:" message on LCD: Line 2
+
+
+6) Get the conversion results and display it in the ADC_IRQHandler
+ - Start the conversion (using the ADC_ConversionCmd function )
+ - Read the conversion result (using the ADC_GetConversionValue function )
+ - Display the conversion result on LCD display.
+ - Clear EOC flag
+
+
+Directory contents
+==================
+73x_conf.h Library Configuration file
+73x_it.c Interrupt handlers
+73x_lcd.h Functions prototypes for the LCD software library
+73x_lcd.c LCD software functions
+main.c Main program
+
+
+How to use it
+=============
+In order to make the program work, you must do the following :
+
+- Run the example
+
+
+******************* (C) COPYRIGHT 2005 STMicroelectronics *****END OF FILE****
Added: trunk/firmware/arm/str/cantest_str73x_gcc/STR73x-RAM.ld
===================================================================
--- trunk/firmware/arm/str/cantest_str73x_gcc/STR73x-RAM.ld (rev 0)
+++ trunk/firmware/arm/str/cantest_str73x_gcc/STR73x-RAM.ld 2008-02-06 16:33:43 UTC (rev 833)
@@ -0,0 +1,228 @@
+/***********************************************************************************
+* Copyright 2005 Anglia Design
+* This demo code and associated components are provided as is and has no warranty,
+* implied or otherwise. You are free to use/modify any of the provided
+* code at your own risk in your applications with the expressed limitation
+* of liability (see below)
+*
+* LIMITATION OF LIABILITY: ANGLIA OR ANGLIA DESIGNS SHALL NOT BE LIABLE FOR ANY
+* LOSS OF PROFITS, LOSS OF USE, LOSS OF DATA, INTERRUPTION OF BUSINESS, NOR FOR
+* INDIRECT, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES OF ANY KIND WHETHER UNDER
+* THIS AGREEMENT OR OTHERWISE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGES.
+*
+* Author : Spencer Oliver
+* Web : www.anglia-designs.com
+*
+***********************************************************************************/
+
+/* Stack Sizes */
+
+ _STACKSIZE = 1024;
+ _STACKSIZE_IRQ = 256;
+ _STACKSIZE_FIQ = 256;
+ _STACKSIZE_SVC = 0;
+ _STACKSIZE_ABT = 0;
+ _STACKSIZE_UND = 0;
+ _HEAPSIZE = 1024;
+
+/* Memory Definitions */
+
+MEMORY
+{
+ DATA (rw) : ORIGIN = 0xA0000000, LENGTH = 0x00004000
+}
+
+/* Section Definitions */
+
+SECTIONS
+{
+ /* first section is .text which is used for code */
+
+ .text :
+ {
+ KEEP(*(.vectrom))
+ KEEP(*(.init))
+ *(.text .text.*)
+ *(.gnu.linkonce.t.*)
+ *(.glue_7t .glue_7)
+ KEEP(*(.fini))
+ *(.gcc_except_table)
+ } >DATA =0
+ . = ALIGN(4);
+
+ /* .ctors .dtors are used for c++ constructors/destructors */
+
+ .ctors :
+ {
+ PROVIDE(__ctors_start__ = .);
+ KEEP(*(SORT(.ctors.*)))
+ KEEP(*(.ctors))
+ PROVIDE(__ctors_end__ = .);
+ } >DATA
+
+ .dtors :
+ {
+ PROVIDE(__dtors_start__ = .);
+ KEEP(*(SORT(.dtors.*)))
+ KEEP(*(.dtors))
+ PROVIDE(__dtors_end__ = .);
+ } >DATA
+
+ /* .rodata section which is used for read-only data (constants) */
+
+ .rodata :
+ {
+ *(.rodata .rodata.*)
+ *(.gnu.linkonce.r.*)
+ } >DATA
+ . = ALIGN(4);
+
+ _vectext = .;
+ PROVIDE (vectext = .);
+
+ .vect : AT (_vectext)
+ {
+ _vecstart = .;
+ KEEP(*(.vectram))
+ _vecend = .;
+ } >DATA
+
+ _etext = _vectext + SIZEOF(.vect);
+ PROVIDE (etext = .);
+
+ /* .data section which is used for initialized data */
+
+ .data : AT (_etext)
+ {
+ *(.data .data.*)
+ *(.gnu.linkonce.d.*)
+ SORT(CONSTRUCTORS)
+ } >DATA
+ . = ALIGN(4);
+
+ __data_start = .;
+ _edata = .;
+ PROVIDE (edata = .);
+
+ /* .bss section which is used for uninitialized data */
+
+ .bss :
+ {
+ __bss_start = .;
+ __bss_start__ = .;
+ *(.bss .bss.*)
+ *(.gnu.linkonce.b.*)
+ *(COMMON)
+ . = ALIGN(4);
+ } >DATA
+ . = ALIGN(4);
+ __bss_end__ = .;
+
+ _end = .;
+ PROVIDE(end = .);
+
+ /* .heap section which is used for memory allocation */
+
+ .heap (NOLOAD) :
+ {
+ __heap_start__ = .;
+ *(.heap)
+ . = MAX(__heap_start__ + _HEAPSIZE , .);
+ } >DATA
+ __heap_end__ = __heap_start__ + SIZEOF(.heap);
+
+ /* .stack section - user mode stack */
+
+ .stack (__heap_end__ + 3) / 4 * 4 (NOLOAD) :
+ {
+ __stack_start__ = .;
+ *(.stack)
+ . = MAX(__stack_start__ + _STACKSIZE , .);
+ } >DATA
+ __stack_end__ = __stack_start__ + SIZEOF(.stack);
+
+ /* .stack_irq section */
+
+ .stack_irq (__stack_end__ + 3) / 4 * 4 (NOLOAD) :
+ {
+ __stack_irq_start__ = .;
+ *(.stack_irq)
+ . = MAX(__stack_irq_start__ + _STACKSIZE_IRQ , .);
+ } >DATA
+ __stack_irq_end__ = __stack_irq_start__ + SIZEOF(.stack_irq);
+
+ /* .stack_fiq section */
+
+ .stack_fiq (__stack_irq_end__ + 3) / 4 * 4 (NOLOAD) :
+ {
+ __stack_fiq_start__ = .;
+ *(.stack_fiq)
+ . = MAX(__stack_fiq_start__ + _STACKSIZE_FIQ , .);
+ } >DATA
+ __stack_fiq_end__ = __stack_fiq_start__ + SIZEOF(.stack_fiq);
+
+ /* .stack_svc section */
+
+ .stack_svc (__stack_fiq_end__ + 3) / 4 * 4 (NOLOAD) :
+ {
+ __stack_svc_start__ = .;
+ *(.stack_svc)
+ . = MAX(__stack_svc_start__ + _STACKSIZE_SVC , .);
+ } >DATA
+ __stack_svc_end__ = __stack_svc_start__ + SIZEOF(.stack_svc);
+
+ /* .stack_abt section */
+
+ .stack_abt (__stack_svc_end__ + 3) / 4 * 4 (NOLOAD) :
+ {
+ __stack_abt_start__ = .;
+ *(.stack_abt)
+ . = MAX(__stack_abt_start__ + _STACKSIZE_ABT , .);
+ } >DATA
+ __stack_abt_end__ = __stack_abt_start__ + SIZEOF(.stack_abt);
+
+ /* .stack_und section */
+
+ .stack_und (__stack_abt_end__ + 3) / 4 * 4 (NOLOAD) :
+ {
+ __stack_und_start__ = .;
+ *(.stack_und)
+ . = MAX(__stack_und_start__ + _STACKSIZE_UND , .);
+ } >DATA
+ __stack_und_end__ = __stack_und_start__ + SIZEOF(.stack_und);
+
+ /* Stabs debugging sections. */
+ .stab 0 : { *(.stab) }
+ .stabstr 0 : { *(.stabstr) }
+ .stab.excl 0 : { *(.stab.excl) }
+ .stab.exclstr 0 : { *(.stab.exclstr) }
+ .stab.index 0 : { *(.stab.index) }
+ .stab.indexstr 0 : { *(.stab.indexstr) }
+ .comment 0 : { *(.comment) }
+ /* DWARF debug sections.
+ Symbols in the DWARF debugging sections are relative to the beginning
+ of the section so we begin them at 0. */
+ /* DWARF 1 */
+ .debug 0 : { *(.debug) }
+ .line 0 : { *(.line) }
+ /* GNU DWARF 1 extensions */
+ .debug_srcinfo 0 : { *(.debug_srcinfo) }
+ .debug_sfnames 0 : { *(.debug_sfnames) }
+ /* DWARF 1.1 and DWARF 2 */
+ .debug_aranges 0 : { *(.debug_aranges) }
+ .debug_pubnames 0 : { *(.debug_pubnames) }
+ /* DWARF 2 */
+ .debug_info 0 : { *(.debug_info .gnu.linkonce.wi.*) }
+ .debug_abbrev 0 : { *(.debug_abbrev) }
+ .debug_line 0 : { *(.debug_line) }
+ .debug_frame 0 : { *(.debug_frame) }
+ .debug_str 0 : { *(.debug_str) }
+ .debug_loc 0 : { *(.debug_loc) }
+ .debug_macinfo 0 : { *(.debug_macinfo) }
+ /* SGI/MIPS DWARF 2 extensions */
+ .debug_weaknames 0 : { *(.debug_weaknames) }
+ .debug_funcnames 0 : { *(.debug_funcnames) }
+ .debug_typenames 0 : { *(.debug_typenames) }
+ .debug_varnames 0 : { *(.debug_varnames) }
+}
+
Added: trunk/firmware/arm/str/cantest_str73x_gcc/STR73x-ROM.ld
===================================================================
--- trunk/firmware/arm/str/cantest_str73x_gcc/STR73x-ROM.ld (rev 0)
+++ trunk/firmware/arm/str/cantest_str73x_gcc/STR73x-ROM.ld 2008-02-06 16:33:43 UTC (rev 833)
@@ -0,0 +1,231 @@
+/***********************************************************************************
+* Copyright 2005 Anglia Design
+* This demo code and associated components are provided as is and has no warranty,
+* implied or otherwise. You are free to use/modify any of the provided
+* code at your own risk in your applications with the expressed limitation
+* of liability (see below)
+*
+* LIMITATION OF LIABILITY: ANGLIA OR ANGLIA DESIGNS SHALL NOT BE LIABLE FOR ANY
+* LOSS OF PROFITS, LOSS OF USE, LOSS OF DATA, INTERRUPTION OF BUSINESS, NOR FOR
+* INDIRECT, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES OF ANY KIND WHETHER UNDER
+* THIS AGREEMENT OR OTHERWISE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGES.
+*
+* Author : Spencer Oliver
+* Web : www.anglia-designs.com
+*
+***********************************************************************************/
+
+/* Stack Sizes */
+
+ _STACKSIZE = 1024;
+ _STACKSIZE_IRQ = 256;
+ _STACKSIZE_FIQ = 256;
+ _STACKSIZE_SVC = 0;
+ _STACKSIZE_ABT = 0;
+ _STACKSIZE_UND = 0;
+ _HEAPSIZE = 1024;
+
+/* Memory Definitions */
+
+MEMORY
+{
+ CODE (rx) : ORIGIN = 0x80000000, LENGTH = 0x00040000
+ DATA (rw) : ORIGIN = 0xA0000000, LENGTH = 0x00004000
+}
+
+/* Section Definitions */
+
+SECTIONS
+{
+ /* first section is .text which is used for code */
+
+ .text :
+ {
+ KEEP(*(.vectrom))
+ KEEP(*(.init))
+ *(.text .text.*)
+ *(.gnu.linkonce.t.*)
+ *(.glue_7t .glue_7)
+ KEEP(*(.fini))
+ *(.gcc_except_table)
+ } >CODE =0
+ . = ALIGN(4);
+
+ /* .ctors .dtors are used for c++ constructors/destructors */
+
+ .ctors :
+ {
+ PROVIDE(__ctors_start__ = .);
+ KEEP(*(SORT(.ctors.*)))
+ KEEP(*(.ctors))
+ PROVIDE(__ctors_end__ = .);
+ } >CODE
+
+ .dtors :
+ {
+ PROVIDE(__dtors_start__ = .);
+ KEEP(*(SORT(.dtors.*)))
+ KEEP(*(.dtors))
+ PROVIDE(__dtors_end__ = .);
+ } >CODE
+
+ /* .rodata section which is used for read-only data (constants) */
+
+ .rodata :
+ {
+ *(.rodata .rodata.*)
+ *(.gnu.linkonce.r.*)
+ } >CODE
+ . = ALIGN(4);
+
+ _vectext = .;
+ PROVIDE (vectext = .);
+
+ .vect : AT (_vectext)
+ {
+ _vecstart = .;
+ KEEP(*(.vectram))
+ _vecend = .;
+ } >DATA
+
+ _etext = _vectext + SIZEOF(.vect);
+ PROVIDE (etext = .);
+
+ /* .data section which is used for initialized data */
+
+ .data : AT (_etext)
+ {
+ __data_start = .;
+ *(.data .data.*)
+ *(.gnu.linkonce.d.*)
+ SORT(CONSTRUCTORS)
+ . = ALIGN(4);
+ *(.fastrun .fastrun.*)
+ } >DATA
+ . = ALIGN(4);
+
+ _edata = .;
+ PROVIDE (edata = .);
+
+ /* .bss section which is used for uninitialized data */
+
+ .bss :
+ {
+ __bss_start = .;
+ __bss_start__ = .;
+ *(.bss .bss.*)
+ *(.gnu.linkonce.b.*)
+ *(COMMON)
+ . = ALIGN(4);
+ } >DATA
+ . = ALIGN(4);
+ __bss_end__ = .;
+
+ _end = .;
+ PROVIDE(end = .);
+
+ /* .heap section which is used for memory allocation */
+
+ .heap (NOLOAD) :
+ {
+ __heap_start__ = .;
+ *(.heap)
+ . = MAX(__heap_start__ + _HEAPSIZE , .);
+ } >DATA
+ __heap_end__ = __heap_start__ + SIZEOF(.heap);
+
+ /* .stack section - user mode stack */
+
+ .stack (__heap_end__ + 3) / 4 * 4 (NOLOAD) :
+ {
+ __stack_start__ = .;
+ *(.stack)
+ . = MAX(__stack_start__ + _STACKSIZE , .);
+ } >DATA
+ __stack_end__ = __stack_start__ + SIZEOF(.stack);
+
+ /* .stack_irq section */
+
+ .stack_irq (__stack_end__ + 3) / 4 * 4 (NOLOAD) :
+ {
+ __stack_irq_start__ = .;
+ *(.stack_irq)
+ . = MAX(__stack_irq_start__ + _STACKSIZE_IRQ , .);
+ } >DATA
+ __stack_irq_end__ = __stack_irq_start__ + SIZEOF(.stack_irq);
+
+ /* .stack_fiq section */
+
+ .stack_fiq (__stack_irq_end__ + 3) / 4 * 4 (NOLOAD) :
+ {
+ __stack_fiq_start__ = .;
+ *(.stack_fiq)
+ . = MAX(__stack_fiq_start__ + _STACKSIZE_FIQ , .);
+ } >DATA
+ __stack_fiq_end__ = __stack_fiq_start__ + SIZEOF(.stack_fiq);
+
+ /* .stack_svc section */
+
+ .stack_svc (__stack_fiq_end__ + 3) / 4 * 4 (NOLOAD) :
+ {
+ __stack_svc_start__ = .;
+ *(.stack_svc)
+ . = MAX(__stack_svc_start__ + _STACKSIZE_SVC , .);
+ } >DATA
+ __stack_svc_end__ = __stack_svc_start__ + SIZEOF(.stack_svc);
+
+ /* .stack_abt section */
+
+ .stack_abt (__stack_svc_end__ + 3) / 4 * 4 (NOLOAD) :
+ {
+ __stack_abt_start__ = .;
+ *(.stack_abt)
+ . = MAX(__stack_abt_start__ + _STACKSIZE_ABT , .);
+ } >DATA
+ __stack_abt_end__ = __stack_abt_start__ + SIZEOF(.stack_abt);
+
+ /* .stack_und section */
+
+ .stack_und (__stack_abt_end__ + 3) / 4 * 4 (NOLOAD) :
+ {
+ __stack_und_start__ = .;
+ *(.stack_und)
+ . = MAX(__stack_und_start__ + _STACKSIZE_UND , .);
+ } >DATA
+ __stack_und_end__ = __stack_und_start__ + SIZEOF(.stack_und);
+
+ /* Stabs debugging sections. */
+ .stab 0 : { *(.stab) }
+ .stabstr 0 : { *(.stabstr) }
+ .stab.excl 0 : { *(.stab.excl) }
+ .stab.exclstr 0 : { *(.stab.exclstr) }
+ .stab.index 0 : { *(.stab.index) }
+ .stab.indexstr 0 : { *(.stab.indexstr) }
+ .comment 0 : { *(.comment) }
+ /* DWARF debug sections.
+ Symbols in the DWARF debugging sections are relative to the beginning
+ of the section so we begin them at 0. */
+ /* DWARF 1 */
+ .debug 0 : { *(.debug) }
+ .line 0 : { *(.line) }
+ /* GNU DWARF 1 extensions */
+ .debug_srcinfo 0 : { *(.debug_srcinfo) }
+ .debug_sfnames 0 : { *(.debug_sfnames) }
+ /* DWARF 1.1 and DWARF 2 */
+ .debug_aranges 0 : { *(.debug_aranges) }
+ .debug_pubnames 0 : { *(.debug_pubnames) }
+ /* DWARF 2 */
+ .debug_info 0 : { *(.debug_info .gnu.linkonce.wi.*) }
+ .debug_abbrev 0 : { *(.debug_abbrev) }
+ .debug_line 0 : { *(.debug_line) }
+ .debug_frame 0 : { *(.debug_frame) }
+ .debug_str 0 : { *(.debug_str) }
+ .debug_loc 0 : { *(.debug_loc) }
+ .debug_macinfo 0 : { *(.debug_macinfo) }
+ /* SGI/MIPS DWARF 2 extensions */
+ .debug_weaknames 0 : { *(.debug_weaknames) }
+ .debug_funcnames 0 : { *(.debug_funcnames) }
+ .debug_typenames 0 : { *(.debug_typenames) }
+ .debug_varnames 0 : { *(.debug_varnames) }
+}
+
Added: trunk/firmware/arm/str/cantest_str73x_gcc/main.c
===================================================================
--- trunk/firmware/arm/str/cantest_str73x_gcc/main.c (rev 0)
+++ trunk/firmware/arm/str/cantest_str73x_gcc/main.c 2008-02-06 16:33:43 UTC (rev 833)
@@ -0,0 +1,581 @@
+/******************** (C) COPYRIGHT 2005 STMicroelectronics **********************
+* File Name : main.c
+* Author : MCD Application Team
+* Date First Issued : 09/27/2005 : V1.0
+* Description : Main program body
+**********************************************************************************
+* History:
+* 09/27/2005 : V1.0
+**********************************************************************************
+* THE PRESENT SOFTWARE WHICH IS FOR GUIDANCE ONLY AIMS AT PROVIDING CUSTOMERS WITH
+* CODING INFORMATION REGARDING THEIR PRODUCTS IN ORDER FOR THEM TO SAVE TIME.
+* AS A RESULT, STMICROELECTRONICS SHALL NOT BE HELD LIABLE FOR ANY DIRECT, INDIRECT
+* OR CONSEQUENTIAL DAMAGES WITH RESPECT TO ANY CLAIMS ARISING FROM THE CONTENT
+* OF SUCH SOFTWARE AND/OR THE USE MADE BY CUSTOMERS OF THE CODING INFORMATION
+* CONTAINED HEREIN IN CONNECTION WITH THEIR PRODUCTS.
+*********************************************************************************/
+
+/* Standard include ------------------------------------------------------------*/
+#include "73x_lib.h"
+#include "../common/73x_lcd.h"
+#include "../common/systime.h"
+#include "../common/delay.h"
+
+// Prototypes
+void wait( void );
+void MCLK_Config (void);
+void CAN0_Demo_Polling( void );
+unsigned int get1000Digit( unsigned int val );
+unsigned int get100Digit( unsigned int val );
+unsigned int get10Digit( unsigned int val );
+unsigned int get1Digit( unsigned int val );
+
+// Peripherals Init Structures
+GPIO_InitTypeDef GPIO0_InitStructure;
+GPIO_InitTypeDef GPIO3_InitStructure;
+ADC_InitTypeDef ADC_InitStructure;
+CMU_InitTypeDef CMU_InitStructure;
+RTC_InitTypeDef RTC_InitStructure;
+
+GPIO_InitTypeDef CAN0_RX;
+GPIO_InitTypeDef CAN0_TX;
+GPIO_InitTypeDef CAN1_RX;
+GPIO_InitTypeDef CAN1_TX;
+GPIO_InitTypeDef CAN2_RX;
+GPIO_InitTypeDef CAN2_TX;
+GPIO_InitTypeDef Led_Config;
+
+// define the LEDs
+#define LD1 GPIO_PIN_0
+#define LD2 GPIO_PIN_1
+#define LD3 GPIO_PIN_2
+#define LD4 GPIO_PIN_3
+#define LD5 GPIO_PIN_4
+#define LD6 GPIO_PIN_5
+#define LD7 GPIO_PIN_6
+#define LD8 GPIO_PIN_7
+#define LD9 GPIO_PIN_8
+#define LD10 GPIO_PIN_9
+#define LD11 GPIO_PIN_10
+#define LD12 GPIO_PIN_11
+#define LD13 GPIO_PIN_12
+#define LD14 GPIO_PIN_13
+#define LD15 GPIO_PIN_14
+#define LD16 GPIO_PIN_15
+
+// buffer for receive messages
+canmsg RxCan0Msg;
+
+// array of pre-defined transmit messages
+canmsg TxCan0Msg[ 2 ] = {
+ { CAN_STD_ID,
+ 0x123,
+ 4,
+ { 0x01, 0x02, 0x04, 0x08 } },
+ { CAN_EXT_ID,
+ 0x12345678,
+ 8,
+ { 0x10, 0x11, 0x12, 0x13, 0x14, 0x15, 0x16, 0x17 } }
+};
+
+// buffer for receive messages
+canmsg RxCan1Msg;
+
+// array of pre-defined transmit messages
+canmsg TxCan1Msg[2] = {
+ { CAN_STD_ID, 0x123, 4, { 0x01, 0x02, 0x04, 0x08 } },
+ { CAN_EXT_ID, 0x12345678, 8, { 0x10, 0x11, 0x12, 0x13, 0x14, 0x15, 0x16, 0x17 } }
+};
+
+// buffer for receive messages
+canmsg RxCan2Msg;
+
+// array of pre-defined transmit messages
+canmsg TxCan2Msg[2] = {
+ { CAN_STD_ID, 0x123, 4, { 0x01, 0x02, 0x04, 0x08 } },
+ { CAN_EXT_ID, 0x12345678, 8, { 0x10, 0x11, 0x12, 0x13, 0x14, 0x15, 0x16, 0x17 } }
+};
+
+// used message object numbers
+enum {
+ CAN0_TX_MSGOBJ = 0,
+ CAN0_RX_MSGOBJ = 1
+};
+enum {
+ CAN1_TX_MSGOBJ = 0,
+ CAN1_RX_MSGOBJ = 1
+};
+enum {
+ CAN2_TX_MSGOBJ = 0,
+ CAN2_RX_MSGOBJ = 1
+};
+
+u16 Conversion_Value = 0;
+u8 buffer[11] = "ADC: ";
+
+
+
+/* Private function prototypes -------------------------------------------------*/
+
+/* Interface functions ---------------------------------------------------------*/
+
+/* Private functions -----------------------------------------------------------*/
+
+
+int main(void)
+{
+ u32 CPIO_Value;
+
+#ifdef LIBDEBUG
+ libdebug();
+#endif
+
+ MCLK_Config();
+
+ CFG_PeripheralClockConfig( CFG_CLK_CAN0, ENABLE );
+ CFG_PeripheralClockConfig( CFG_CLK_CAN1, ENABLE );
+
+ CFG_PeripheralClockConfig( CFG_CLK_GPIO0, ENABLE );
+ CFG_PeripheralClockConfig( CFG_CLK_GPIO1, ENABLE );
+ CFG_PeripheralClockConfig( CFG_CLK_GPIO2, ENABLE );
+ CFG_PeripheralClockConfig( CFG_CLK_GPIO6, ENABLE );
+
+ Led_Config.GPIO_Mode = GPIO_Mode_OUT_PP;
+ Led_Config.GPIO_Pins = 0xFFFF;
+ GPIO_Init( GPIO0, &Led_Config );
+
+ GPIO3_InitStructure.GPIO_Mode = GPIO_Mode_HI_AIN_TRI;
+ GPIO3_InitStructure.GPIO_Pins = GPIO_PIN_ALL;
+ GPIO_Init( GPIO3, &GPIO3_InitStructure );
+
+ CAN0_RX.GPIO_Mode = GPIO_Mode_IN_TRI_TTL;
+ CAN0_RX.GPIO_Pins = GPIO_PIN_14;
+ GPIO_Init( GPIO1, &CAN0_RX );
+
+ CAN0_TX.GPIO_Mode = GPIO_Mode_AF_PP;
+ CAN0_TX.GPIO_Pins = GPIO_PIN_15;
+ GPIO_Init( GPIO1, &CAN0_TX );
+
+ CAN1_RX.GPIO_Mode = GPIO_Mode_IN_TRI_TTL;
+ CAN1_RX.GPIO_Pins = GPIO_PIN_1;
+ GPIO_Init( GPIO2, &CAN1_RX );
+
+ CAN1_TX.GPIO_Mode = GPIO_Mode_AF_PP;
+ CAN1_TX.GPIO_Pins = GPIO_PIN_2;
+ GPIO_Init( GPIO2, &CAN1_TX );
+
+ // Init 1 ms timebase
+ initTimebase2();
+
+ GPIO_WordWrite( GPIO0, 0x0000 ); // All LED's off
+
+ // * * * EIC * * *
+
+ // EIC Clock Enable
+ CFG_PeripheralClockConfig( CFG_CLK_EIC , ENABLE );
+
+ // EIC Config
+ EIC_IRQChannelPriorityConfig( RTC_IRQChannel, 1 );
+ EIC_IRQChannelPriorityConfig( TB2_IRQChannel,2 );
+
+ EIC_IRQChannelConfig( RTC_IRQChannel , ENABLE );
+ EIC_IRQChannelConfig( TB2_IRQChannel, ENABLE );
+
+ EIC_IRQCmd( ENABLE );
+
+ // * * * RTC * * *
+
+ // Set RTC clock-------
+ // (clock:0-->9) fOSC=4Mhz/RTCP=(2,4,8,16,32,64,128,256,512,1024)
+ // -->EXTCLK=(4M,2M,1M,500K,250K,125K,62.5K,31.25K,15.625K,7.812K)
+
+ // RTC Clock Enable
+ CFG_PeripheralClockConfig( CFG_CLK_RTC , ENABLE );
+
+ // RTC Interrupt Config
+ RTC_ITConfig( RTC_IT_SEC | RTC_IT_ALA | RTC_IT_OV, ENABLE );
+
+ // RTC Configuration
+ RTC_InitStructure.RTC_Alarm = 6; // 0xFFFFFFFF;
+ RTC_InitStructure.RTC_Counter = 0; // 0xFFFFFFFA;
+ // configure RTC=1S ( RCK=1000000/64=CKL32=15625Hz )
+ // 8MHz/64 = 125000 = 0x1E848
+ RTC_InitStructure.RTC_Prescaler = 0x3D09; // == 15625
+ //RTC_InitStructure.RTC_Prescaler = 0x1E848; // 0x3D09; // == 15625
+
+ RTC_Init( &RTC_InitStructure );
+
+ // * * * CAN * * *
+ CAN_InitTypeDef CANInit = { 0x0, CAN_BITRATE_500K };
+
+ // initialize the CAN at a standard bitrate, interrupts disabled
+ CAN_Init( CAN0, &CANInit );
+
+ // configure the message objects
+ CAN_InvalidateAllMsgObj( CAN0 );
+ CAN_SetTxMsgObj( CAN0, CAN0_TX_MSGOBJ, CAN_STD_ID );
+ CAN_SetRxMsgObj( CAN0, CAN0_RX_MSGOBJ, CAN_STD_ID, 0, CAN_LAST_STD_ID, TRUE );
+
+ // * * * LCD * * *
+
+ // LCD Configuration
+ LCD_Init();
+ LCD_LineClear(1);
+ LCD_LineClear(2);
+ LCD_SetPosCur(1,1);
+
+ // Display text message on LCD: Line 1
+ LCD_SendString( "SIMPLE CAN TEST", 1, 1 );
+ delay_ms( 40 );
+ LCD_SetPosCur(2,1);
+
+
+ // * * * ADC * * *
+
+
+ /* ADC Clock Enable */
+ CFG_PeripheralClockConfig(CFG_CLK_ADC, ENABLE);
+
+ /* ADC Configuration */
+ ADC_DeInit ();
+ ADC_StructInit(&ADC_InitStructure);
+ ADC_InitStructure.ADC_Calibration = ADC_Calibration_ON;
+ ADC_InitStructure.ADC_CalibAverage = ADC_CalibAverage_Enable;
+ ADC_InitStructure.ADC_AutoClockOff = ADC_AutoClockOff_Disable ;
+ ADC_InitStructure.ADC_ConversionMode = ADC_ConversionMode_Scan ;
+ ADC_InitStructure.ADC_SamplingPrescaler = 0x2;
+ ADC_InitStructure.ADC_ConversionPrescaler = 0x4;
+ ADC_InitStructure.ADC_FirstChannel = ADC_CHANNEL0 ;
+ ADC_InitStructure.ADC_ChannelNumber = 1;
+ ADC_Init(&ADC_InitStructure);
+
+
+ /* EOC interrupt Enable */
+ ADC_ITConfig(ADC_IT_EOC, ENABLE);
+
+ /* Enable ADC */
+ ADC_Cmd(ENABLE);
+
+
+
+ // * * * CMU * * *
+
+
+
+ /* CMU Initialization */
+ //CMU_DeInit( );
+ //CMU_StructInit(&CMU_InitStructure);
+
+ /* Enable the external oscillator */
+ //CMU_InitStructure.CMU_CKSEL0 = CMU_CKSEL0_CKOSC;
+ //CMU_Init(&CMU_InitStructure);
+
+ /* Disable DIV2 */
+ //PRCCU->CFR &= 0x7FFF;
+
+
+ while(1) {
+
+ /* Start ADC conversion */
+ ADC_ConversionCmd( ADC_ConversionStart );
+ buffer[8] = get1Digit( Conversion_Value );
+ buffer[7] = get10Digit( Conversion_Value );
+ buffer[6] = get100Digit( Conversion_Value );
+ buffer[5] = get1000Digit( Conversion_Value );
+ buffer[9] = 0;
+
+ /* Display ADC conversion Value on LCD */
+ LCD_SendString( &buffer[5], 2, 5 );
+ CPIO_Value = 0;
+
+ for(u32 i = (u32)((float)Conversion_Value/60); i; i--) {
+ CPIO_Value <<= 1;
+ CPIO_Value |= 1;
+ }
+
+ GPIO_WordWrite( GPIO0, CPIO_Value );
+
+ }
+
+}
+
+////////////////////////////////////////////////////////////////////////////////
+// get1000Digit
+//
+
+unsigned int get1000Digit( unsigned int val )
+{
+ return ( ( val / 1000 ) + 0x30 );
+}
+
+////////////////////////////////////////////////////////////////////////////////
+// get100Digit
+//
+
+unsigned int get100Digit( unsigned int val )
+{
+ unsigned int valCopy;
+ valCopy = val % 1000;
+ return ( (valCopy / 100 ) + 0x30 );
+}
+
+////////////////////////////////////////////////////////////////////////////////
+// get10Digit
+//
+
+unsigned int get10Digit( unsigned int val )
+{
+ unsigned int valCopy;
+ valCopy = val % 100;
+ return ( ( valCopy / 10 ) + 0x30 );
+}
+
+////////////////////////////////////////////////////////////////////////////////
+// get1Digit
+//
+
+unsigned int get1Digit( unsigned int val )
+{
+ unsigned int valCopy;
+ valCopy = val % 100;
+ return ( ( valCopy % 10 ) + 0x30 );
+}
+
+////////////////////////////////////////////////////////////////////////////////
+// wait
+//
+
+void wait( void )
+{
+ u32 i;
+
+ for (i=100000L; i!=0 ; i-- ) {}
+}
+
+////////////////////////////////////////////////////////////////////////////////
+// MCLK_Config
+//
+
+void MCLK_Config (void)
+{
+
+ PRCCU_InitTypeDef Clock;
+ CMU_InitTypeDef ClockInit;
+
+ ClockInit.CMU_RCOscControl = 0x0D; // RC OSC Adjust
+ ClockInit.CMU_EndCountValue = 0x0F; //
+ ClockInit.CMU_FreqRef_High = 0xFF; //
+ ClockInit.CMU_FreqRef_Low = 0xFE; //
+
+ ClockInit.CMU_CKSEL0 = CMU_CKSEL0_CKOSC; // Clock for CLOCK1 (4MHz)
+ ClockInit.CMU_CKSEL1 = CMU_CKSEL1_CKPLL; // Clock for Freq. Meter (8MHz)
+ ClockInit.CMU_CKSEL2 = CMU_CKSEL2_CKOSC; // Clock to drive CMU logic
+
+ CMU_Lock( DISABLE );
+ CMU_Init( &ClockInit );
+
+ // Init. Power Reset Clock unit
+ // 4 MHz * 12 / 6 = 8 MHz = CLOCK2
+ Clock.PRCCU_DIV2 = DISABLE;
+ Clock.PRCCU_MCLKSRC_SRC = PRCCU_MCLKSRC_PLL; // Use PLL in
+ Clock.PRCCU_PLLDIV = PRCCU_PLLDIV_6;
+ Clock.PRCCU_PLLMUL = PRCCU_PLLMUL_12;
+
+ PRCCU_Init( &Clock );
+ PRCCU_SetExtClkDiv(4);
+
+}
+
+///////////////////////////////////////////////////////////////////////...
[truncated message content] |