summaryrefslogtreecommitdiff
path: root/bsp/sam7x
diff options
context:
space:
mode:
author[email protected] <[email protected]>2011-06-10 03:56:29 +0000
committer[email protected] <[email protected]>2011-06-10 03:56:29 +0000
commitb83b4ee04c8ce96e384bbc593c3b44f33f362b9f (patch)
treec8569d77fc7f4e28867c8e2c9b972c1710eed915 /bsp/sam7x
parent1fb43c8619da178a008c85a84cdabb37a2023be2 (diff)
add sam7x_rom.ld.
git-svn-id: https://rt-thread.googlecode.com/svn/trunk@1483 bbd45198-f89e-11dd-88c7-29a3b14d5316
Diffstat (limited to 'bsp/sam7x')
-rw-r--r--bsp/sam7x/application.c131
-rw-r--r--bsp/sam7x/board.h41
-rw-r--r--bsp/sam7x/rtconfig.py6
-rw-r--r--bsp/sam7x/sam7x_ram.lds37
-rw-r--r--bsp/sam7x/sam7x_rom.ld100
-rw-r--r--bsp/sam7x/sam7x_rom.lds50
-rw-r--r--bsp/sam7x/startup.c33
7 files changed, 186 insertions, 212 deletions
diff --git a/bsp/sam7x/application.c b/bsp/sam7x/application.c
index c6cb353dcc..1cb09b0bf9 100644
--- a/bsp/sam7x/application.c
+++ b/bsp/sam7x/application.c
@@ -15,70 +15,75 @@
/**
* @addtogroup sam7x
*/
-/*@{*/
-#include <rtthread.h>
-
-#ifdef RT_USING_DFS
-/* dfs init */
-#include <dfs_init.h>
-/* dfs filesystem:FAT filesystem init */
-#include <dfs_fat.h>
-/* dfs filesystem:EFS filesystem init */
-#include <dfs_efs.h>
-/* dfs Filesystem APIs */
-#include <dfs_fs.h>
-#endif
-
-#ifdef RT_USING_LWIP
-#include <lwip/sys.h>
-#endif
-
-#ifdef RT_USING_RTGUI
-#include <rtgui/rtgui.h>
-#endif
-
-/* thread phase init */
-void rt_init_thread_entry(void *parameter)
-{
-/* Filesystem Initialization */
-#ifdef RT_USING_DFS
- {
- /* init the device filesystem */
- dfs_init();
- /* init the efsl filesystam*/
- efsl_init();
-
- /* mount sd card fat partition 1 as root directory */
- if (dfs_mount("sd0", "/", "efs", 0, 0) == 0)
- rt_kprintf("File System initialized!\n");
- else
- rt_kprintf("File System init failed!\n");
- }
-#endif
-
-/* LwIP Initialization */
-#ifdef RT_USING_LWIP
- {
- extern void lwip_sys_init(void);
-
- /* init lwip system */
- lwip_sys_init();
- rt_kprintf("TCP/IP initialized!\n");
- }
-#endif
-}
-
+/*@{*/
+#include <rtthread.h>
+
+#ifdef RT_USING_DFS
+/* dfs init */
+#include <dfs_init.h>
+/* dfs filesystem:FAT filesystem init */
+#include <dfs_fat.h>
+/* dfs filesystem:EFS filesystem init */
+#include <dfs_efs.h>
+/* dfs Filesystem APIs */
+#include <dfs_fs.h>
+#endif
+
+#ifdef RT_USING_LWIP
+#include <lwip/sys.h>
+#endif
+
+#ifdef RT_USING_RTGUI
+#include <rtgui/rtgui.h>
+#endif
+
+/* thread phase init */
+void rt_init_thread_entry(void *parameter)
+{
+/* Filesystem Initialization */
+#ifdef RT_USING_DFS
+ {
+ /* init the device filesystem */
+ dfs_init();
+ /* init the efsl filesystam*/
+ efsl_init();
+
+ /* mount sd card fat partition 1 as root directory */
+ if (dfs_mount("sd0", "/", "efs", 0, 0) == 0)
+ rt_kprintf("File System initialized!\n");
+ else
+ rt_kprintf("File System init failed!\n");
+ }
+#endif
+
+/* LwIP Initialization */
+#ifdef RT_USING_LWIP
+ {
+ extern void lwip_sys_init(void);
+
+ eth_system_device_init();
+
+ /* register AT91 EMAC device */
+ sam7xether_register("E0");
+
+ /* init lwip system */
+ lwip_sys_init();
+ rt_kprintf("TCP/IP initialized!\n");
+ }
+#endif
+}
+
int rt_application_init()
-{
- rt_thread_t init_thread;
-
- init_thread = rt_thread_create("init",
- rt_init_thread_entry, RT_NULL,
- 1024, 8, 5);
- rt_thread_startup(init_thread);
-
- rt_kprintf("enter list() to get function list!\n");
-
+{
+ rt_thread_t init_thread;
+
+ init_thread = rt_thread_create("init",
+ rt_init_thread_entry, RT_NULL,
+ 1024, 8, 5);
+ rt_thread_startup(init_thread);
+
+ rt_kprintf("enter list() to get function list!\n");
+
return 0;
}
diff --git a/bsp/sam7x/board.h b/bsp/sam7x/board.h
index db4c456e4e..97a1e449fc 100644
--- a/bsp/sam7x/board.h
+++ b/bsp/sam7x/board.h
@@ -17,46 +17,7 @@
#include <rthw.h>
#include <rtthread.h>
-// These are defined in standard header (at91sam7x256.h) of realview MDK.
-//#define AT91C_US_RXRDY ((unsigned int) 0x1 << 0) /* US RXRDY Interrupt */
-//#define AT91C_US_TXRDY ((unsigned int) 0x1 << 1) /* US TXRDY Interrupt */
-//#define AT91C_US_RSTRX ((unsigned int) 0x1 << 2) /* US Reset Receiver */
-//#define AT91C_US_RSTTX ((unsigned int) 0x1 << 3) /* US Reset Transmitter */
-//#define AT91C_US_RXEN ((unsigned int) 0x1 << 4) /* US Receiver Enable */
-//#define AT91C_US_RXDIS ((unsigned int) 0x1 << 5) /* US Receiver Disable */
-//#define AT91C_US_TXEN ((unsigned int) 0x1 << 6) /* US Transmitter Enable */
-//#define AT91C_US_TXDIS ((unsigned int) 0x1 << 7) /* US Transmitter Disable */
-//#define AT91C_US_RSTSTA ((unsigned int) 0x1 << 8) /* US Reset Status Bits */
-//
-//#define AT91C_US_USMODE_NORMAL ((unsigned int) 0x0) /* USAR) Normal */
-//#define AT91C_US_USMODE_RS485 ((unsigned int) 0x1) /* USAR) RS485 */
-//#define AT91C_US_USMODE_HWHSH ((unsigned int) 0x2) /* USAR) Hardware Handshaking */
-//#define AT91C_US_USMODE_MODEM ((unsigned int) 0x3) /* USAR) Modem */
-//#define AT91C_US_USMODE_ISO7816_0 ((unsigned int) 0x4) /* USAR) ISO7816 protocol: T = 0 */
-//#define AT91C_US_USMODE_ISO7816_1 ((unsigned int) 0x6) /* USAR) ISO7816 protocol: T = 1 */
-//#define AT91C_US_USMODE_IRDA ((unsigned int) 0x8) /* USAR) IrDA */
-//#define AT91C_US_USMODE_SWHSH ((unsigned int) 0xC) /* USAR) Software Handshaking */
-//
-//#define AT91C_US_CLKS_CLOCK ((unsigned int) 0x0 << 4) /* USAR) Clock */
-//#define AT91C_US_CLKS_FDIV1 ((unsigned int) 0x1 << 4) /* USAR) fdiv1 */
-//#define AT91C_US_CLKS_SLOW ((unsigned int) 0x2 << 4) /* USAR) slow_clock (ARM) */
-//#define AT91C_US_CLKS_EXT ((unsigned int) 0x3 << 4) /* USAR) External (SCK) */
-//
-//#define AT91C_US_CHRL_5_BITS ((unsigned int) 0x0 << 6) /* USAR) Character Length: 5 bits */
-//#define AT91C_US_CHRL_6_BITS ((unsigned int) 0x1 << 6) /* USAR) Character Length: 6 bits */
-//#define AT91C_US_CHRL_7_BITS ((unsigned int) 0x2 << 6) /* USAR) Character Length: 7 bits */
-//#define AT91C_US_CHRL_8_BITS ((unsigned int) 0x3 << 6) /* USAR) Character Length: 8 bits */
-//
-//#define AT91C_US_PAR_EVEN ((unsigned int) 0x0 << 9) /* DBGU Even Parity */
-//#define AT91C_US_PAR_ODD ((unsigned int) 0x1 << 9) /* DBGU Odd Parity */
-//#define AT91C_US_PAR_SPACE ((unsigned int) 0x2 << 9) /* DBGU Parity forced to 0 (Space) */
-//#define AT91C_US_PAR_MARK ((unsigned int) 0x3 << 9) /* DBGU Parity forced to 1 (Mark) */
-//#define AT91C_US_PAR_NONE ((unsigned int) 0x4 << 9) /* DBGU No Parity */
-//#define AT91C_US_PAR_MULTI_DROP ((unsigned int) 0x6 << 9) /* DBGU Multi-drop mode */
-//
-//#define AT91C_US_NBSTOP_1_BIT ((unsigned int) 0x0 << 12) /* USART 1 stop bit */
-//#define AT91C_US_NBSTOP_15_BIT ((unsigned int) 0x1 << 12) /* USART Asynchronous (SYNC=0) 2 stop bits Synchronous (SYNC=1) 2 stop bits */
-//#define AT91C_US_NBSTOP_2_BIT ((unsigned int) 0x2 << 12) /* USART 2 stop bits */
+
#define MCK 48054857
#define BR 115200 /* Baud Rate */
diff --git a/bsp/sam7x/rtconfig.py b/bsp/sam7x/rtconfig.py
index 983e4c5f23..59666f0669 100644
--- a/bsp/sam7x/rtconfig.py
+++ b/bsp/sam7x/rtconfig.py
@@ -32,7 +32,7 @@ if PLATFORM == 'gcc':
DEVICE = ' -mcpu=arm7tdmi'
CFLAGS = DEVICE
AFLAGS = ' -c' + DEVICE + ' -x assembler-with-cpp'
- LFLAGS = DEVICE + ' -Wl,--gc-sections,-Map=sam7x_rom_gcc.map,-cref,-u,_start -T sam7x_rom.lds'
+ LFLAGS = DEVICE + ' -Wl,--gc-sections,-Map=sam7x_rom_gcc.map,-cref,-u,_start -T sam7x_rom.ld'
CPATH = ''
LPATH = ''
@@ -42,7 +42,7 @@ if PLATFORM == 'gcc':
else:
CFLAGS += ' -O2'
- POST_ACTION = OBJCPY + ' -O binary $TARGET rtthread-sam7x.bin\n' + SIZE + ' $TARGET \n'
+ POST_ACTION = OBJCPY + ' -O ihex $TARGET rtthread-sam7x.hex\n' + SIZE + ' $TARGET \n'
elif PLATFORM == 'armcc':
# toolchains
@@ -69,7 +69,7 @@ elif PLATFORM == 'armcc':
else:
CFLAGS += ' -O2'
- POST_ACTION = 'fromelf --bin $TARGET --output rtthread.bin \nfromelf -z $TARGET'
+ POST_ACTION = 'fromelf --hex $TARGET --output rtthread-asm7x.hex \nfromelf -z $TARGET'
elif PLATFORM == 'iar':
# toolchains
diff --git a/bsp/sam7x/sam7x_ram.lds b/bsp/sam7x/sam7x_ram.lds
deleted file mode 100644
index 43a56de7b5..0000000000
--- a/bsp/sam7x/sam7x_ram.lds
+++ /dev/null
@@ -1,37 +0,0 @@
-OUTPUT_FORMAT("elf32-littlearm", "elf32-littlearm", "elf32-littlearm")
-OUTPUT_ARCH(arm)
-MEMORY
-{
- DATA (rw) : ORIGIN = 0x00200000, LENGTH = 0x00010000
-}
-ENTRY(_start)
-SECTIONS
-{
- .text :
- {
- *(.init)
- *(.text)
- } > DATA = 0
-
- . = ALIGN(4);
- .rodata :
- {
- *(.rodata)
- } > DATA
-
- . = ALIGN(4);
- .data :
- {
- *(.data)
- } > DATA
-
- . = ALIGN(4);
- __bss_start = .;
- .bss :
- {
- *(.bss)
- } > DATA
- __bss_end = .;
-
- _end = .;
-}
diff --git a/bsp/sam7x/sam7x_rom.ld b/bsp/sam7x/sam7x_rom.ld
new file mode 100644
index 0000000000..41522bc2cd
--- /dev/null
+++ b/bsp/sam7x/sam7x_rom.ld
@@ -0,0 +1,100 @@
+OUTPUT_FORMAT("elf32-littlearm", "elf32-littlearm", "elf32-littlearm")
+OUTPUT_ARCH(arm)
+MEMORY
+{
+ CODE (rx) : ORIGIN = 0x00100000, LENGTH = 0x00040000
+ /* DATA (rw) : ORIGIN = 0x00200000, LENGTH = 0x00010000 */
+ DATA (rw) : ORIGIN = 0x00204000, LENGTH = 0x0000C000
+}
+ENTRY(_start)
+SECTIONS
+{
+ .text :
+ {
+ *(.init)
+ *(.text)
+ *(.rodata)
+
+ /* section information for finsh shell */
+ . = ALIGN(4);
+ __fsymtab_start = .;
+ KEEP(*(FSymTab))
+ __fsymtab_end = .;
+ . = ALIGN(4);
+ __vsymtab_start = .;
+ KEEP(*(VSymTab))
+ __vsymtab_end = .;
+ . = ALIGN(4);
+
+ } > CODE = 0
+
+ . = ALIGN(4);
+ .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
+
+ /* .ARM.exidx is sorted, so has to go in its own output section. */
+ __exidx_start = .;
+ .ARM.exidx :
+ {
+ *(.ARM.exidx* .gnu.linkonce.armexidx.*)
+
+ /* This is used by the startup in order to initialize the .data secion */
+ _sidata = .;
+ } > CODE
+ __exidx_end = .;
+
+ /* .data section which is used for initialized data */
+ .data : AT (_sidata)
+ {
+ . = ALIGN(4);
+ /* This is used by the startup in order to initialize the .data secion */
+ _sdata = . ;
+
+ *(.data)
+ *(.data.*)
+ *(.gnu.linkonce.d*)
+
+ . = ALIGN(4);
+ /* This is used by the startup in order to initialize the .data secion */
+ _edata = . ;
+ } >DATA
+ __data_end = .;
+
+ .noinit :
+ {
+ *(.bss.noinit)
+ } > DATA
+
+ __bss_start = .;
+ .bss :
+ {
+ . = ALIGN(4);
+ /* This is used by the startup in order to initialize the .bss secion */
+ _sbss = .;
+
+ *(.bss)
+ *(COMMON)
+
+ . = ALIGN(4);
+ /* This is used by the startup in order to initialize the .bss secion */
+ _ebss = . ;
+ _estack = .;
+ } > DATA
+ __bss_end = .;
+
+ _end = .;
+
+}
diff --git a/bsp/sam7x/sam7x_rom.lds b/bsp/sam7x/sam7x_rom.lds
deleted file mode 100644
index 12acf4b547..0000000000
--- a/bsp/sam7x/sam7x_rom.lds
+++ /dev/null
@@ -1,50 +0,0 @@
-OUTPUT_FORMAT("elf32-littlearm", "elf32-littlearm", "elf32-littlearm")
-OUTPUT_ARCH(arm)
-MEMORY
-{
- CODE (rx) : ORIGIN = 0x00100000, LENGTH = 0x00040000
- DATA (rw) : ORIGIN = 0x00200000, LENGTH = 0x00010000
-}
-ENTRY(_start)
-SECTIONS
-{
- .text :
- {
- *(.init)
- *(.text)
-
- /* section information for finsh shell */
- . = ALIGN(4);
- __fsymtab_start = .;
- KEEP(*(FSymTab))
- __fsymtab_end = .;
- . = ALIGN(4);
- __vsymtab_start = .;
- KEEP(*(VSymTab))
- __vsymtab_end = .;
- . = ALIGN(4);
-
- } > CODE = 0
-
- . = ALIGN(4);
- .rodata :
- {
- *(.rodata)
- } > CODE
-
- . = ALIGN(4);
- .data :
- {
- *(.data)
- } > DATA
-
- . = ALIGN(4);
- __bss_start = .;
- .bss :
- {
- *(.bss)
- } > DATA
- __bss_end = .;
-
- _end = .;
-}
diff --git a/bsp/sam7x/startup.c b/bsp/sam7x/startup.c
index 513c9244f9..abf9b58c51 100644
--- a/bsp/sam7x/startup.c
+++ b/bsp/sam7x/startup.c
@@ -15,16 +15,16 @@
#include <rthw.h>
#include <rtthread.h>
-#include "board.h"
+#include "board.h"
-#ifdef RT_USING_DFS
-#include "sd.h"
-#endif
-
-#ifdef RT_USING_LWIP
-#include "sam7x_emac.h"
-extern rt_err_t eth_system_device_init(void);
-#endif
+#ifdef RT_USING_DFS
+#include "sd.h"
+#endif
+
+#ifdef RT_USING_LWIP
+#include "sam7x_emac.h"
+extern rt_err_t eth_system_device_init(void);
+#endif
#ifdef RT_USING_FINSH
#include <finsh.h>
@@ -113,16 +113,9 @@ void rtthread_startup(void)
/* init hardware serial device */
rt_hw_serial_init();
-#ifdef RT_USING_LWIP
- eth_system_device_init();
-
- /* register AT91 EMAC device */
- sam7xether_register("E0");
-#endif
-
-#ifdef RT_USING_DFS
- rt_hw_sdcard_init();
-#endif
+#ifdef RT_USING_DFS
+ rt_hw_sdcard_init();
+#endif
/*init all registed devices*/
rt_device_init_all();
@@ -147,6 +140,7 @@ void rtthread_startup(void)
return ;
}
+#ifdef __CC_ARM
int main (void)
{
/* invoke rtthread_startup */
@@ -154,5 +148,6 @@ int main (void)
return 0;
}
+#endif
/*@}*/