提交 24b5b072 编写于 作者: B bernard.xiong

add board sram support.

git-svn-id: https://rt-thread.googlecode.com/svn/trunk@18 bbd45198-f89e-11dd-88c7-29a3b14d5316
上级 081698be
......@@ -133,6 +133,32 @@ void rt_hw_timer_handler(void)
rt_interrupt_leave();
rt_hw_interrupt_thread_switch();
}
static void FSMC_SRAM_Init(void)
{
#define REG32(x) (*(volatile unsigned long*)(x))
/* enable FSMC clock */
REG32(0x40021014) = 0x114;
/* enable GPIOD, GPIOE, GPIOF and GPIOG clocks */
REG32(0x40021018) = 0x1e0;
/* SRAM Data lines, NOE and NWE configuration */
REG32(0x40011400) = 0x44BB44BB;
REG32(0x40011404) = 0xBBBBBBBB;
REG32(0x40011800) = 0xB44444BB;
REG32(0x40011804) = 0xBBBBBBBB;
REG32(0x40011C00) = 0x44BBBBBB;
REG32(0x40011C04) = 0xBBBB4444;
REG32(0x40012000) = 0x44BBBBBB;
REG32(0x40012004) = 0x44444B44;
/* FSMC Configuration (enable FSMC Bank1_SRAM Bank) */
REG32(0xA0000010) = 0x00001011;
REG32(0xA0000014) = 0x00000200;
}
/**
* This function will initial STM32 board.
......@@ -147,6 +173,9 @@ void rt_hw_board_init()
/* Configure the SysTick */
SysTick_Configuration();
/* Configure SRAM on the board */
FSMC_SRAM_Init();
rt_hw_console_init();
}
......
......@@ -14,6 +14,11 @@
#ifndef __BOARD_H__
#define __BOARD_H__
#define RT_USING_BOARD_SRAM
#define BOARD_SRAM_BEGIN 0x68000000
#define BOARD_SRAM_END 0x68080000
void rt_hw_board_led_on(int n);
void rt_hw_board_led_off(int n);
......
### uVision2 Project, (C) Keil Software
### Do not modify !
Target (RT-Thread/STM32Sky), 0x0004 // Tools: 'ARM-ADS'
Target (RT-Thread/STMSky), 0x0004 // Tools: 'ARM-ADS'
Group (Startup)
Group (Library)
......@@ -78,7 +78,7 @@ File 5,1,<..\..\finsh\symbol.c><symbol.c>
File 5,1,<..\..\finsh\cmd.c><cmd.c>
Options 1,0,0 // Target 'RT-Thread/STM32Sky'
Options 1,0,0 // Target 'RT-Thread/STMSky'
Device (STM32F103ZE)
Vendor (STMicroelectronics)
Cpu (IRAM(0x20000000-0x2000FFFF) IROM(0x8000000-0x807FFFF) CLOCK(8000000) CPUTYPE("Cortex-M3"))
......
......@@ -34,7 +34,8 @@ extern void finsh_set_device(char* device);
#endif
extern int rt_application_init(void);
#ifndef RT_USING_BOARD_SRAM
#ifdef __CC_ARM
extern int Image$$RW_IRAM1$$ZI$$Limit;
#elif __ICCARM__
......@@ -42,6 +43,7 @@ extern int Image$$RW_IRAM1$$ZI$$Limit;
#else
extern int __bss_end;
#endif
#endif
#ifdef DEBUG
/*******************************************************************************
......@@ -83,7 +85,10 @@ void rtthread_startup(void)
/* init timer system */
rt_system_timer_init();
#ifdef RT_USING_HEAP
#ifdef RT_USING_HEAP
#ifdef RT_USING_BOARD_SRAM
rt_system_heap_init((void*)BOARD_SRAM_BEGIN, (void*)BOARD_SRAM_END);
#else
#ifdef __CC_ARM
rt_system_heap_init((void*)&Image$$RW_IRAM1$$ZI$$Limit, (void*)0x20010000);
#elif __ICCARM__
......@@ -91,6 +96,7 @@ void rtthread_startup(void)
#else
/* init memory system */
rt_system_heap_init((void*)&__bss_end, (void*)0x20010000);
#endif
#endif
#endif
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册