# ARM 7 from STM

**URL:** <https://forums.freertos.org/t/arm-7-from-stm/3474>\
**Category:** Kernel\
**Created:** [February 4, 2005, 12:38pm UTC](https://forums.freertos.org/t/arm-7-from-stm/3474 "2005-02-04T12:38:31Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![system](https://d2v6vdsk2p900z.cloudfront.net/original/1X/7fc8fdb729c645aab5b20282bbe34e57cb407be6.jpeg) [@system](https://forums.freertos.org/u/system)\
**Post date:** [February 4, 2005, 12:38pm UTC](https://forums.freertos.org/t/arm-7-from-stm/3474/1 "2005-02-04T12:38:31Z")

</div>

**nobody** wrote on [Friday, February 04, 2005](https://sourceforge.net/p/freertos/discussion/382005/thread/9ae65ca8/#fb29):

Has anyone done a port of FreeRTOS to the new ARM 7 family (STR71x) from STMicroelectronics ?

---

<div class="post-metadata">

**Author:** ![system](https://d2v6vdsk2p900z.cloudfront.net/original/1X/7fc8fdb729c645aab5b20282bbe34e57cb407be6.jpeg) [@system](https://forums.freertos.org/u/system)\
**Post date:** [February 4, 2005, 2:11pm UTC](https://forums.freertos.org/t/arm-7-from-stm/3474/2 "2005-02-04T14:11:29Z")

</div>

**nobody** wrote on [Friday, February 04, 2005](https://sourceforge.net/p/freertos/discussion/382005/thread/9ae65ca8/#fb29/566b):

I’m not aware of any.&nbsp;

Which compiler are you wanting to use?&nbsp; If a port for that compiler already exists then it should just be a matter of writting the memory map (linker script) and peripheral setup routines.

---

<div class="post-metadata">

**Author:** ![system](https://d2v6vdsk2p900z.cloudfront.net/original/1X/7fc8fdb729c645aab5b20282bbe34e57cb407be6.jpeg) [@system](https://forums.freertos.org/u/system)\
**Post date:** [February 4, 2005, 3:47pm UTC](https://forums.freertos.org/t/arm-7-from-stm/3474/3 "2005-02-04T15:47:32Z")

</div>

**nobody** wrote on [Friday, February 04, 2005](https://sourceforge.net/p/freertos/discussion/382005/thread/9ae65ca8/#fb29/8f79):

I’m using a Keil compiler.  
I already tried to port to my uC with the actual port of LPC21xx from philips.  
The memory mapping is checked, but my problems were with software interrupts and mode for the context switching…

---

<div class="post-metadata">

**Author:** ![system](https://d2v6vdsk2p900z.cloudfront.net/original/1X/7fc8fdb729c645aab5b20282bbe34e57cb407be6.jpeg) [@system](https://forums.freertos.org/u/system)\
**Post date:** [February 4, 2005, 4:10pm UTC](https://forums.freertos.org/t/arm-7-from-stm/3474/4 "2005-02-04T16:10:19Z")

</div>

**nobody** wrote on [Friday, February 04, 2005](https://sourceforge.net/p/freertos/discussion/382005/thread/9ae65ca8/#fb29/8f79/3c5a):

Here are a few pointers.

----

Check the startup code [it can be compared to that for the lpc2000 demo].&nbsp; Make sure that the stacks are all configured correctly.&nbsp; Here are some suggested sizes.

&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; UND\_Stack\_Size&nbsp; EQU&nbsp;&nbsp;&nbsp;&nbsp; 0x00000004  
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; SVC\_Stack\_Size&nbsp; EQU&nbsp;&nbsp;&nbsp;&nbsp; 0x00000100  
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; ABT\_Stack\_Size&nbsp; EQU&nbsp;&nbsp;&nbsp;&nbsp; 0x00000004  
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; FIQ\_Stack\_Size&nbsp; EQU&nbsp;&nbsp;&nbsp;&nbsp; 0x00000004  
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; IRQ\_Stack\_Size&nbsp; EQU&nbsp;&nbsp;&nbsp;&nbsp; 0x00000300  
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; USR\_Stack\_Size&nbsp; EQU&nbsp;&nbsp;&nbsp;&nbsp; 0x00000200

----

You need to install the SWI handler and set the IRQ vector.&nbsp; The LPC2000 port assumes that there is an interrupt controller at PC,[PC, #-0x0FF0] from the IRQ vector.

Vectors:&nbsp;&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bsp;&nbsp;&nbsp;&nbsp; /\* Reserved Address \*/  
IRQ\_Addr:&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; DD&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; IRQ\_Handler?A  
FIQ\_Addr:&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; DD&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; FIQ\_Handler?A

----

Hardware configuration needs consideration.&nbsp; The phase locked loop and interrupt controller are specific to the LPC and may be different on your uC.&nbsp; Also the timer that generates the tick interrupt will require modification to your particular uC peripheral standard.

----

Try starting with the simplest of programs and without using the preemptive scheduler (set portUSE\_PREEMPTION to 0).&nbsp; A sample program would be along the lines of:

void main( void )  
{  
&nbsp;&nbsp;&nbsp; sTaskCreate( TestTask, "test", portMINIMAL\_STACK\_SIZE, NULL, 0, NULL );  
&nbsp;&nbsp;&nbsp; vTaskStartScheduler( portUSE\_PREEMPTION );  
&nbsp;&nbsp;&nbsp;  
&nbsp;&nbsp;&nbsp; /\* Should not get here. \*/  
}

void TestTask( void \*pvParameters )  
{  
&nbsp;&nbsp;&nbsp; for( ;; )  
&nbsp;&nbsp;&nbsp; {  
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; taskYIELD();  
&nbsp;&nbsp;&nbsp; }  
}

You will end up with two tasks.&nbsp; TestTask() and the automatically generated Idle task.&nbsp; Neither block so it does not matter if the RTOS tick is not running.&nbsp; With the cooperative scheduler you should be able to step through the code without the tick interrupting you.&nbsp; Step through the code in the Keil simulator and see how far you get then let us know.&nbsp; When you hit a taskYIELD you should go to the SWI handler.&nbsp; Do you ever get into the first task?

---

<div class="post-metadata">

**Author:** ![system](https://d2v6vdsk2p900z.cloudfront.net/original/1X/7fc8fdb729c645aab5b20282bbe34e57cb407be6.jpeg) [@system](https://forums.freertos.org/u/system)\
**Post date:** [February 7, 2005, 1:51pm UTC](https://forums.freertos.org/t/arm-7-from-stm/3474/5 "2005-02-07T13:51:58Z")

</div>

**nobody** wrote on [Monday, February 07, 2005](https://sourceforge.net/p/freertos/discussion/382005/thread/9ae65ca8/#fb29/433c):

Thank you. That’s worked.
