资源简介
rtthread 原工程项目下只有keil下的启动文件和bsp,这里贡献iar下的bsp 希望能帮助使用IAR开发项目的朋友。
代码片段和文件信息
/*
* File : cpuport.c
* This file is part of RT-Thread RTOS
* COPYRIGHT (C) 2009 - 2011 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-06-15 aozima the first version for lpc214x
* 2013-03-29 aozima Modify the interrupt interface implementations.
*/
#include
#include
#include “lpc214x.h“
#define MAX_HANDLERS 32
#define SVCMODE 0x13
extern rt_uint32_t rt_interrupt_nest;
/* exception and interrupt handler table */
struct rt_irq_desc irq_desc[MAX_HANDLERS];
/**
* @addtogroup LPC214x
*/
/*@{*/
/**
* 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) = (unsigned long)tentry&0xFFFFFFFE; /* entry point */
*(--stk) = (unsigned long)texit; /* lr */
*(--stk) = 0; /* r12 */
*(--stk) = 0; /* r11 */
*(--stk) = 0; /* r10 */
*(--stk) = 0; /* r9 */
*(--stk) = 0; /* r8 */
*(--stk) = 0; /* r7 */
*(--stk) = 0; /* r6 */
*(--stk) = 0; /* r5 */
*(--stk) = 0; /* r4 */
*(--stk) = 0; /* r3 */
*(--stk) = 0; /* r2 */
*(--stk) = 0; /* r1 */
*(--stk) = (unsigned long)parameter; /* r0 : argument */
/* cpsr */
if ((rt_uint32_t)tentry & 0x01)
*(--stk) = SVCMODE | 0x20; /* thumb mode */
else
*(--stk) = SVCMODE; /* arm mode */
/* return task‘s current stack address */
return (rt_uint8_t *)stk;
}
/* exception and interrupt handler table */
rt_uint32_t rt_interrupt_from_thread rt_interrupt_to_thread;
rt_uint32_t rt_thread_switch_interrupt_flag;
void rt_hw_interrupt_handler(int vector void *param)
{
rt_kprintf(“Unhandled interrupt %d occured!!!\n“ vector);
}
/**
* This function will initialize hardware interrupt
*/
void rt_hw_interrupt_init(void)
{
rt_base_t index;
rt_uint32_t *vect_addr *vect_ctl;
/* initialize VIC*/
VICIntEnClr = 0xffffffff;//clear int
VICVectAddr = 0;//清零向量地址寄存器
/* set all to IRQ */
VICIntSelect = 0;//中断选择寄存器
rt_memset(irq_desc 0x00 sizeof(irq_desc));
for (index = 0; index < MAX_HANDLERS; index ++)
{
irq_desc[index].handler = rt_hw_interrupt_handler;
vect_addr = (rt_uint32_t *)(VIC_base_ADDR + 0x100 + (index << 2));
vect_ctl = (rt_uint32_t *)(VIC_base_ADDR + 0x200 + (index << 2));
*vect_addr = (rt_uint32_t)&irq_desc[index];
*vect_ctl = 0xF;
}
/* init in
属性 大小 日期 时间 名称
----------- --------- ---------- ----- ----
文件 3099 2014-01-06 22:38 lpc213x\context_gcc.S
文件 5170 2014-06-14 15:04 lpc213x\context_iar.S
文件 5150 2014-06-13 11:28 lpc213x\cpuport.c
文件 21596 2014-01-06 22:38 lpc213x\lpc214x.h
文件 10191 2014-01-06 22:38 lpc213x\startup_gcc.S
文件 5260 2014-06-14 16:26 lpc213x\start_iar.S
目录 0 2014-06-20 13:18 lpc213x
----------- --------- ---------- ----- ----
50466 7
- 上一篇:新版正方教务系统rsa加密算法
- 下一篇:旋转编码器解码程序
相关资源
- avr IAR 控制步进电机正反快慢转
- IAR for STM8 3.10.4汉化补丁
- STM32F103用IAR编译的工程模板
- 8.11.1版本IAR+破解文件
- IAR for STM8 3.10.4汉化
- IAR kegen PartA810 IAR for ZigBee8.10版注册机
-
IAR em
bedded Workbench for 8051 7.60 破解 - IAR for ARM 7.6 安装文件+和谐文件
- IAR5.4环境下调试ARM S3C2440的完整工程
- IAR EW8051 V8.10.3程序和注册机
- iar for 8051 v9.30.1 带安装和破解文件
- IAR for ARM 7701 7702 7801-7804-12495
- IAR EW8051 7.51A注册机本人试过,绝对是
- ZigBee点到点通信源码
- iar破解安装包.rar
- GPIO输出控制实验-控制Led亮灭
- IAR EW430软件的安装
- StreamChange.rar
- iar for 8051 v9.30破解
- gt911-driver.rar
- IAR6.3 的破解
- STM8S103定时器1多模式输出PWMCH3单通道
- IAR for 8.10
- IARforarm8.32.1.txt
- IARSystems.rar
- iar for arm 注册机 6.30.1版可用
- iar 8.50 patcher
- IAR 8.10.1链接 及破解器
- IAR for ARM 6.1 - 6.3 万能破解包KEYGEN
- IAR for ARM 8506修复工具
评论
共有 条评论