From 0dd2134fa8b91281fc16482c20638f8d85b7cc81 Mon Sep 17 00:00:00 2001 From: patacongo Date: Fri, 11 Jan 2008 13:56:58 +0000 Subject: [PATCH] Add board init git-svn-id: svn://svn.code.sf.net/p/nuttx/code/trunk@551 42af7a65-404d-4744-a932-0658087f49c3 --- arch/z16/src/Makefile | 2 +- arch/z16/src/z16f/chip.h | 14 ++++- arch/z16/src/z16f/z16f_head.S | 95 ++++++++++++++++++++------------ arch/z16/src/z16f/z16f_lowuart.S | 6 +- 4 files changed, 77 insertions(+), 40 deletions(-) diff --git a/arch/z16/src/Makefile b/arch/z16/src/Makefile index 229389a33f9..e900db02622 100644 --- a/arch/z16/src/Makefile +++ b/arch/z16/src/Makefile @@ -109,7 +109,7 @@ clean: @if [ -e board/Makefile ]; then \ $(MAKE) -C board TOPDIR="$(TOPDIR)" clean ; \ fi - @rm -f libarch$(LIBEXT) nuttx.linkcmd *~ .*.swp *.asm *.tmp + @rm -f libarch$(LIBEXT) nuttx.linkcmd *~ .*.swp *.asm *.tmp *.map $(call CLEAN) distclean: clean diff --git a/arch/z16/src/z16f/chip.h b/arch/z16/src/z16f/chip.h index 5bbf83580f3..b91e44484f9 100644 --- a/arch/z16/src/z16f/chip.h +++ b/arch/z16/src/z16f/chip.h @@ -41,6 +41,8 @@ * Included Files ************************************************************************************/ +#include + /************************************************************************************ * Definitions ************************************************************************************/ @@ -106,7 +108,7 @@ * on the size of the IRAM supported by the chip. */ -#define Z16F_IRAM_BASE (HZ32(ffffc000) - Z16F_IRAM_SIZE) +#define Z16F_IRAM_BASE (_HX32(ffffc000) - Z16F_IRAM_SIZE) /* External memory mapped peripherals, internal I/O memory and SFRS */ @@ -286,6 +288,16 @@ extern "C" { #define EXTERN extern #endif +/* The following two routines are called from the low-level reset logic. z16f_lowinit() + * must be provided by the board-specific logic; z16f_lowuartinit() is called only if + * debugging support for up_lowputc (or getc) is enabled. + */ + +extern void z16f_lowinit(void); +#if defined(CONFIG_ARCH_LOWPUTC) || defined(CONFIG_ARCH_LOWGETC) +extern void z16f_lowuartinit(void); +#endif + #undef EXTERN #ifdef __cplusplus } diff --git a/arch/z16/src/z16f/z16f_head.S b/arch/z16/src/z16f/z16f_head.S index 00ae886f4de..24238be2e29 100755 --- a/arch/z16/src/z16f/z16f_head.S +++ b/arch/z16/src/z16f/z16f_head.S @@ -65,31 +65,31 @@ **************************************************************************/ vector RESET=_reset - vector SYSEXC=_default_handler - vector TIMER2=_default_handler - vector TIMER1=_default_handler - vector TIMER0=_default_handler - vector UART0_RX=_default_handler - vector UART0_TX=_default_handler - vector I2C=_default_handler - vector SPI=_default_handler - vector ADC=_default_handler - vector P7AD=_default_handler - vector P6AD=_default_handler - vector P5AD=_default_handler - vector P4AD=_default_handler - vector P3AD=_default_handler - vector P2AD=_default_handler - vector P1AD=_default_handler - vector P0AD=_default_handler - vector PWM_TIMER=_default_handler - vector UART1_RX=_default_handler - vector UART1_TX=_default_handler - vector PWM_FAULT=_default_handler - vector C3=_default_handler - vector C2=_default_handler - vector C1=_default_handler - vector C0=_default_handler + vector SYSEXC=_sysexc_isr + vector TIMER2=_timer2_isr + vector TIMER1=_timer1_isr + vector TIMER0=_timer0_isr + vector UART0_RX=_uart0rx_isr + vector UART0_TX=_uart0tx_isr + vector I2C=_i2c_isr + vector SPI=_spi_isr + vector ADC=_adc_isr + vector P7AD=_p7ad_isr + vector P6AD=_p6ad_isr + vector P5AD=_p5ad_isr + vector P4AD=_p4ad_isr + vector P3AD=_p3ad_isr + vector P2AD=_p2ad_isr + vector P1AD=_p1ad_isr + vector P0AD=_p0ad_isr + vector PWM_TIMER=_pwmtimer_isr + vector UART1_RX=_uart1rx_isr + vector UART1_TX=_uart1tx_isr + vector PWM_FAULT=_pwmfault_isr + vector C3=_c3_isr + vector C2=_c3_isr + vector C1=_c2_isr + vector C0=_c0_isr /************************************************************************** * Equates @@ -117,25 +117,50 @@ STACK_TOP equ %FFC000 **************************************************************************/ _reset: - ld sp, #STACK_TOP /* Set Stack Pointer */ - + ld sp, #STACK_TOP /* Set Stack Pointer */ + call _z16f_lowinit /* Perform low-level hardware initialization */ #if defined(CONFIG_ARCH_LOWPUTC) || defined(CONFIG_ARCH_LOWGETC) - call _z16f_lowinit /* Initialize the UART for low-level debug */ + call _z16f_lowuartinit /* Initialize the UART for debugging */ #endif - call _os_start /* Start the operating system */ -_halted: /* _os_start() should not return */ - halt - jp _halted + call _os_start /* Start the operating system */ +_halted: /* _os_start() should not return */ + halt + jp _halted /************************************************************************** - * Name: _default_handler + * Name: Interrupt handlers * * Description: - * This is where interrupts will go if they have not yet been intialize + * All interrupts will be vectored to the following locations. * **************************************************************************/ -_default_handler: +_sysexc_isr: +_timer2_isr: +_timer1_isr: +_timer0_isr: +_uart0rx_isr: +_uart0tx_isr: +_i2c_isr: +_spi_isr: +_adc_isr: +_p7ad_isr: +_p6ad_isr: +_p5ad_isr: +_p4ad_isr: +_p3ad_isr: +_p2ad_isr: +_p1ad_isr: +_p0ad_isr: +_pwmtimer_isr: +_uart1rx_isr: +_uart1tx_isr: +_pwmfault_isr: +_c3_isr: +_c2_isr: +_c1_isr: +_c0_isr: +_common_isr: nop iret diff --git a/arch/z16/src/z16f/z16f_lowuart.S b/arch/z16/src/z16f/z16f_lowuart.S index 97d90406962..20c4fc35a0f 100755 --- a/arch/z16/src/z16f/z16f_lowuart.S +++ b/arch/z16/src/z16f/z16f_lowuart.S @@ -47,7 +47,7 @@ * External References / External Definitions *************************************************************************/ - xdef z16f_lowinit + xdef z16f_lowuartinit xref _SYS_CLK_FREQ:EROM #ifdef CONFIG_ARCH_LOWPUTC xdef _z16f_xmitc @@ -73,7 +73,7 @@ *************************************************************************/ /************************************************************************* - * Name: z16f_lowinit + * Name: z16f_lowuartinit * * Description: * Initialize UART0 or UART1 @@ -85,7 +85,7 @@ * *************************************************************************/ -z16f_lowinit: +z16f_lowuartinit: pushmlo /* Save registers */ ld r3, #_SYS_CLK_FREQ