Quality RTOS & Embedded Software

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


FreeRTOS & EA LPC3131

Posted by Dark Vegetable on March 8, 2009

I have _just_ got FreeRTOS V5.1.2 running on my EA LPC3131 devboard, it's a bit of a hack but the vLEDFlashTask task now runs and the GPIO_BOOT2 LED blinks!!!

I noticed that it does not run with the configUSE_PREEMPTION flag set to '1'. The code crashes somewhere in/after the first timer interrupt with an Abort Exception but LR_ABT is garbage (actually, some addy in uninitialized RAM) so I'm lost in Hyperspace :( Has anyone else seen this behavior on ARM9?

RE: FreeRTOS & EA LPC3131

Posted by Richard on March 10, 2009
Check that the startup code does not have an unterminated comment in it that prevents the data abort stack being setup correctly.

msr CPSR_c, #MODE_UND|I_BIT|F_BIT /* Undefined Instruction Mode

is the offending line. This has just been fixed in SVN.

Also, are you vectoring directly to the peripheral handler, or through a common IRQ entry point. This effects the code required.

Have you also checked for stack overflows?

Does the tick interrupt work ok when you are using co-operative mode? When using pre-emptive mode the entry/exit from the IRQ needs to be different in order to save and restore the task context. Check the examples for other ARM7/9 GCC demos for how this is done.


RE: FreeRTOS & EA LPC3131

Posted by Dark Vegetable on March 10, 2009

The LPC313x uses Vectored interrupts, so I have one IRQ (and one FIQ) handler that checks a reg for the Idx of the interrupt that fired. The IRQ and FIQ handlers are "naked" but the specific handlers are not.

Anyway, turns out I was calling portSAVE_CONTEXT/portRESTORE_CONTEXT in the IRQ handler AND in vPreemptiveTick() - the vNonPreemptiveTick() function does not have this. Removing the portSAVE_CONTEXT/portRESTORE_CONTEXT from the vPreemptiveTick() function solves the problem & the pre-emptive version works now

Thanks for the tips.

RE: FreeRTOS & EA LPC3131

Posted by Jean-Pierre Poulin on April 21, 2009

I also have this EA LPC3131 board and am actively developing on it.

I would be interested in contributing to refining this port of FreeRTOS to this platform.

Are you looking for a contributor?

Kind regards,

Jean-Pierre Poulin

RE: FreeRTOS & EA LPC3131

Posted by richard irving on March 7, 2010
I'm starting on an lpc3131 port also. have it ticking and "maybe" context switching - just starting to run tests. would like to see how you did yours. any chance we could share thought/code?

RE: FreeRTOS & EA LPC3131

Posted by richard irving on March 9, 2010
(hate to whine in blogs, but i could use a clue on this one)
Anybody have any luck using the nxp lpc313x_***_driver.c files? I am thinking it would be better to write new ones, since a timer tick and a context switch seem to be the only "system" functions needed. Timer tick is simple but i have a question regarding use mode vs service mode. I assume that "you guys" are running in service mode, since the examples i have looked at do things like enable/disable interrupts in the RTOS code. Otherwise i think i would have to wrap the enable/disable up in a SWI call.
Are you using IAR, GCC or Keil toolchains? I am using Keil MDK.
Thanks for any comments,

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

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

Latest News

Version 10.1.0 of the FreeRTOS kernel is available for immediate download. MIT licensed.

View a recording of the "OTA Update Security and Reliability" webinar, presented by TI and AWS.


FreeRTOS and other embedded software careers at AWS.

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