资源简介
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加密算法
- 下一篇:旋转编码器解码程序
相关资源
- IAR FOR 430 破解工具
- IAR For ARM 7.3最新注册机
- IAR7.20H破解机注册机
- IAR ARM 7.8破解
- IAR 7.80.4的安装包
- IAR for MSP430 v7.10.1 注册机
- IAR-Keygen-2019+附使用教程.zip
- IAR 7.3 注册机
- IAR For ARM V5.5 注册机
- IAR for ARM 7.40 破解
- IAR For ARM 7.4 破解
- STM8S例程,基于IAR下的STM8S例程
- 在IAR环境下,lpc1788用户程序的地址及
- IAR破解已验证可破解最新版本EWARM-C
- 最新IAR 6.3破解
- IAR 全系列软件注册机(20100615)
- IAR EW430连接仿真器在线仿真
- Synthesis and photophysical properties of star
- IAR各个版本最新版注册机含安装文档
- IAR Offline License Generator v1.4 by unis
- iar 工程转成vs2010工程
- STM8L051 低功耗运行模式 库函数例程
- STM8L051.串口接收IDLE中断.zip
- IAREW8051_8.20.2
- STM8L 硬件IIC主机
- IAR For ARM 7.8破解版 注册机
- IAR10.10破解文件.rar
- IAR For ARM 7.8 破解
- IAR For ARM 7.7 破解 绿色版
- IAR+for+STM8+ 破解
评论
共有 条评论