FreeRTOS on NXP LPC1343 Lpcxpresso Code Red

oahmad2 wrote on Tuesday, March 02, 2010:


I am trying to run the example programs originally meant for the LPC17xx on the LPC13xx.  The freertos documentation for the LPC17xx seems to indicate that it is a trivial task to modify the programs to run on the LPC13xx.  Unfortunately I’m having trouble running example1 on the LPC1343.

I am using the LPC13xx LpcExpresso low-cost development kit by Code Red with an LPC1343 processor.  After modifying all the files to include the LPC13xx.h files instead of the LPC17xx files, reducing the heap size to 512 bytes, I was able to compile the example successfully.  Then,  I was able to single-step through the example until it gets to the void vPortStartFirstTask(void) function;  After this function, the program execution just sits in the infinite while(1) loop of the void SVCall_Handler(void) function located in cr_startup_lpc13.c.

Can anyone point out on how to get this to work correctly?


edwards3 wrote on Tuesday, March 02, 2010:

reducing the heap size to 512 bytes

That seems very small. You will not be able to create more than a couple of tasks, if that.

while(1) loop of the void SVCall_Handler(void)quote]

That sounds like the vector table has not been set up properly. Did you change the vector table? The FreeRTOS SVCall handler should be installed, but this sounds like the default handler (which is not implemented other than while(1)) is being called.

oahmad2 wrote on Tuesday, March 02, 2010:

Hi, Thanks for the reply.

I just changed the heapsize in freeRTOSConfig.h as follows:

#define configTOTAL_HEAP_SIZE  (size_t) (10 * 256) //this is what it was previously


#define configTOTAL_HEAP_SIZE (size_t) (10 * 512) //

That did not change anything.  I am still getting hung-up in the SVCall handler.

Also, I did not change the vector table…where is this located?  I did include the LPC13xx.h files instead of LPC17xx.h files, so that should have taken care of the vector tables, right? 

Where is the default handler for FreeRTOS located?

As additional information, here is what is in the function vPortStartFirstTask if it helps…I checked the register location 0xE0000ED08 and that thould be the same for all cortex M3 devices.

void vPortStartFirstTask(void)
           __asm volatile{
                                           "   ldr r0, =0xE000ED08     \n"
                                           "   ldr r0,                           \n"
                                           "   ldr r0,                           \n"
                                           "   msr msp, r0                     \n"
                                           "   svc 0                                  \n"

rtel wrote on Wednesday, March 03, 2010:

I don´t have a CrossWorks project in front of me at the moment (not using my computer) but it should be located in the start up file, which on a Cortex M3 can be a C or an assembly file.

The SCVCall, PendSV and SysTick interrupts need to be populated with exactly the same functions as per the examples that are sent with the books.

Sorry not to be more helpful, if I had my own computer here I would be able to tell you example which file and which functions, but hopefully you will be able to work it out from the files provided.


oahmad2 wrote on Wednesday, March 03, 2010:

Thanks.  I’m SO glad that it is now working!
That solved my problem.  The LPC13xx startup file that I used did not have the ‘overloaded’ functions for SVCCall, PendSV and SysTick as the LPC17xx startup file in the original examples.  I did a compare between the two and added in these functions in the right places and now it works!