提交 85a1d2f2 编写于 作者: D dzzxzz

add IAR project for Fujitsu FM3 Easy Kit

running a LED thread

git-svn-id: https://rt-thread.googlecode.com/svn/trunk@1298 bbd45198-f89e-11dd-88c7-29a3b14d5316
上级 91577f18
...@@ -73,8 +73,8 @@ static void ClockInit(void) ...@@ -73,8 +73,8 @@ static void ClockInit(void)
while(!(FM3_CRG->SCM_STR & 0x02)); while(!(FM3_CRG->SCM_STR & 0x02));
/* sub CLK enable */ /* sub CLK enable */
FM3_CRG->SCM_CTL |= 0x08; //FM3_CRG->SCM_CTL |= 0x08;
while(!(FM3_CRG->SCM_STR & 0x08)); //while(!(FM3_CRG->SCM_STR & 0x08));
/*Set PLL stabilization /*Set PLL stabilization
wait time to 512uS*/ wait time to 512uS*/
......
...@@ -18,9 +18,29 @@ ...@@ -18,9 +18,29 @@
/*@{*/ /*@{*/
#include <rtthread.h> #include <rtthread.h>
#include "board.h"
void rt_init_thread_entry(void *parameter)
{
while(1)
{
rt_hw_led_on(LED1);
rt_hw_led_off(LED2);
rt_thread_delay(100);
rt_hw_led_off(LED1);
rt_hw_led_on(LED2);
rt_thread_delay(100);
}
}
int rt_application_init() int rt_application_init()
{ {
rt_thread_t init_thread;
init_thread = rt_thread_create("init", rt_init_thread_entry, RT_NULL, 1024, 21, 20);
if(init_thread != RT_NULL)
rt_thread_startup(init_thread);
return 0; return 0;
} }
......
...@@ -42,13 +42,60 @@ void rt_hw_timer_handler(void) ...@@ -42,13 +42,60 @@ void rt_hw_timer_handler(void)
rt_interrupt_leave(); rt_interrupt_leave();
} }
void led_init(void)
{
/*Select CPIO function*/
LED_PFR &= ~LED_MASK;
/*Set Pin to turn off leds*/
LED_PDOR |= LED_MASK;
/*Make led pins outputs*/
LED_DDR |= LED_MASK;
}
void rt_hw_led_on(int n)
{
switch(n)
{
case LED1:
LED_PDOR &= ~LED1;
break;
case LED2:
LED_PDOR &= ~LED2;
break;
case LED3:
LED_PDOR &= ~LED3;
break;
default:
break;
}
}
void rt_hw_led_off(int n)
{
switch(n)
{
case LED1:
LED_PDOR |= LED1;
break;
case LED2:
LED_PDOR |= LED2;
break;
case LED3:
LED_PDOR |= LED3;
break;
default:
break;
}
}
/** /**
* This function will initial LPC17xx board. * This function will initial FM3 Easy Kit board.
*/ */
void rt_hw_board_init() void rt_hw_board_init()
{ {
/* init systick */ led_init();
SysTick_Config(SystemFrequency/RT_TICK_PER_SECOND - 1); /* init systick */
SysTick_Config(SystemFrequency/RT_TICK_PER_SECOND - 1);
} }
/*@}*/ /*@}*/
...@@ -16,6 +16,28 @@ ...@@ -16,6 +16,28 @@
#ifndef __BOARD_H__ #ifndef __BOARD_H__
#define __BOARD_H__ #define __BOARD_H__
#include "mb9bf506r.h"
/*LEDs*/
#define LED1 (1UL<<10)
#define LED2 (1UL<<11)
#define LED3 (1UL<<12)
#define LED_MASK (LED1 | LED2 | LED3)
#define LED_PFR (FM3_GPIO->PFR3)
#define LED_DDR (FM3_GPIO->DDR3)
#define LED_PDOR (FM3_GPIO->PDOR3)
//Internal SRAM memory size[Kbytes] <8-64>
//MB9BF500 : 32
//MB9BF504 : 32
//MB9BF505 : 48
//MB9BF506 : 64
#define FM3_SRAM_SIZE 32
#define FM3_SRAM_END (0x20000000 + FM3_SRAM_SIZE * 1024)
void rt_hw_led_on(int n);
void rt_hw_led_off(int n);
void rt_hw_board_init(void); void rt_hw_board_init(void);
#endif #endif
<?xml version="1.0" encoding="iso-8859-1"?>
<project>
<fileVersion>2</fileVersion>
<fileChecksum>65142411</fileChecksum>
<configuration>
<name>Debug</name>
<outputs>
<file>$PROJ_DIR$\Debug\Obj\ipc.pbi</file>
<file>$PROJ_DIR$\Debug\Obj\mempool.o</file>
<file>$PROJ_DIR$\Debug\Obj\board.pbi</file>
<file>$PROJ_DIR$\Debug\Obj\module.o</file>
<file>$PROJ_DIR$\Debug\Obj\cpuport.o</file>
<file>$PROJ_DIR$\Debug\Obj\clock.pbi</file>
<file>$PROJ_DIR$\Debug\Obj\irq.pbi</file>
<file>$PROJ_DIR$\Debug\Obj\object.o</file>
<file>$PROJ_DIR$\Debug\Obj\device.pbi</file>
<file>$PROJ_DIR$\..\..\include\rthw.h</file>
<file>$PROJ_DIR$\Debug\Obj\slab.pbi</file>
<file>$PROJ_DIR$\Debug\Obj\core_cm3.pbi</file>
<file>$PROJ_DIR$\Debug\Obj\mem.o</file>
<file>$PROJ_DIR$\Debug\Obj\system_mb9bf50x.pbi</file>
<file>$PROJ_DIR$\Debug\Obj\kservice.pbi</file>
<file>$PROJ_DIR$\Debug\Obj\idle.o</file>
<file>$PROJ_DIR$\..\..\include\rtthread.h</file>
<file>$PROJ_DIR$\Debug\Obj\timer.o</file>
<file>$PROJ_DIR$\Debug\Obj\rtm.pbi</file>
<file>$PROJ_DIR$\Debug\Obj\core_cm3.o</file>
<file>$PROJ_DIR$\Debug\Obj\start_iar.o</file>
<file>$PROJ_DIR$\CMSIS\mb9bf506r.h</file>
<file>$PROJ_DIR$\Debug\Obj\application.pbi</file>
<file>$PROJ_DIR$\..\..\include\rtm.h</file>
<file>$PROJ_DIR$\Debug\Obj\kservice.o</file>
<file>$PROJ_DIR$\Debug\Obj\board.o</file>
<file>$PROJ_DIR$\..\..\src\kservice.h</file>
<file>$PROJ_DIR$\Debug\Obj\object.pbi</file>
<file>$PROJ_DIR$\Debug\Obj\module.pbi</file>
<file>$PROJ_DIR$\Debug\Exe\fm3_easy_kit.out</file>
<file>$PROJ_DIR$\Debug\Obj\clock.o</file>
<file>$PROJ_DIR$\Debug\Obj\irq.o</file>
<file>$PROJ_DIR$\Debug\Obj\system_mb9bf50x.o</file>
<file>$PROJ_DIR$\Debug\Obj\cpuport.pbi</file>
<file>$PROJ_DIR$\CMSIS\core_cm3.h</file>
<file>$PROJ_DIR$\Debug\Obj\rtm.o</file>
<file>$PROJ_DIR$\Debug\Obj\thread.pbi</file>
<file>$PROJ_DIR$\board.h</file>
<file>$PROJ_DIR$\Debug\Obj\fm3_easy_kit.pbd</file>
<file>$PROJ_DIR$\Debug\Obj\thread.o</file>
<file>$PROJ_DIR$\Debug\Obj\startup.pbi</file>
<file>$PROJ_DIR$\Debug\Obj\slab.o</file>
<file>$PROJ_DIR$\Debug\Obj\device.o</file>
<file>$PROJ_DIR$\Debug\Obj\timer.pbi</file>
<file>$PROJ_DIR$\Debug\Obj\mempool.pbi</file>
<file>$PROJ_DIR$\Debug\Obj\idle.pbi</file>
<file>$PROJ_DIR$\Debug\Obj\ipc.o</file>
<file>$PROJ_DIR$\Debug\Obj\scheduler.o</file>
<file>$PROJ_DIR$\rtconfig.h</file>
<file>$PROJ_DIR$\CMSIS\core_cmFunc.h</file>
<file>$PROJ_DIR$\CMSIS\system_mb9bf50x.h</file>
<file>$PROJ_DIR$\..\..\include\rtdef.h</file>
<file>$PROJ_DIR$\Debug\Obj\mem.pbi</file>
<file>$PROJ_DIR$\Debug\Obj\context_iar.o</file>
<file>$PROJ_DIR$\Debug\Obj\startup.o</file>
<file>$PROJ_DIR$\CMSIS\core_cmInstr.h</file>
<file>$PROJ_DIR$\Debug\Obj\fault_iar.o</file>
<file>$PROJ_DIR$\Debug\Obj\scheduler.pbi</file>
<file>$PROJ_DIR$\Debug\Obj\application.o</file>
<file>$PROJ_DIR$\CMSIS\core_cm3.c</file>
<file>$PROJ_DIR$\CMSIS\system_mb9bf50x.c</file>
<file>$PROJ_DIR$\..\..\libcpu\arm\fm3\context_iar.S</file>
<file>$PROJ_DIR$\..\..\libcpu\arm\fm3\cpuport.c</file>
<file>$PROJ_DIR$\..\..\libcpu\arm\fm3\fault_iar.S</file>
<file>$PROJ_DIR$\..\..\libcpu\arm\fm3\start_iar.S</file>
<file>$PROJ_DIR$\..\..\src\clock.c</file>
<file>$PROJ_DIR$\..\..\src\device.c</file>
<file>$PROJ_DIR$\..\..\src\idle.c</file>
<file>$PROJ_DIR$\..\..\src\ipc.c</file>
<file>$PROJ_DIR$\..\..\src\irq.c</file>
<file>$PROJ_DIR$\..\..\src\kservice.c</file>
<file>$PROJ_DIR$\..\..\src\mem.c</file>
<file>$PROJ_DIR$\..\..\src\mempool.c</file>
<file>$PROJ_DIR$\..\..\src\module.c</file>
<file>$PROJ_DIR$\..\..\src\object.c</file>
<file>$PROJ_DIR$\..\..\src\rtm.c</file>
<file>$PROJ_DIR$\..\..\src\scheduler.c</file>
<file>$PROJ_DIR$\..\..\src\slab.c</file>
<file>$PROJ_DIR$\..\..\src\thread.c</file>
<file>$PROJ_DIR$\..\..\src\timer.c</file>
<file>$PROJ_DIR$\application.c</file>
<file>$PROJ_DIR$\board.c</file>
<file>$PROJ_DIR$\startup.c</file>
</outputs>
<file>
<name>[ROOT_NODE]</name>
<outputs>
<tool>
<name>ILINK</name>
<file> 29</file>
</tool>
</outputs>
</file>
<file>
<name>$PROJ_DIR$\Debug\Obj\fm3_easy_kit.pbd</name>
<inputs>
<tool>
<name>BILINK</name>
<file> 22 2 5 11 33 8 45 0 6 14 52 44 28 27 18 57 10 40 13 36 43</file>
</tool>
</inputs>
</file>
<file>
<name>$PROJ_DIR$\CMSIS\core_cm3.c</name>
<outputs>
<tool>
<name>ICCARM</name>
<file> 19</file>
</tool>
<tool>
<name>BICOMP</name>
<file> 11</file>
</tool>
</outputs>
</file>
<file>
<name>$PROJ_DIR$\CMSIS\system_mb9bf50x.c</name>
<outputs>
<tool>
<name>ICCARM</name>
<file> 32</file>
</tool>
<tool>
<name>BICOMP</name>
<file> 13</file>
</tool>
</outputs>
<inputs>
<tool>
<name>BICOMP</name>
<file> 21 34 55 49 50</file>
</tool>
</inputs>
</file>
<file>
<name>$PROJ_DIR$\..\..\libcpu\arm\fm3\context_iar.S</name>
<outputs>
<tool>
<name>AARM</name>
<file> 53</file>
</tool>
</outputs>
</file>
<file>
<name>$PROJ_DIR$\..\..\libcpu\arm\fm3\cpuport.c</name>
<outputs>
<tool>
<name>ICCARM</name>
<file> 4</file>
</tool>
<tool>
<name>BICOMP</name>
<file> 33</file>
</tool>
</outputs>
<inputs>
<tool>
<name>BICOMP</name>
<file> 9 16 51 48 21 34 55 49 50</file>
</tool>
</inputs>
</file>
<file>
<name>$PROJ_DIR$\..\..\libcpu\arm\fm3\fault_iar.S</name>
<outputs>
<tool>
<name>AARM</name>
<file> 56</file>
</tool>
</outputs>
</file>
<file>
<name>$PROJ_DIR$\..\..\libcpu\arm\fm3\start_iar.S</name>
<outputs>
<tool>
<name>AARM</name>
<file> 20</file>
</tool>
</outputs>
</file>
<file>
<name>$PROJ_DIR$\..\..\src\clock.c</name>
<outputs>
<tool>
<name>ICCARM</name>
<file> 30</file>
</tool>
<tool>
<name>BICOMP</name>
<file> 5</file>
</tool>
</outputs>
<inputs>
<tool>
<name>BICOMP</name>
<file> 16 51 48</file>
</tool>
</inputs>
</file>
<file>
<name>$PROJ_DIR$\..\..\src\device.c</name>
<outputs>
<tool>
<name>ICCARM</name>
<file> 42</file>
</tool>
<tool>
<name>BICOMP</name>
<file> 8</file>
</tool>
</outputs>
<inputs>
<tool>
<name>BICOMP</name>
<file> 16 51 48 26</file>
</tool>
</inputs>
</file>
<file>
<name>$PROJ_DIR$\..\..\src\idle.c</name>
<outputs>
<tool>
<name>ICCARM</name>
<file> 15</file>
</tool>
<tool>
<name>BICOMP</name>
<file> 45</file>
</tool>
</outputs>
<inputs>
<tool>
<name>BICOMP</name>
<file> 9 16 51 48 26</file>
</tool>
</inputs>
</file>
<file>
<name>$PROJ_DIR$\..\..\src\ipc.c</name>
<outputs>
<tool>
<name>ICCARM</name>
<file> 46</file>
</tool>
<tool>
<name>BICOMP</name>
<file> 0</file>
</tool>
</outputs>
<inputs>
<tool>
<name>BICOMP</name>
<file> 16 51 48 9 26</file>
</tool>
</inputs>
</file>
<file>
<name>$PROJ_DIR$\..\..\src\irq.c</name>
<outputs>
<tool>
<name>ICCARM</name>
<file> 31</file>
</tool>
<tool>
<name>BICOMP</name>
<file> 6</file>
</tool>
</outputs>
<inputs>
<tool>
<name>BICOMP</name>
<file> 9 16 51 48</file>
</tool>
</inputs>
</file>
<file>
<name>$PROJ_DIR$\..\..\src\kservice.c</name>
<outputs>
<tool>
<name>ICCARM</name>
<file> 24</file>
</tool>
<tool>
<name>BICOMP</name>
<file> 14</file>
</tool>
</outputs>
<inputs>
<tool>
<name>BICOMP</name>
<file> 16 51 48 9</file>
</tool>
</inputs>
</file>
<file>
<name>$PROJ_DIR$\..\..\src\mem.c</name>
<outputs>
<tool>
<name>ICCARM</name>
<file> 12</file>
</tool>
<tool>
<name>BICOMP</name>
<file> 52</file>
</tool>
</outputs>
<inputs>
<tool>
<name>BICOMP</name>
<file> 16 51 48</file>
</tool>
</inputs>
</file>
<file>
<name>$PROJ_DIR$\..\..\src\mempool.c</name>
<outputs>
<tool>
<name>ICCARM</name>
<file> 1</file>
</tool>
<tool>
<name>BICOMP</name>
<file> 44</file>
</tool>
</outputs>
<inputs>
<tool>
<name>BICOMP</name>
<file> 9 16 51 48 26</file>
</tool>
</inputs>
</file>
<file>
<name>$PROJ_DIR$\..\..\src\module.c</name>
<outputs>
<tool>
<name>ICCARM</name>
<file> 3</file>
</tool>
<tool>
<name>BICOMP</name>
<file> 28</file>
</tool>
</outputs>
<inputs>
<tool>
<name>BICOMP</name>
<file> 16 51 48 23 26</file>
</tool>
</inputs>
</file>
<file>
<name>$PROJ_DIR$\..\..\src\object.c</name>
<outputs>
<tool>
<name>ICCARM</name>
<file> 7</file>
</tool>
<tool>
<name>BICOMP</name>
<file> 27</file>
</tool>
</outputs>
<inputs>
<tool>
<name>BICOMP</name>
<file> 16 51 48 9 26</file>
</tool>
</inputs>
</file>
<file>
<name>$PROJ_DIR$\..\..\src\rtm.c</name>
<outputs>
<tool>
<name>ICCARM</name>
<file> 35</file>
</tool>
<tool>
<name>BICOMP</name>
<file> 18</file>
</tool>
</outputs>
<inputs>
<tool>
<name>BICOMP</name>
<file> 16 51 48</file>
</tool>
</inputs>
</file>
<file>
<name>$PROJ_DIR$\..\..\src\scheduler.c</name>
<outputs>
<tool>
<name>ICCARM</name>
<file> 47</file>
</tool>
<tool>
<name>BICOMP</name>
<file> 57</file>
</tool>
</outputs>
<inputs>
<tool>
<name>BICOMP</name>
<file> 16 51 48 9 26</file>
</tool>
</inputs>
</file>
<file>
<name>$PROJ_DIR$\..\..\src\slab.c</name>
<outputs>
<tool>
<name>ICCARM</name>
<file> 41</file>
</tool>
<tool>
<name>BICOMP</name>
<file> 10</file>
</tool>
</outputs>
<inputs>
<tool>
<name>BICOMP</name>
<file> 9 16 51 48 26</file>
</tool>
</inputs>
</file>
<file>
<name>$PROJ_DIR$\..\..\src\thread.c</name>
<outputs>
<tool>
<name>ICCARM</name>
<file> 39</file>
</tool>
<tool>
<name>BICOMP</name>
<file> 36</file>
</tool>
</outputs>
<inputs>
<tool>
<name>BICOMP</name>
<file> 16 51 48 9 26</file>
</tool>
</inputs>
</file>
<file>
<name>$PROJ_DIR$\..\..\src\timer.c</name>
<outputs>
<tool>
<name>ICCARM</name>
<file> 17</file>
</tool>
<tool>
<name>BICOMP</name>
<file> 43</file>
</tool>
</outputs>
<inputs>
<tool>
<name>BICOMP</name>
<file> 16 51 48 9 26</file>
</tool>
</inputs>
</file>
<file>
<name>$PROJ_DIR$\application.c</name>
<outputs>
<tool>
<name>ICCARM</name>
<file> 58</file>
</tool>
<tool>
<name>BICOMP</name>
<file> 22</file>
</tool>
</outputs>
<inputs>
<tool>
<name>BICOMP</name>
<file> 16 51 48 37 21 34 55 49 50</file>
</tool>
</inputs>
</file>
<file>
<name>$PROJ_DIR$\board.c</name>
<outputs>
<tool>
<name>ICCARM</name>
<file> 25</file>
</tool>
<tool>
<name>BICOMP</name>
<file> 2</file>
</tool>
</outputs>
<inputs>
<tool>
<name>BICOMP</name>
<file> 9 16 51 48 37 21 34 55 49 50</file>
</tool>
</inputs>
</file>
<file>
<name>$PROJ_DIR$\startup.c</name>
<outputs>
<tool>
<name>ICCARM</name>
<file> 54</file>
</tool>
<tool>
<name>BICOMP</name>
<file> 40</file>
</tool>
</outputs>
<inputs>
<tool>
<name>BICOMP</name>
<file> 9 16 51 48 37 21 34 55 49 50</file>
</tool>
</inputs>
</file>
</configuration>
<configuration>
<name>Release</name>
<outputs/>
<forcedrebuild>
<name>[MULTI_TOOL]</name>
<tool>ILINK</tool>
</forcedrebuild>
</configuration>
</project>
此差异已折叠。
此差异已折叠。
<?xml version="1.0" encoding="iso-8859-1"?>
<workspace>
<project>
<path>$WS_DIR$\fm3_easy_kit.ewp</path>
</project>
<batchBuild/>
</workspace>
/*###ICF### Section handled by ICF editor, don't touch! ****/
/*-Editor annotation file-*/
/* IcfEditorFile="$TOOLKIT_DIR$\config\ide\IcfEditor\cortex_v1_0.xml" */
/*-Specials-*/
define symbol __ICFEDIT_intvec_start__ = 0x00000000;
/*-Memory Regions-*/
define symbol __ICFEDIT_region_ROM_start__ = 0x00000000;
define symbol __ICFEDIT_region_ROM_end__ = 0x0003FFFF;
define symbol __ICFEDIT_region_RAM_start__ = 0x20000000;
define symbol __ICFEDIT_region_RAM_end__ = 0x20007FFF;
/*-Sizes-*/
define symbol __ICFEDIT_size_cstack__ = 0x800;
define symbol __ICFEDIT_size_heap__ = 0x400;
/**** End of ICF editor section. ###ICF###*/
define memory mem with size = 4G;
define region ROM_region = mem:[from __ICFEDIT_region_ROM_start__ to __ICFEDIT_region_ROM_end__];
define region RAM_region = mem:[from __ICFEDIT_region_RAM_start__ to __ICFEDIT_region_RAM_end__];
define block CSTACK with alignment = 8, size = __ICFEDIT_size_cstack__ { };
define block HEAP with alignment = 8, size = __ICFEDIT_size_heap__ { };
initialize by copy { readwrite };
//initialize by copy with packing = none { section __DLIB_PERTHREAD }; // Required in a multi-threaded application
do not initialize { section .noinit };
place at address mem:__ICFEDIT_intvec_start__ { readonly section .intvec };
place in ROM_region { readonly };
place in RAM_region { readwrite,
block CSTACK, block HEAP };
...@@ -16,7 +16,7 @@ ...@@ -16,7 +16,7 @@
#include <rtthread.h> #include <rtthread.h>
#include "board.h" #include "board.h"
#include "mb9bf506r.h"
/** /**
* @addtogroup FM3 * @addtogroup FM3
*/ */
...@@ -55,12 +55,12 @@ void rtthread_startup(void) ...@@ -55,12 +55,12 @@ void rtthread_startup(void)
#ifdef RT_USING_HEAP #ifdef RT_USING_HEAP
#ifdef __CC_ARM #ifdef __CC_ARM
rt_system_heap_init((void*)&Image$$RW_IRAM1$$ZI$$Limit, (void*)0x10008000); rt_system_heap_init((void*)&Image$$RW_IRAM1$$ZI$$Limit, (void*)FM3_SRAM_END);
#elif __ICCARM__ #elif __ICCARM__
rt_system_heap_init(__segment_end("HEAP"), (void*)0x10008000); rt_system_heap_init(__segment_end("HEAP"), (void*)FM3_SRAM_END);
#else #else
/* init memory system */ /* init memory system */
rt_system_heap_init((void*)&__bss_end, (void*)0x10008000); rt_system_heap_init((void*)&__bss_end, (void*)FM3_SRAM_END);
#endif #endif
#endif #endif
...@@ -95,6 +95,9 @@ int main(void) ...@@ -95,6 +95,9 @@ int main(void)
/* disable interrupt first */ /* disable interrupt first */
level = rt_hw_interrupt_disable(); level = rt_hw_interrupt_disable();
/* init system setting */
SystemInit();
/* startup RT-Thread RTOS */ /* startup RT-Thread RTOS */
rtthread_startup(); rtthread_startup();
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册