Quality RTOS & Embedded Software

 Real time embedded FreeRTOS RSS feed 
Real time embedded FreeRTOS mailing list 
Quick Start Supported MCUs PDF Books Trace Tools Ecosystem TCP & FAT Training




Loading

LPC1768 + FreeRTOS

Posted by peter on January 22, 2012
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 Linker\rtosdemo_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 Linker\ldscipt_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

RE: LPC1768 + FreeRTOS

Posted by Richard on January 22, 2012
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.

RE: LPC1768 + FreeRTOS

Posted by peter on January 25, 2012
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

RE: LPC1768 + FreeRTOS

Posted by MEdwards on January 25, 2012
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?

RE: LPC1768 + FreeRTOS

Posted by peter on January 26, 2012
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


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




Copyright (C) 2004-2010 Richard Barry. Copyright (C) 2010-2016 Real Time Engineers Ltd.
Any and all data, files, source code, html content and documentation included in the FreeRTOSTM distribution or available on this site are the exclusive property of Real Time Engineers Ltd.. See the files license.txt (included in the distribution) and this copyright notice for more information. FreeRTOSTM and FreeRTOS.orgTM are trade marks of Real Time Engineers Ltd.

Latest News:

FreeRTOS V9.0.0 is now available for download.


Free TCP/IP and file system demos for the RTOS


Sponsored Links

⇓ Now With No Code Size Limit! ⇓
⇑ Free Download Without Registering ⇑


FreeRTOS Partners

ARM Connected RTOS partner for all ARM microcontroller cores

Renesas Electronics Gold Alliance RTOS Partner.jpg

Microchip Premier RTOS Partner

RTOS partner of NXP for all NXP ARM microcontrollers

Atmel RTOS partner supporting ARM Cortex-M3 and AVR32 microcontrollers

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

Xilinx Microblaze and Zynq partner

Silicon Labs low power RTOS partner

Altera RTOS partner for Nios II and Cortex-A9 SoC

Freescale Alliance RTOS Member supporting ARM and ColdFire microcontrollers

Infineon ARM Cortex-M microcontrollers

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

Cypress RTOS partner supporting ARM Cortex-M3

Fujitsu RTOS partner supporting ARM Cortex-M3 and FM3

Microsemi (previously Actel) RTOS partner supporting ARM Cortex-M3

Atollic Partner

IAR Partner

Keil ARM Partner

Embedded Artists