LPC1768 + FreeRTOS

Hey, since weeks I am trying to get freeRTOS to work on a NXP LPC1768 Cortex M3 with CodeSourcery G++ Lite Compiler (using Eclipse IDE). I have tried an altered CMSIS startupfile (with interrupt vector table adapted to freeRTOS handlers) and the included startup-file of the codeRed demo-project. Neither of them is working.
The university I am attending gave me the evaluation board where the cortex m3 is placed onto, so it is not a commercial version. However nobody at university can tell me what the problem is, or why it is not working. Within the main() function I just create one simple Task which is supposed to toggle a LED, but already the creation of the task fails and the programm does not even come to start the scheduler. Here is my eclipse project (with both startup and linker files). The startup-file from freeRTOS itself is named cr_startup_lpc17.c and is supposed to be used with linker script named Linkerrtosdemo_rdb1768_Debug.ld. The code sourcery startup file which is adapted tot the freeRTOS handlers is called startup_LPC17xx_1.asm and supposed to be used with linkerscript named Linkerldscipt_rom_gnu.ld I hope that somebody can help me.
Maybe somebody has a working hardware of the lpc1768 and can test the project, or somebody can tell me just by looking at the code where the problem is.
Would really appreciate any kind of help. Best regards,
peter

LPC1768 + FreeRTOS

Leaving FreeRTOS to on side for the moment, do you have a simple hello world demo running on the hardware (without the FreeRTOS source files included)?  If you are unsure as the the linker script and start up files to use, then get that sorted before you add in any additional source files and functionality. I don’t know what comes with the CodeSourcery tools, but with the CodeRed tools you can just use their project creation wizard to generate a project that has the correct start up code and linker script for you.  The tool will manage the linker script by default, but at least you can see the linker script.  I’m sure there are lots of other places you can get linker scripts for that chip too. If CodeSourcery have a similar project wizard, or any examples that run on your particular chip, then use the start up files and linker script from those.  I would not recommend mixing and matching linker scripts or startup files from different environments. Once you have a simple project, with a linker script, startup file and hardware configuration (PLL, etc.) that you are confident with you can add in the FreeRTOS files.  Best to copy an existing LPC1768 project.  You just need the FreeRTOS/Source files and the FreeRTOS/source/portable/GCC/ARM_CM3 files, with FreeRTOS/Source/include and FreeRTOS/Source/portable/GCC/ARM_CM3 in your include path. You can then install the interrupt handlers directly in the vector table, or better still, if you are using CMSIS files, just #define the names of the FreeRTOS handlers to the CMSIS handler.  Something like:
#define vPortSVCHandler SVC_Handler
#define xPortPendSVHandler PendSV_Handler
#define xPortSysTickHandler SysTick_Handler
in FreeRTOSConfig.h.  (check the names are the same as those in the vector table, as there is a little variation on the CMSIS side). Once the code is compiling, just create a simple task that does nothing but toggle an LED, and start the scheduler. Regards.

LPC1768 + FreeRTOS

Hey, first of all I want to thank you for the reply. I did exactly what you described. I set up an example project without freeRTOS that toggles a port-pin with a timer and a capture-compare unit. I also generated an interrupt on compare match which all worked as supposed.
Then I tried to integrate freeRTOS. I copied all the necessary files into my project and added the mentioned defines within FreeRTOSConfig.h. The project built properly. When I step through the program I come till the start of the scheduler.
Within the function vPortStartFirstTask() the svc 0 instruction immediately leads to the hard fault handler which is implemented as an endless loop. So I added the compare-sections command in my gdb init file and the downloaded section are compared to the executable. When I download the project  I get a warning that the first section ranging from 0x0 to 0x400 does not match the loaded file (I always get this warning so with and without freeRTOS). Maybe this is not the right forum for the question since it is an freeRTOS forum but maybe somebody can tell me how I can solve this problem because I have no idea. Best regards,
Peter

LPC1768 + FreeRTOS

If you have a flash programming problem then you are right that this is not the right forum, but if you get the same error with and without freeRTOS, and the program without FreeRTOS works, then maybe it is not a problem at all. Just reading another thread on this forum today, it looks like the SVC handler is not always called the same thing. Have you checked in your vector table that the handler installed for the SVC interrupt is called SVC_Handler and not SVCall_Handler?

LPC1768 + FreeRTOS

Hey, no it is not a flashing problem, because the project without freeRTOS is working perfectly. The SVC interrupt handler in my version is called SVC_Handler() and I have installed the freeRTOS handler like richardberry told me
#define vPortSVCHandler SVC_Handler
#define xPortPendSVHandler PendSV_Handler
#define xPortSysTickHandler SysTick_Handler
Best regards,
peter