mirror of
https://github.com/RT-Thread/rt-thread.git
synced 2026-10-07 00:59:00 +08:00
porting for microblaze. nl1031
git-svn-id: https://rt-thread.googlecode.com/svn/trunk@1843 bbd45198-f89e-11dd-88c7-29a3b14d5316
This commit is contained in:
Executable
+26
@@ -0,0 +1,26 @@
|
||||
/*
|
||||
* File : app.c
|
||||
* This file is part of RT-Thread RTOS
|
||||
* COPYRIGHT (C) 2006, RT-Thread Development Team
|
||||
*
|
||||
* The license and distribution terms for this file may be
|
||||
* found in the file LICENSE in this distribution or at
|
||||
* http://www.rt-thread.org/license/LICENSE
|
||||
*
|
||||
* Change Logs:
|
||||
* Date Author Notes
|
||||
* 2006-06-05 Bernard the first version
|
||||
*/
|
||||
|
||||
/**
|
||||
* @addtogroup sam7s
|
||||
*/
|
||||
/*@{*/
|
||||
#include <rtthread.h>
|
||||
|
||||
int rt_application_init()
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
/*@}*/
|
||||
Executable
+232
File diff suppressed because it is too large
Load Diff
Executable
+22
@@ -0,0 +1,22 @@
|
||||
/*
|
||||
* File : board.h
|
||||
* This file is part of RT-Thread RTOS
|
||||
* COPYRIGHT (C) 2006, RT-Thread Develop Team
|
||||
*
|
||||
* The license and distribution terms for this file may be
|
||||
* found in the file LICENSE in this distribution or at
|
||||
* http://openlab.rt-thread.com/license/LICENSE
|
||||
*
|
||||
*/
|
||||
|
||||
#ifndef __BOARD_H__
|
||||
#define __BOARD_H__
|
||||
|
||||
|
||||
#define MCK 50000000
|
||||
|
||||
void rt_hw_board_led_on(rt_uint32_t);
|
||||
void rt_hw_board_led_off(rt_uint32_t);
|
||||
void rt_hw_board_init(void);
|
||||
|
||||
#endif
|
||||
Executable
+190
@@ -0,0 +1,190 @@
|
||||
/* RT-Thread config file */
|
||||
#ifndef __RTTHREAD_CFG_H__
|
||||
#define __RTTHREAD_CFG_H__
|
||||
|
||||
#define IDLE_THREAD_STACK_SIZE 2048
|
||||
|
||||
/* RT_NAME_MAX*/
|
||||
#define RT_NAME_MAX 32
|
||||
|
||||
/* RT_ALIGN_SIZE*/
|
||||
#define RT_ALIGN_SIZE 4
|
||||
|
||||
/* PRIORITY_MAX*/
|
||||
#define RT_THREAD_PRIORITY_MAX 32
|
||||
|
||||
/* Tick per Second*/
|
||||
#define RT_TICK_PER_SECOND 100
|
||||
|
||||
|
||||
/* SECTION: RT_DEBUG */
|
||||
/* Thread Debug*/
|
||||
/* #define RT_THREAD_DEBUG */
|
||||
|
||||
/* Using Hook*/
|
||||
#define RT_USING_HOOK
|
||||
|
||||
/* SECTION: IPC */
|
||||
/* Using Semaphore*/
|
||||
#define RT_USING_SEMAPHORE
|
||||
|
||||
/* Using Mutex*/
|
||||
#define RT_USING_MUTEX
|
||||
|
||||
/* Using Event*/
|
||||
#define RT_USING_EVENT
|
||||
|
||||
/* Using Faset Event*/
|
||||
/* #define RT_USING_FASTEVENT */
|
||||
|
||||
/* Using MailBox*/
|
||||
#define RT_USING_MAILBOX
|
||||
|
||||
/* Using Message Queue*/
|
||||
#define RT_USING_MESSAGEQUEUE
|
||||
|
||||
/* SECTION: Memory Management */
|
||||
/* Using Memory Pool Management*/
|
||||
#define RT_USING_MEMPOOL
|
||||
|
||||
/* Using Dynamic Heap Management*/
|
||||
#define RT_USING_HEAP
|
||||
|
||||
/* Using Small MM*/
|
||||
#define RT_USING_SMALL_MEM
|
||||
|
||||
/* Using SLAB Allocator*/
|
||||
/* #define RT_USING_SLAB */
|
||||
|
||||
/* SECTION: Device System */
|
||||
/* Using Device System*/
|
||||
#define RT_USING_DEVICE
|
||||
|
||||
/* buffer size for UART reception*/
|
||||
#define RT_UART_RX_BUFFER_SIZE 64
|
||||
|
||||
/* buffer size for UART transmission*/
|
||||
#define RT_UART_TX_BUFFER_SIZE 64
|
||||
|
||||
/* Using UART1*/
|
||||
#define RT_USING_UART1
|
||||
|
||||
/* Using UART1*/
|
||||
/* #define RT_USING_UART2 */
|
||||
|
||||
/* Using UART1*/
|
||||
/* #define RT_USING_UART3 */
|
||||
|
||||
/* SECTION: Console options */
|
||||
#define RT_USING_CONSOLE
|
||||
/* the buffer size of console*/
|
||||
#define RT_CONSOLEBUF_SIZE 256
|
||||
|
||||
/* SECTION: FinSH shell options */
|
||||
/* Using FinSH as Shell*/
|
||||
#define RT_USING_FINSH
|
||||
/* use symbol table */
|
||||
#define FINSH_USING_SYMTAB
|
||||
#define FINSH_USING_DESCRIPTION
|
||||
#define FINSH_THREAD_STACK_SIZE 8192
|
||||
#define RT_USING_TC
|
||||
|
||||
|
||||
/* SECTION: a runtime libc library */
|
||||
/* a runtime libc library*/
|
||||
/* #define RT_USING_NEWLIB */
|
||||
#define RT_USING_MINILIBC
|
||||
|
||||
/* SECTION: C++ support */
|
||||
/* Using C++ support*/
|
||||
/* #define RT_USING_CPLUSPLUS */
|
||||
|
||||
/* SECTION: RTGUI support */
|
||||
/* using RTGUI support*/
|
||||
/* #define RT_USING_RTGUI */
|
||||
|
||||
/* SECTION: Device filesystem support */
|
||||
/* using DFS support*/
|
||||
/* #define RT_USING_DFS */
|
||||
|
||||
/* SECTION: EFSL filesystem support */
|
||||
/* using EFSL filesystem support*/
|
||||
/* #define RT_USING_EFSL */
|
||||
|
||||
/* SECTION: lwip, a lighwight TCP/IP protocol stack */
|
||||
/* Using lighweight TCP/IP protocol stack*/
|
||||
/* #define RT_USING_LWIP */
|
||||
|
||||
/* Using webserver goahead support*/
|
||||
/* #define RT_USING_WEBSERVER */
|
||||
|
||||
/* Using ftpserver support*/
|
||||
/* #define RT_USING_FTPSERVER */
|
||||
|
||||
/* Trace LwIP protocol*/
|
||||
/* #define RT_LWIP_DEBUG */
|
||||
|
||||
/* Enable ICMP protocol*/
|
||||
#define RT_LWIP_ICMP
|
||||
|
||||
/* Enable IGMP protocol*/
|
||||
#define RT_LWIP_IGMP
|
||||
|
||||
/* Enable UDP protocol*/
|
||||
#define RT_LWIP_UDP
|
||||
|
||||
/* Enable TCP protocol*/
|
||||
#define RT_LWIP_TCP
|
||||
|
||||
/* the number of simulatenously active TCP connections*/
|
||||
#define RT_LWIP_TCP_PCB_NUM 5
|
||||
|
||||
/* TCP sender buffer space*/
|
||||
#define RT_LWIP_TCP_SND_BUF 10240
|
||||
|
||||
/* Enable SNMP protocol*/
|
||||
/* #define RT_LWIP_SNMP */
|
||||
|
||||
/* Using DHCP*/
|
||||
/* #define RT_LWIP_DHCP */
|
||||
|
||||
/* ip address of target*/
|
||||
#define RT_LWIP_IPADDR0 192
|
||||
#define RT_LWIP_IPADDR1 168
|
||||
#define RT_LWIP_IPADDR2 0
|
||||
#define RT_LWIP_IPADDR3 30
|
||||
|
||||
/* gateway address of target*/
|
||||
#define RT_LWIP_GWADDR0 192
|
||||
#define RT_LWIP_GWADDR1 168
|
||||
#define RT_LWIP_GWADDR2 0
|
||||
#define RT_LWIP_GWADDR3 1
|
||||
|
||||
/* mask address of target*/
|
||||
#define RT_LWIP_MSKADDR0 255
|
||||
#define RT_LWIP_MSKADDR1 255
|
||||
#define RT_LWIP_MSKADDR2 255
|
||||
#define RT_LWIP_MSKADDR3 0
|
||||
|
||||
/* the number of blocks for pbuf*/
|
||||
#define RT_LWIP_PBUF_NUM 16
|
||||
|
||||
/* thread priority of tcpip thread*/
|
||||
#define RT_LWIP_TCPTHREAD_PRIORITY 128
|
||||
|
||||
/* mail box size of tcpip thread to wait for*/
|
||||
#define RT_LWIP_TCPTHREAD_MBOX_SIZE 8
|
||||
|
||||
/* thread stack size of tcpip thread*/
|
||||
#define RT_LWIP_TCPTHREAD_STACKSIZE 4096
|
||||
|
||||
/* thread priority of ethnetif thread*/
|
||||
#define RT_LWIP_ETHTHREAD_PRIORITY 144
|
||||
|
||||
/* mail box size of ethnetif thread to wait for*/
|
||||
#define RT_LWIP_ETHTHREAD_MBOX_SIZE 32
|
||||
|
||||
/* thread stack size of ethnetif thread*/
|
||||
#define RT_LWIP_ETHTHREAD_STACKSIZE 1024
|
||||
|
||||
#endif
|
||||
Executable
+120
@@ -0,0 +1,120 @@
|
||||
/*
|
||||
* File : startup.c
|
||||
* This file is part of RT-Thread RTOS
|
||||
* COPYRIGHT (C) 2006, RT-Thread Develop Team
|
||||
*
|
||||
* The license and distribution terms for this file may be
|
||||
* found in the file LICENSE in this distribution or at
|
||||
* http://www.rt-thread.org/license/LICENSE
|
||||
*
|
||||
* Change Logs:
|
||||
* Date Author Notes
|
||||
* 2006-08-31 Bernard first implementation
|
||||
* 2011-12-17 nl1031 for MicroBlaze
|
||||
*/
|
||||
|
||||
#include <rthw.h>
|
||||
#include <rtthread.h>
|
||||
|
||||
//#include <AT91SAM7S.h>
|
||||
#include "board.h"
|
||||
|
||||
#ifdef RT_USING_FINSH
|
||||
#include <finsh.h>
|
||||
extern void finsh_system_init(void);
|
||||
#endif
|
||||
|
||||
extern void rt_hw_led_flash(void);
|
||||
|
||||
|
||||
/*@{*/
|
||||
#ifdef __CC_ARM
|
||||
extern int Image$$RW_IRAM1$$ZI$$Limit;
|
||||
#endif
|
||||
|
||||
#ifdef __GNUC__
|
||||
extern unsigned char __bss_start;
|
||||
extern unsigned char __bss_end;
|
||||
#endif
|
||||
|
||||
extern void rt_hw_interrupt_init(void);
|
||||
extern int rt_application_init(void);
|
||||
#ifdef RT_USING_DEVICE
|
||||
extern rt_err_t rt_hw_serial_init(void);
|
||||
#endif
|
||||
|
||||
/**
|
||||
* This function will startup RT-Thread RTOS.
|
||||
*/
|
||||
void rtthread_startup(void)
|
||||
{
|
||||
/* init hardware interrupt */
|
||||
rt_hw_interrupt_init();
|
||||
|
||||
/* init board */
|
||||
rt_hw_board_init();
|
||||
|
||||
rt_show_version();
|
||||
|
||||
/* init tick */
|
||||
rt_system_tick_init();
|
||||
|
||||
/* init kernel object */
|
||||
rt_system_object_init();
|
||||
|
||||
/* init timer system */
|
||||
rt_system_timer_init();
|
||||
|
||||
#ifdef RT_USING_HEAP
|
||||
#ifdef __CC_ARM
|
||||
rt_system_heap_init((void*)&Image$$RW_IRAM1$$ZI$$Limit, (void*)0x204000);
|
||||
#elif __ICCARM__
|
||||
rt_system_heap_init(__segment_end("HEAP"), (void*)0x204000);
|
||||
#else
|
||||
rt_system_heap_init((void*)&__bss_end, (void*)(&__bss_end+0x4000));
|
||||
#endif
|
||||
#endif
|
||||
|
||||
/* init scheduler system */
|
||||
rt_system_scheduler_init();
|
||||
|
||||
#ifdef RT_USING_HOOK /* if the hook is used */
|
||||
/* set idle thread hook */
|
||||
rt_thread_idle_sethook(rt_hw_led_flash);
|
||||
#endif
|
||||
|
||||
//#ifdef RT_USING_DEVICE
|
||||
/* init hardware serial device */
|
||||
rt_hw_serial_init();
|
||||
/* init all device */
|
||||
rt_device_init_all();
|
||||
//#endif
|
||||
|
||||
/* init application */
|
||||
rt_application_init();
|
||||
|
||||
#ifdef RT_USING_FINSH
|
||||
/* init finsh */
|
||||
finsh_system_init();
|
||||
finsh_set_device("uart1");
|
||||
#endif
|
||||
|
||||
/* init idle thread */
|
||||
rt_thread_idle_init();
|
||||
|
||||
/* start scheduler */
|
||||
rt_system_scheduler_start();
|
||||
|
||||
/* never reach here */
|
||||
return ;
|
||||
}
|
||||
|
||||
int main (void)
|
||||
{
|
||||
/* invoke rtthread_startup */
|
||||
rtthread_startup();
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
/*@}*/
|
||||
Executable
+224
File diff suppressed because it is too large
Load Diff
Executable
+35
@@ -0,0 +1,35 @@
|
||||
/*
|
||||
* File : cpu.c
|
||||
* This file is part of RT-Thread RTOS
|
||||
* COPYRIGHT (C) 2006, RT-Thread Develop Team
|
||||
*
|
||||
* The license and distribution terms for this file may be
|
||||
* found in the file LICENSE in this distribution or at
|
||||
* http://www.rt-thread.org/license/LICENSE
|
||||
*
|
||||
* Change Logs:
|
||||
* Date Author Notes
|
||||
* 2006-08-23 Bernard first version
|
||||
*/
|
||||
|
||||
#include <rtthread.h>
|
||||
|
||||
/**
|
||||
* this function will reset CPU
|
||||
*
|
||||
*/
|
||||
void rt_hw_cpu_reset()
|
||||
{
|
||||
}
|
||||
|
||||
/**
|
||||
* this function will shutdown CPU
|
||||
*
|
||||
*/
|
||||
void rt_hw_cpu_shutdown()
|
||||
{
|
||||
rt_kprintf("shutdown...\n");
|
||||
|
||||
while (1);
|
||||
}
|
||||
|
||||
Executable
+116
@@ -0,0 +1,116 @@
|
||||
/*
|
||||
* File : microblaze.inc
|
||||
* This file is part of RT-Thread RTOS
|
||||
* COPYRIGHT (C) 2006, RT-Thread Development Team
|
||||
*
|
||||
* The license and distribution terms for this file may be
|
||||
* found in the file LICENSE in this distribution or at
|
||||
* http://www.rt-thread.org/license/LICENSE
|
||||
*
|
||||
* Change Logs:
|
||||
* Date Author Notes
|
||||
* 2011-12-17 nl1031 first implementation for MicroBlaze.
|
||||
*
|
||||
*/
|
||||
|
||||
|
||||
|
||||
.equ STACK_RMSR, 0x00
|
||||
.equ STACK_R02, 0x04
|
||||
.equ STACK_R03, 0x08
|
||||
.equ STACK_R04, 0x0C
|
||||
.equ STACK_R05, 0x10
|
||||
.equ STACK_R06, 0x14
|
||||
.equ STACK_R07, 0x18
|
||||
.equ STACK_R08, 0x1C
|
||||
.equ STACK_R09, 0x20
|
||||
.equ STACK_R10, 0x24
|
||||
.equ STACK_R11, 0x28
|
||||
.equ STACK_R12, 0x2C
|
||||
.equ STACK_R13, 0x30
|
||||
.equ STACK_R14, 0x34
|
||||
.equ STACK_R15, 0x38
|
||||
.equ STACK_R17, 0x3C
|
||||
.equ STACK_R18, 0x40
|
||||
.equ STACK_R19, 0x44
|
||||
.equ STACK_R20, 0x48
|
||||
.equ STACK_R21, 0x4C
|
||||
.equ STACK_R22, 0x50
|
||||
.equ STACK_R23, 0x54
|
||||
.equ STACK_R24, 0x58
|
||||
.equ STACK_R25, 0x5C
|
||||
.equ STACK_R26, 0x60
|
||||
.equ STACK_R27, 0x64
|
||||
.equ STACK_R28, 0x68
|
||||
.equ STACK_R29, 0x6C
|
||||
.equ STACK_R30, 0x70
|
||||
.equ STACK_R31, 0x74
|
||||
|
||||
.equ STACK_SIZE, 0x78
|
||||
.equ IE_BIT, 0x02
|
||||
|
||||
.macro PUSH_ALL
|
||||
ADDIK r1, r1, -STACK_SIZE
|
||||
SWI r2, r1, STACK_R02
|
||||
SWI r3, r1, STACK_R03
|
||||
SWI r4, r1, STACK_R04
|
||||
SWI r5, r1, STACK_R05
|
||||
SWI r6, r1, STACK_R06
|
||||
SWI r7, r1, STACK_R07
|
||||
SWI r8, r1, STACK_R08
|
||||
SWI r9, r1, STACK_R09
|
||||
SWI r10, r1, STACK_R10
|
||||
SWI r11, r1, STACK_R11
|
||||
SWI r12, r1, STACK_R12
|
||||
SWI r13, r1, STACK_R13
|
||||
SWI r14, r1, STACK_R14
|
||||
SWI r15, r1, STACK_R15
|
||||
SWI r17, r1, STACK_R17
|
||||
SWI r18, r1, STACK_R18
|
||||
SWI r19, r1, STACK_R19
|
||||
SWI r20, r1, STACK_R20
|
||||
SWI r21, r1, STACK_R21
|
||||
SWI r22, r1, STACK_R22
|
||||
SWI r23, r1, STACK_R23
|
||||
SWI r24, r1, STACK_R24
|
||||
SWI r25, r1, STACK_R25
|
||||
SWI r26, r1, STACK_R26
|
||||
SWI r27, r1, STACK_R27
|
||||
SWI r28, r1, STACK_R28
|
||||
SWI r29, r1, STACK_R29
|
||||
SWI r30, r1, STACK_R30
|
||||
SWI r31, r1, STACK_R31
|
||||
.endm
|
||||
|
||||
.macro POP_ALL
|
||||
LWI r31, r1, STACK_R31
|
||||
LWI r30, r1, STACK_R30
|
||||
LWI r29, r1, STACK_R29
|
||||
LWI r28, r1, STACK_R28
|
||||
LWI r27, r1, STACK_R27
|
||||
LWI r26, r1, STACK_R26
|
||||
LWI r25, r1, STACK_R25
|
||||
LWI r24, r1, STACK_R24
|
||||
LWI r23, r1, STACK_R23
|
||||
LWI r22, r1, STACK_R22
|
||||
LWI r21, r1, STACK_R21
|
||||
LWI r20, r1, STACK_R20
|
||||
LWI r19, r1, STACK_R19
|
||||
LWI r18, r1, STACK_R18
|
||||
LWI r17, r1, STACK_R17
|
||||
LWI r15, r1, STACK_R15
|
||||
LWI r14, r1, STACK_R14
|
||||
LWI r13, r1, STACK_R13
|
||||
LWI r12, r1, STACK_R12
|
||||
LWI r11, r1, STACK_R11
|
||||
LWI r10, r1, STACK_R10
|
||||
LWI r9, r1, STACK_R09
|
||||
LWI r8, r1, STACK_R08
|
||||
LWI r7, r1, STACK_R07
|
||||
LWI r6, r1, STACK_R06
|
||||
LWI r5, r1, STACK_R05
|
||||
LWI r4, r1, STACK_R04
|
||||
LWI r3, r1, STACK_R03
|
||||
LWI r2, r1, STACK_R02
|
||||
.endm
|
||||
|
||||
Executable
+310
File diff suppressed because it is too large
Load Diff
Executable
+6
@@ -0,0 +1,6 @@
|
||||
#ifndef __RT_SERIAL_H__
|
||||
#define __RT_SERIAL_H__
|
||||
#include "xuartlite_l.h"
|
||||
#include "xparameters.h"
|
||||
|
||||
#endif
|
||||
Executable
+71
@@ -0,0 +1,71 @@
|
||||
/*
|
||||
* File : stack.c
|
||||
* This file is part of RT-Thread RTOS
|
||||
* COPYRIGHT (C) 2006, RT-Thread Development Team
|
||||
*
|
||||
* The license and distribution terms for this file may be
|
||||
* found in the file LICENSE in this distribution or at
|
||||
* http://openlab.rt-thread.com/license/LICENSE
|
||||
*
|
||||
* Change Logs:
|
||||
* Date Author Notes
|
||||
* 2011-12-17 nl1031 first implementation for MicroBlaze.
|
||||
*
|
||||
*/
|
||||
#include <rtthread.h>
|
||||
extern void *_SDA_BASE_;
|
||||
extern void *_SDA2_BASE_;
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* This function will initialize thread stack
|
||||
*
|
||||
* @param tentry the entry of thread
|
||||
* @param parameter the parameter of entry
|
||||
* @param stack_addr the beginning stack address
|
||||
* @param texit the function will be called when thread exit
|
||||
*
|
||||
* @return stack address
|
||||
*/
|
||||
rt_uint8_t *rt_hw_stack_init(void *tentry, void *parameter,
|
||||
rt_uint8_t *stack_addr, void *texit)
|
||||
{
|
||||
unsigned long *stk;
|
||||
|
||||
stk = (unsigned long *)stack_addr;
|
||||
stk--;
|
||||
stk--;
|
||||
*stk-- = 0; /* r31 */
|
||||
*stk-- = 0; /* r30 */
|
||||
*stk-- = 0; /* r29 */
|
||||
*stk-- = 0; /* r28 */
|
||||
*stk-- = 0; /* r27 */
|
||||
*stk-- = 0; /* r26 */
|
||||
*stk-- = 0; /* r25 */
|
||||
*stk-- = 0; /* r24 */
|
||||
*stk-- = 0; /* r23 */
|
||||
*stk-- = 0; /* r22 */
|
||||
*stk-- = 0; /* r21 */
|
||||
*stk-- = 0; /* r20 */
|
||||
*stk-- = 0; /* r19 */
|
||||
*stk-- = 0; /* r18 */
|
||||
*stk-- = 0; /* r17 */
|
||||
*stk-- = (unsigned long)texit; /* r15 = task return address*/
|
||||
*stk-- = (unsigned long)tentry; /* r14 = entry address*/
|
||||
*stk-- = (unsigned long)&_SDA_BASE_; /* r13 */
|
||||
*stk-- = 0; /* r12 */
|
||||
*stk-- = 0; /* r11 */
|
||||
*stk-- = 0; /* r10 */
|
||||
*stk-- = 0; /* r09 */
|
||||
*stk-- = 0; /* r08 */
|
||||
*stk-- = 0; /* r07 */
|
||||
*stk-- = 0; /* r06 */
|
||||
*stk-- = (unsigned long) parameter; /* r05 */
|
||||
*stk-- = 0; /* r04 */
|
||||
*stk-- = 0; /* r03 */
|
||||
*stk-- = (unsigned long)&_SDA2_BASE_; /* r02 */
|
||||
*stk = 2; /* enable interrupt */
|
||||
return (rt_uint8_t *)stk;
|
||||
}
|
||||
|
||||
Executable
+211
File diff suppressed because it is too large
Load Diff
Reference in New Issue
Block a user