This article is a Series on FreeRTOS tutorials and carries the discussion on FreeRTOS and its usage. The aim of this series is to provide easy and practical examples that anyone can understand. Today we are going to see FreeRTOS Porting for LPC2148 Using Keil.
You can also read the RTOS Basic concepts and Advanced concepts.
Table of Contents
Requirement
- Keil IDE for ARM – Download Here
- FreeRTOS Exe File – Download Here
- FreeRTOSConfig.h – Download Here
- Startup.s – Download Here
FreeRTOS Porting for LPC2148 Using Keil
I assumed that you already installed Keil IDE for ARM and you know how to create a project in that. If you don’t know please See here. Now we will start.
Initial Steps(Installing Time)
NOTE: These two steps are required for the First time (Installation time). Not required for each time project creating.
1. Extract the FreeRTOS exe to C:\Keil
2. Then paste the FreeRTOSConfig.h file in include folder of source in FreeRTOS
Again I’m reiterating these two steps only for Installation time. No need to copy every time.
Create the project(Each time):
1. Open keil4uvision and create a new project. If you don’t know how to create a project Please go through it Here.
2. click Project and Options for Target ‘Target 1’.
3. Click C/C++
4. Click on Define and type the context below.
ARM7_LPC21xx_KEIL_RVDS KEIL_THUMB_INTERWORK
5. Then in Include paths, add paths as like below.
- C:\Keil\FreeRTOS_V9.0.0rc2\FreeRTOS\Demo\Common\include
- C:\Keil\FreeRTOS_V9.0.0rc2\FreeRTOS\Source\portable\RVDS\ARM7_LPC21xx
- C:\Keil\FreeRTOS_V9.0.0rc2\FreeRTOS\Source\include
- . ( add this path as the dot in include path which indicates the current directory)
6. Then click Asm then paste below the line in include paths.
C:\Keil\FreeRTOS_V9.0.0rc2\FreeRTOS\Source\portable\RVDS\ARM7_LPC21xx
7. Then add the following files to the project from C:\Keil\FreeRTOS_V9.0.0rc2\FreeRTOS\Source
- Task.c
- List.c
- Queue.c
8. Then add the following files to the project from C:\keil\FreeRTOS_V9.0.0rc2\FreeRTOS\Source\portable\RVDS\ARM7_LPC21xx
- Port.c
- portASM.S (this file appears only when we select all files in file type).
9. Then add following file from C:\keil\FreeRTOS\FreeRTOS_V9.0.0rc2\FreeRtos\portable\memmang
- heap_2.c
10. Final step. Copy the whole content in the downloaded startup.s file and paste it into the startup file which is attached to the project.
The thing is you should do this every time you are creating a new project. when you are doing a lot of projects you will be fed up with this. But what to do? We have to do this.
You can also read the below tutorials.

Embedded Software | Firmware | Linux Devic Driver | RTOS
Hi, I am a tech blogger and an Embedded Engineer. I am always eager to learn and explore tech-related concepts. And also, I wanted to share my knowledge with everyone in a more straightforward way with easy practical examples. I strongly believe that learning by doing is more powerful than just learning by reading. I love to do experiments. If you want to help or support me on my journey, consider sharing my articles, or Buy me a Coffee! Thank you for reading my blog! Happy learning!
Discover more from EmbeTronicX
Subscribe to get the latest posts sent to your email.











Hi,
Why did we define ARM7_LPC21xx_KEIL_RVDS KEIL_THUMB_INTERWORK in C/C++?
I wrote a program to blink leds using this tutorial. I am using vTaskDelay(pdMS_TO_TICKS(1000)); to toggle leds every one second. how ever, the delay is more than 1 Second. The system currently has only one task to blink leds. Please let me know if we can get delay closer to given time.
Are you using Proteus or real hardware?
I am using physical hardware. I have an lpc2148 development board with a 12MHz crystal onboard.
Can you try vTaskDelayUntil() as this specifies an absolute time?
If that also didn’t help, can you try the below one?
vTaskDelay(1000 / portTICK_PERIOD_MS)
Both of them did not work. The lights stay on for about three seconds and off for three seconds.
Well explained. Thanks.
Hi Santhoshkumar,
Did you get any compilation error?
I think, your application is trying to read or write an illegal memory location.
I flashed LED & LCD Task code to controller, no output ?? tq in advance
while simulating Task creation code 7 times its executing properly after that error is through s like(Data Abort: ARM Instruction at 00000028H, Memory Access at 1020F64CH) can u please tell me the reason.
Hi, thank you for your tutorial,i have a doubt in step 10…do i have to replace the content of startup.s with your startup.s file….?
Hi Vishnu,
Yeah, you have to copy that whole content which is present in my startup.s file. Then paste it into the default startup.s which is attached to the keil.