add board sram support.
git-svn-id: https://rt-thread.googlecode.com/svn/trunk@18 bbd45198-f89e-11dd-88c7-29a3b14d5316
This commit is contained in:
parent
081698be20
commit
24b5b0727e
|
@ -134,6 +134,32 @@ void rt_hw_timer_handler(void)
|
|||
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.
|
||||
*/
|
||||
|
@ -148,6 +174,9 @@ void rt_hw_board_init()
|
|||
/* Configure the SysTick */
|
||||
SysTick_Configuration();
|
||||
|
||||
/* Configure SRAM on the board */
|
||||
FSMC_SRAM_Init();
|
||||
|
||||
rt_hw_console_init();
|
||||
}
|
||||
|
||||
|
|
|
@ -15,6 +15,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);
|
||||
void rt_hw_board_init(void);
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
### 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"))
|
||||
|
|
|
@ -35,6 +35,7 @@ extern void finsh_set_device(char* device);
|
|||
|
||||
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
|
||||
/*******************************************************************************
|
||||
|
@ -84,6 +86,9 @@ void rtthread_startup(void)
|
|||
rt_system_timer_init();
|
||||
|
||||
#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__
|
||||
|
@ -92,6 +97,7 @@ void rtthread_startup(void)
|
|||
/* init memory system */
|
||||
rt_system_heap_init((void*)&__bss_end, (void*)0x20010000);
|
||||
#endif
|
||||
#endif
|
||||
#endif
|
||||
|
||||
/* init scheduler system */
|
||||
|
|
Loading…
Reference in New Issue