Quality RTOS & Embedded Software

 Real time embedded FreeRTOS RSS feed 
Quick Start Supported MCUs PDF Books Trace Tools Ecosystem


Porting FreeRTOS 10.0.0 to LPC2148

Posted by valhalla2000 on January 4, 2018

I am trying to get FreeRTOS running on LPC2148. I am able to call my task function. Inside my task funtion I want to have a delay and hence called vTaskDelay(0) (to first test things out I have zero timeout). However I dont think my task is called again, i.e, brought back to RUNNING state again.. I stepped through, the functions called by vTaskDelay(0). They are


(I've taken portASM.s from FreeRTOSv10.0.0FreeRTOSv10.0.0FreeRTOSSourceportableRVDSARM7_LPC21xx)

and this lands up in the "SWIHandler B SWIHandler" defined in Startup.s .

The debugger dosent proceed further . I've set INCLUDE_vTaskDelay = 1 in FreeRTOSConfig.h Can anyone tell me how to proceed ? Does the exisiting PortYield function need to be modified ? Exisiting vPortYield functions is,

vPortYield PRESERVE8 SVC 0 bx lr

Porting FreeRTOS 10.0.0 to LPC2148

Posted by rtel on January 4, 2018

and this lands up in the "SWIHandler B SWIHandler" defined in Startup.s .

It looks like you are using the default SWI handler, which does nothing but jump to itself, so once it is entered it never exits. You need to have the SWI handler jump to the FreeRTOS SWI handler, which in your case is called vPortYieldProcessor. However you don't want to try branching to it directly, as it may be located in memory that is too far away for a simple 'b' branch - instead branch to it indirectly by loading its address. Your vector table will then look something like this (which I have taken from here https://sourceforge.net/p/freertos/code/HEAD/tree/trunk/FreeRTOS/Demo/ARM7LPC2129Keil_RVDS/Startup.s):

Vectors         LDR     PC, Reset_Addr
                 LDR     PC, Undef_Addr
                 LDR     PC, SWI_Addr ; LOAD PC WITH ADDRESS AT SWI_Addr
                 LDR     PC, PAbt_Addr
                 LDR     PC, DAbt_Addr
                 LDR     PC, [PC, #-0x0FF0]
                 LDR     PC, FIQ_Addr

Reset_Addr      DCD     Reset_Handler
Undef_Addr      DCD     Undef_Handler
SWI_Addr        DCD     vPortYieldProcessor ; FreeRTOS SWI HANDLER
PAbt_Addr       DCD     PAbt_Handler
DAbt_Addr       DCD     DAbt_Handler
IRQ_Addr        DCD     IRQ_Handler
FIQ_Addr        DCD     FIQ_Handler

Porting FreeRTOS 10.0.0 to LPC2148

Posted by valhalla2000 on January 5, 2018

Thanks Richard, its worked

[ Back to the top ]    [ About FreeRTOS ]    [ Privacy ]    [ Sitemap ]    [ ]

Copyright (C) Amazon Web Services, Inc. or its affiliates. All rights reserved.


FreeRTOS and other careers at AWS.

Latest News

FreeRTOS kernel V10.0.1 is available for immediate download. Now MIT licensed.

FreeRTOS Partners

ARM Connected RTOS partner for all ARM microcontroller cores

Espressif ESP32

IAR Partner

Microchip Premier RTOS Partner

RTOS partner of NXP for all NXP ARM microcontrollers

STMicro RTOS partner supporting ARM7, ARM Cortex-M3, ARM Cortex-M4 and ARM Cortex-M0

Texas Instruments MCU Developer Network RTOS partner for ARM and MSP430 microcontrollers

OpenRTOS and SafeRTOS

Xilinx Microblaze and Zynq partner