summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--bsp/at91sam9260/applications/startup.c100
-rw-r--r--bsp/at91sam9260/drivers/board.c9
-rw-r--r--bsp/at91sam9260/link_scripts/at91sam9260_ram.icf34
-rw-r--r--bsp/at91sam9260/link_scripts/at91sam9260_ram.scat60
4 files changed, 64 insertions, 139 deletions
diff --git a/bsp/at91sam9260/applications/startup.c b/bsp/at91sam9260/applications/startup.c
index 2f77f4ad68..5d374d3510 100644
--- a/bsp/at91sam9260/applications/startup.c
+++ b/bsp/at91sam9260/applications/startup.c
@@ -29,16 +29,6 @@
#ifdef RT_USING_FINSH
#include <finsh.h>
#endif
-extern void rt_hw_interrupt_init(void);
-extern void rt_hw_board_init(void);
-extern void rt_system_timer_init(void);
-extern void rt_system_scheduler_init(void);
-extern void rt_thread_idle_init(void);
-extern void mmu_invalidate_icache();
-extern void rt_hw_cpu_icache_enable(void);
-extern void rt_show_version(void);
-extern void rt_system_heap_init(void*, void*);
-extern void rt_hw_finsh_init(void);
extern void rt_application_init(void);
/**
@@ -48,65 +38,38 @@ extern void rt_application_init(void);
/*@{*/
#if defined(__CC_ARM)
extern int Image$$ER_ZI$$ZI$$Limit;
-#define HEAP_START ((void*)&Image$$ER_ZI$$ZI$$Limit)
+#define HEAP_BEGIN (&Image$$ER_ZI$$ZI$$Limit)
#elif (defined (__GNUC__))
extern unsigned char __bss_end__;
-#define HEAP_START ((void*)&__bss_end__)
+#define HEAP_BEGIN (&__bss_end__)
#elif (defined (__ICCARM__))
-#pragma section="HEAP"
-#define HEAP_START (__section_begin("HEAP"))
-#endif
-
-#define HEAP_END ((void*)0x24000000)
-
-#ifdef RT_USING_FINSH
-extern void finsh_system_init(void);
+#pragma section=".noinit"
+#define HEAP_BEGIN (__section_end(".noinit"))
#endif
+#define HEAP_END (0x24000000)
/**
* This function will startup RT-Thread RTOS.
*/
-void rtthread_startup(void)
+static void rtthread_startup(void)
{
- /* disable interrupt first */
- rt_hw_interrupt_disable();
- /* enable cpu cache */
- rt_hw_cpu_icache_disable();
- mmu_invalidate_icache();
- rt_hw_cpu_icache_enable();
-
- /* initialize hardware interrupt */
- rt_hw_interrupt_init();
-
- /* initialize board */
- rt_hw_board_init();
-
- /* show version */
- rt_show_version();
-
- /* initialize tick */
- rt_system_tick_init();
-
- /* initialize kernel object */
- rt_system_object_init();
+ /* initialize board */
+ rt_hw_board_init();
- /* initialize timer system */
- rt_system_timer_init();
+ /* show version */
+ rt_show_version();
- /* initialize heap memory system */
- rt_system_heap_init(HEAP_START, HEAP_END);
-
-#ifdef RT_USING_MODULE
- /* initialize module system*/
- rt_system_module_init();
+#ifdef RT_USING_HEAP
+ rt_system_heap_init((void *)HEAP_BEGIN, (void *)HEAP_END);
#endif
- /* initialize scheduler system */
- rt_system_scheduler_init();
-
- /* initialize application */
- rt_application_init();
+ /* initialize scheduler system */
+ rt_system_scheduler_init();
+ /* initialize system timer*/
+ rt_system_timer_init();
+ /* initialize application */
+ rt_application_init();
#ifdef RT_USING_FINSH
/* initialize finsh */
@@ -115,26 +78,29 @@ void rtthread_startup(void)
finsh_set_device(RT_CONSOLE_DEVICE_NAME);
#endif
#endif
+
+ /* initialize timer thread */
+ rt_system_timer_thread_init();
- /* initialize system timer thread */
- rt_system_timer_thread_init();
-
- /* initialize idle thread */
- rt_thread_idle_init();
+ /* initialize idle thread */
+ rt_thread_idle_init();
- /* start scheduler */
- rt_system_scheduler_start();
+ /* start scheduler */
+ rt_system_scheduler_start();
- /* never reach here */
- return ;
+ /* never reach here */
+ return ;
}
int main(void)
{
- /* startup RT-Thread RTOS */
- rtthread_startup();
+ /* disable interrupt first */
+ rt_hw_interrupt_disable();
+
+ /* startup RT-Thread RTOS */
+ rtthread_startup();
- return 0;
+ return 0;
}
/*@}*/
diff --git a/bsp/at91sam9260/drivers/board.c b/bsp/at91sam9260/drivers/board.c
index 15ef7c9dd6..4b2e0caa28 100644
--- a/bsp/at91sam9260/drivers/board.c
+++ b/bsp/at91sam9260/drivers/board.c
@@ -33,7 +33,7 @@
*/
/*@{*/
-
+extern void rt_hw_interrupt_init(void);
extern void rt_hw_clock_init(void);
extern void rt_hw_get_clock(void);
@@ -143,6 +143,10 @@ static void at91sam926x_pit_init(void)
*/
void rt_hw_board_init()
{
+ /* initialize mmu */
+ rt_hw_mmu_init(at91_mem_desc, sizeof(at91_mem_desc)/sizeof(at91_mem_desc[0]));
+ /* initialize hardware interrupt */
+ rt_hw_interrupt_init();
/* initialize the system clock */
rt_hw_clock_init();
@@ -150,8 +154,7 @@ void rt_hw_board_init()
rt_hw_uart_init();
rt_console_set_device(RT_CONSOLE_DEVICE_NAME);
- /* initialize mmu */
- rt_hw_mmu_init(at91_mem_desc, sizeof(at91_mem_desc)/sizeof(at91_mem_desc[0]));
+
/* initialize timer0 */
rt_hw_timer_init();
diff --git a/bsp/at91sam9260/link_scripts/at91sam9260_ram.icf b/bsp/at91sam9260/link_scripts/at91sam9260_ram.icf
index e9659fb594..90f5adce7f 100644
--- a/bsp/at91sam9260/link_scripts/at91sam9260_ram.icf
+++ b/bsp/at91sam9260/link_scripts/at91sam9260_ram.icf
@@ -1,26 +1,6 @@
-//*****************************************************************************
-//
-// blinky.icf - Linker configuration file for blinky.
-//
-// Copyright (c) 2013-2014 Texas Instruments Incorporated. All rights reserved.
-// Software License Agreement
-//
-// Texas Instruments (TI) is supplying this software for use solely and
-// exclusively on TI's microcontroller products. The software is owned by
-// TI and/or its suppliers, and is protected under applicable copyright
-// laws. You may not combine this software with "viral" open-source
-// software in order to form a larger program.
-//
-// THIS SOFTWARE IS PROVIDED "AS IS" AND WITH ALL FAULTS.
-// NO WARRANTIES, WHETHER EXPRESS, IMPLIED OR STATUTORY, INCLUDING, BUT
-// NOT LIMITED TO, IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
-// A PARTICULAR PURPOSE APPLY TO THIS SOFTWARE. TI SHALL NOT, UNDER ANY
-// CIRCUMSTANCES, BE LIABLE FOR SPECIAL, INCIDENTAL, OR CONSEQUENTIAL
-// DAMAGES, FOR ANY REASON WHATSOEVER.
-//
-// This is part of revision 2.1.0.12573 of the DK-TM4C129X Firmware Package.
-//
-//*****************************************************************************
+//------------------------------------------------------------------------------
+// Linker scatter for running in external SDRAM on the AT91SAM9260
+//------------------------------------------------------------------------------
//
// Define a memory region that covers the entire 4 GB addressible space of the
@@ -39,12 +19,6 @@ define region FLASH = mem:[from 0x20000000 to 0x207FFFFF];
define region SRAM = mem:[from 0x20800000 to 0x23FFFFFF];
//
-// Define a block for the heap. The size should be set to something other
-// than zero if things in the C library that require the heap are used.
-//
-define block HEAP with alignment = 8, size = 0x02000000 { };
-
-//
// Indicate that the read/write values should be initialized by copying from
// flash.
//
@@ -75,7 +49,7 @@ place at start of SRAM { section VTABLE };
//
// Place all read/write items into SRAM.
//
-place in SRAM { readwrite, block HEAP };
+place in SRAM { readwrite};
keep { section FSymTab };
keep { section VSymTab };
keep { section .rti_fn* };
diff --git a/bsp/at91sam9260/link_scripts/at91sam9260_ram.scat b/bsp/at91sam9260/link_scripts/at91sam9260_ram.scat
index 3243902c9c..753a997d63 100644
--- a/bsp/at91sam9260/link_scripts/at91sam9260_ram.scat
+++ b/bsp/at91sam9260/link_scripts/at91sam9260_ram.scat
@@ -1,34 +1,6 @@
-; * ----------------------------------------------------------------------------
-; * ATMEL Microcontroller Software Support
-; * ----------------------------------------------------------------------------
-; * Copyright (c) 2008, 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.
-; *
-; * 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.
-; * ----------------------------------------------------------------------------
-
-; *------------------------------------------------------------------------------
-; * Linker scatter for running in external SDRAM on the AT91SAM9260
-; *----------------------------------------------------------------------------*/
+;*------------------------------------------------------------------------------
+;* Linker scatter for running in external SDRAM on the AT91SAM9260
+;*----------------------------------------------------------------------------*/
Load_region 0x20000000 0x00800000
{
@@ -38,21 +10,31 @@ Load_region 0x20000000 0x00800000
* (RESET +First)
.ANY (+RO +RW)
}
+
+ ARM_LIB_HEAP +0 EMPTY 0x1000
+ {
+ }
+
+ ARM_LIB_STACK +0 EMPTY 0x1000
+ {
+ }
+
+ ; Application ZI data (.bss)
ER_ZI +0
{
* (+ZI)
- } ; Application ZI data (.bss)
+ }
;Relocate_region 0x200000 0x1000
;{
; *.o (VECTOR, +First)
;}
- ARM_LIB_HEAP 0x21FFE000 EMPTY 0x1000
- {
- }
-
- ARM_LIB_STACK 0x22000000 EMPTY -0x1000
- {
- }
+ ;ARM_LIB_HEAP 0x21FFE000 EMPTY 0x1000
+ ;{
+ ;}
+
+ ;ARM_LIB_STACK 0x22000000 EMPTY -0x1000
+ ;{
+ ;}
}