mirror of
https://github.com/RT-Thread/rt-thread.git
synced 2026-09-21 02:06:14 +08:00
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
This commit is contained in:
@@ -73,8 +73,8 @@ static void ClockInit(void)
|
||||
while(!(FM3_CRG->SCM_STR & 0x02));
|
||||
|
||||
/* sub CLK enable */
|
||||
FM3_CRG->SCM_CTL |= 0x08;
|
||||
while(!(FM3_CRG->SCM_STR & 0x08));
|
||||
//FM3_CRG->SCM_CTL |= 0x08;
|
||||
//while(!(FM3_CRG->SCM_STR & 0x08));
|
||||
|
||||
/*Set PLL stabilization
|
||||
wait time to 512uS*/
|
||||
|
||||
@@ -18,9 +18,29 @@
|
||||
/*@{*/
|
||||
|
||||
#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()
|
||||
{
|
||||
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;
|
||||
}
|
||||
|
||||
|
||||
+50
-3
@@ -42,13 +42,60 @@ void rt_hw_timer_handler(void)
|
||||
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()
|
||||
{
|
||||
/* init systick */
|
||||
SysTick_Config(SystemFrequency/RT_TICK_PER_SECOND - 1);
|
||||
led_init();
|
||||
/* init systick */
|
||||
SysTick_Config(SystemFrequency/RT_TICK_PER_SECOND - 1);
|
||||
}
|
||||
|
||||
/*@}*/
|
||||
|
||||
@@ -16,6 +16,28 @@
|
||||
#ifndef __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);
|
||||
|
||||
#endif
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,10 @@
|
||||
<?xml version="1.0" encoding="iso-8859-1"?>
|
||||
|
||||
<workspace>
|
||||
<project>
|
||||
<path>$WS_DIR$\fm3_easy_kit.ewp</path>
|
||||
</project>
|
||||
<batchBuild/>
|
||||
</workspace>
|
||||
|
||||
|
||||
@@ -0,0 +1,32 @@
|
||||
/*###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 };
|
||||
+7
-4
@@ -16,7 +16,7 @@
|
||||
#include <rtthread.h>
|
||||
|
||||
#include "board.h"
|
||||
|
||||
#include "mb9bf506r.h"
|
||||
/**
|
||||
* @addtogroup FM3
|
||||
*/
|
||||
@@ -55,12 +55,12 @@ void rtthread_startup(void)
|
||||
|
||||
#ifdef RT_USING_HEAP
|
||||
#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__
|
||||
rt_system_heap_init(__segment_end("HEAP"), (void*)0x10008000);
|
||||
rt_system_heap_init(__segment_end("HEAP"), (void*)FM3_SRAM_END);
|
||||
#else
|
||||
/* 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
|
||||
|
||||
@@ -95,6 +95,9 @@ int main(void)
|
||||
/* disable interrupt first */
|
||||
level = rt_hw_interrupt_disable();
|
||||
|
||||
/* init system setting */
|
||||
SystemInit();
|
||||
|
||||
/* startup RT-Thread RTOS */
|
||||
rtthread_startup();
|
||||
|
||||
|
||||
Reference in New Issue
Block a user