EmbeddedRelated.com
Forums

Request: LPC2292 FreeRTOS Port

Started by jsalomo1 October 31, 2007
Does anyone have an Eclipse lpc2292 FreeRTOS port?

The FreeRTOS link on Keil's site
(http://www.keil.com/dd/chip/3652.htm) links to a 2106 port. Would
this be compatible? I would assume some memory mappings would probably
be changed. Any other changes I should know about?

An Engineer's Guide to the LPC2100 Series

> Does anyone have an Eclipse lpc2292 FreeRTOS port?
>
> The FreeRTOS link on Keil's site
> (http://www.keil.com/dd/chip/3652.htm
> ) links to a 2106 port. Would
> this be compatible? I would assume some memory mappings would probably
> be changed. Any other changes I should know about?
I presume you are wanting to use GCC as you mention Eclipse. If so, I would
suggest:

1) Downloading the LPC2368 Eclipse FreeRTOS.org demo
http://www.freertos.org/portlpc2368_Eclipse.html

2) Reading the installation instructions (I mention that quite a lot :o)
http://www.freertos.org/Eclipse.html

3) In the makefile, change the inclusion of the file:

___a) Change the definition compiler option "-I
$(RTOS_SOURCE_DIR)/portable/GCC/ARM7_LPC23xx" to "-I
$(RTOS_SOURCE_DIR)/portable/GCC/ARM7_LPC2000" [just the last three
characters are different].

___b) Remove all web server, Ethernet and TCP/IP stack code.

4) Edit the file
FreeRTOS\Demo\ARM7_LPC2368_Eclipse\RTOSDemo\ParTest\ParTest.c so it toggles
the LED that are connected to your hardware. Check the LED flashing code
works using a simple hello world style program before trying them within a
FreeRTOS.org application.

5) Edit main() so that is just contains the following:

int main( void )
{
prvSetupHardware();

vStartLEDFlashTasks( mainFLASH_PRIORITY );
vTaskStartScheduler();

return 0;
}

This just creates three tasks that flash three different LEDs at different
frequencies. Its a simple starting point.

6) Edit the file FreeRTOS\Demo\ARM7_LPC2368_Eclipse\RTOSDemo\lpc2368.ld so
the flash and ram sizes (at the top of the file) are correct, and remove the
references to USB and Ethernet RAM.

Try compiling it. I'm sure there will be a few things I forgot to mention,
but you get the idea.
Regards,
Richard.

+ http://www.FreeRTOS.org
13 official architecture ports, 1000 downloads per week.

+ http://www.SafeRTOS.com
Certified by T as meeting the requirements for safety related systems.



Thanks for the response. I've been trying to get it to compile, but no
luck.

I am getting errors similar to this:

./FreeRTOS/Source/portable/GCC/ARM7_LPC2000/portISR.o: In function
`vPortISRStartFirstTask':
FreeRTOS/Source/portable/GCC/ARM7_LPC2000/portISR.c:92: undefined
reference to `pxCurrentTCB'

Is there an include file that it's not seeing? I included portmacro.h
in the includes for this instance, but it doesn't seem to help.

--- In l..., "FreeRTOS.org Info" wrote:
>
> > Does anyone have an Eclipse lpc2292 FreeRTOS port?
> >
> > The FreeRTOS link on Keil's site
> > (http://www.keil.com/dd/chip/3652.htm
> > ) links to a 2106 port. Would
> > this be compatible? I would assume some memory mappings would probably
> > be changed. Any other changes I should know about?
>
>
> I presume you are wanting to use GCC as you mention Eclipse. If so,
I would
> suggest:
>
> 1) Downloading the LPC2368 Eclipse FreeRTOS.org demo
> http://www.freertos.org/portlpc2368_Eclipse.html
>
> 2) Reading the installation instructions (I mention that quite a lot :o)
> http://www.freertos.org/Eclipse.html
>
> 3) In the makefile, change the inclusion of the file:
>
> ___a) Change the definition compiler option "-I
> $(RTOS_SOURCE_DIR)/portable/GCC/ARM7_LPC23xx" to "-I
> $(RTOS_SOURCE_DIR)/portable/GCC/ARM7_LPC2000" [just the last three
> characters are different].
>
> ___b) Remove all web server, Ethernet and TCP/IP stack code.
>
> 4) Edit the file
> FreeRTOS\Demo\ARM7_LPC2368_Eclipse\RTOSDemo\ParTest\ParTest.c so it
toggles
> the LED that are connected to your hardware. Check the LED flashing
code
> works using a simple hello world style program before trying them
within a
> FreeRTOS.org application.
>
> 5) Edit main() so that is just contains the following:
>
> int main( void )
> {
> prvSetupHardware();
>
> vStartLEDFlashTasks( mainFLASH_PRIORITY );
> vTaskStartScheduler();
>
> return 0;
> }
>
> This just creates three tasks that flash three different LEDs at
different
> frequencies. Its a simple starting point.
>
> 6) Edit the file
FreeRTOS\Demo\ARM7_LPC2368_Eclipse\RTOSDemo\lpc2368.ld so
> the flash and ram sizes (at the top of the file) are correct, and
remove the
> references to USB and Ethernet RAM.
>
> Try compiling it. I'm sure there will be a few things I forgot to
mention,
> but you get the idea.
>
>
> Regards,
> Richard.
>
> + http://www.FreeRTOS.org
> 13 official architecture ports, 1000 downloads per week.
>
> + http://www.SafeRTOS.com
> Certified by T as meeting the requirements for safety related systems.
>



grep *.* for 'pxCurrentTCB'?

That's how I normally find unresolved symbols to get things to link :)

'CurrentTCB' sounds like an OS object, so you are probably right - a
header missing somewhere.

Rgds,
Martin
--- In l..., "mjames_doveridge" wrote:
>
> grep *.* for 'pxCurrentTCB'?
>
> That's how I normally find unresolved symbols to get things to link :)
>
> 'CurrentTCB' sounds like an OS object, so you are probably right - a
> header missing somewhere.
>
> Rgds,
> Martin
>

After a while of being away...

So I fixed that problem, now I have another:

make -k all
arm-elf-gcc -c -g -O1 -Tlpc2368.ld -I . -I FreeRTOS/Source/include -I
FreeRTOS/Source/portable/GCC/ARM7_LPC2000 -I
FreeRTOS/Demo/Common/include -I FreeRTOS/Demo/Common/Minimal -I
Demo/Common -mthumb main.c -o main.o
arm-elf-gcc -c -g -O1 -Tlpc2368.ld -I . -I FreeRTOS/Source/include -I
FreeRTOS/Source/portable/GCC/ARM7_LPC2000 -I
FreeRTOS/Demo/Common/include -I FreeRTOS/Demo/Common/Minimal -I
Demo/Common -mthumb ParTest/ParTest.c -o ParTest/ParTest.o
arm-elf-gcc -c -g -O1 -Tlpc2368.ld -I . -I FreeRTOS/Source/include -I
FreeRTOS/Source/portable/GCC/ARM7_LPC2000 -I
FreeRTOS/Demo/Common/include -I FreeRTOS/Demo/Common/Minimal -I
Demo/Common -mthumb LCD/portlcd.c -o LCD/portlcd.o
arm-elf-gcc -c -g -O1 -Tlpc2368.ld -I . -I FreeRTOS/Source/include -I
FreeRTOS/Source/portable/GCC/ARM7_LPC2000 -I
FreeRTOS/Demo/Common/include -I FreeRTOS/Demo/Common/Minimal -I
Demo/Common -mthumb FreeRTOS/Demo/Common/Minimal/BlockQ.c -o
FreeRTOS/Demo/Common/Minimal/BlockQ.o
arm-elf-gcc -c -g -O1 -Tlpc2368.ld -I . -I FreeRTOS/Source/include -I
FreeRTOS/Source/portable/GCC/ARM7_LPC2000 -I
FreeRTOS/Demo/Common/include -I FreeRTOS/Demo/Common/Minimal -I
Demo/Common -mthumb FreeRTOS/Demo/Common/Minimal/blocktim.c -o
FreeRTOS/Demo/Common/Minimal/blocktim.o
arm-elf-gcc -c -g -O1 -Tlpc2368.ld -I . -I FreeRTOS/Source/include -I
FreeRTOS/Source/portable/GCC/ARM7_LPC2000 -I
FreeRTOS/Demo/Common/include -I FreeRTOS/Demo/Common/Minimal -I
Demo/Common -mthumb FreeRTOS/Demo/Common/Minimal/flash.c -o
FreeRTOS/Demo/Common/Minimal/flash.o
arm-elf-gcc -c -g -O1 -Tlpc2368.ld -I . -I FreeRTOS/Source/include -I
FreeRTOS/Source/portable/GCC/ARM7_LPC2000 -I
FreeRTOS/Demo/Common/include -I FreeRTOS/Demo/Common/Minimal -I
Demo/Common -mthumb FreeRTOS/Demo/Common/Minimal/integer.c -o
FreeRTOS/Demo/Common/Minimal/integer.o
arm-elf-gcc -c -g -O1 -Tlpc2368.ld -I . -I FreeRTOS/Source/include -I
FreeRTOS/Source/portable/GCC/ARM7_LPC2000 -I
FreeRTOS/Demo/Common/include -I FreeRTOS/Demo/Common/Minimal -I
Demo/Common -mthumb FreeRTOS/Demo/Common/Minimal/GenQTest.c -o
FreeRTOS/Demo/Common/Minimal/GenQTest.o
FreeRTOS/Demo/Common/Minimal/GenQTest.c: In function
'vStartGenericQueueTasks':
FreeRTOS/Demo/Common/Minimal/GenQTest.c:127: warning: pointer targets
in passing argument 2 of 'xTaskCreate' differ in signedness
FreeRTOS/Demo/Common/Minimal/GenQTest.c:135: warning: pointer targets
in passing argument 2 of 'xTaskCreate' differ in signedness
FreeRTOS/Demo/Common/Minimal/GenQTest.c:136: warning: pointer targets
in passing argument 2 of 'xTaskCreate' differ in signedness
FreeRTOS/Demo/Common/Minimal/GenQTest.c:137: warning: pointer targets
in passing argument 2 of 'xTaskCreate' differ in signedness
arm-elf-gcc -c -g -O1 -Tlpc2368.ld -I . -I FreeRTOS/Source/include -I
FreeRTOS/Source/portable/GCC/ARM7_LPC2000 -I
FreeRTOS/Demo/Common/include -I FreeRTOS/Demo/Common/Minimal -I
Demo/Common -mthumb FreeRTOS/Demo/Common/Minimal/QPeek.c -o
FreeRTOS/Demo/Common/Minimal/QPeek.o
FreeRTOS/Demo/Common/Minimal/QPeek.c: In function 'vStartQueuePeekTasks':
FreeRTOS/Demo/Common/Minimal/QPeek.c:100: warning: pointer targets in
passing argument 2 of 'xTaskCreate' differ in signedness
FreeRTOS/Demo/Common/Minimal/QPeek.c:101: warning: pointer targets in
passing argument 2 of 'xTaskCreate' differ in signedness
FreeRTOS/Demo/Common/Minimal/QPeek.c:102: warning: pointer targets in
passing argument 2 of 'xTaskCreate' differ in signedness
FreeRTOS/Demo/Common/Minimal/QPeek.c:103: warning: pointer targets in
passing argument 2 of 'xTaskCreate' differ in signedness
arm-elf-gcc -c -g -O1 -Tlpc2368.ld -I . -I FreeRTOS/Source/include -I
FreeRTOS/Source/portable/GCC/ARM7_LPC2000 -I
FreeRTOS/Demo/Common/include -I FreeRTOS/Demo/Common/Minimal -I
Demo/Common -mthumb FreeRTOS/Demo/Common/Minimal/dynamic.c -o
FreeRTOS/Demo/Common/Minimal/dynamic.o
arm-elf-gcc -c -g -O1 -Tlpc2368.ld -I . -I FreeRTOS/Source/include -I
FreeRTOS/Source/portable/GCC/ARM7_LPC2000 -I
FreeRTOS/Demo/Common/include -I FreeRTOS/Demo/Common/Minimal -I
Demo/Common -mthumb FreeRTOS/Source/list.c -o FreeRTOS/Source/list.o
arm-elf-gcc -c -g -O1 -Tlpc2368.ld -I . -I FreeRTOS/Source/include -I
FreeRTOS/Source/portable/GCC/ARM7_LPC2000 -I
FreeRTOS/Demo/Common/include -I FreeRTOS/Demo/Common/Minimal -I
Demo/Common -mthumb FreeRTOS/Source/queue.c -o FreeRTOS/Source/queue.o
arm-elf-gcc -c -g -O1 -Tlpc2368.ld -I . -I FreeRTOS/Source/include -I
FreeRTOS/Source/portable/GCC/ARM7_LPC2000 -I
FreeRTOS/Demo/Common/include -I FreeRTOS/Demo/Common/Minimal -I
Demo/Common -mthumb FreeRTOS/Source/tasks.c -o FreeRTOS/Source/tasks.o
/cygdrive/c/DOCUME~1/user/LOCALS~1/Temp/ccjgvQ9s.s: Assembler messages:
/cygdrive/c/DOCUME~1/user/LOCALS~1/Temp/ccjgvQ9s.s:987: Error: bad
instruction `stmdb SP!,{R0}'
/cygdrive/c/DOCUME~1/user/LOCALS~1/Temp/ccjgvQ9s.s:988: Error: bad
instruction `mrs R0,CPSR'
/cygdrive/c/DOCUME~1/user/LOCALS~1/Temp/ccjgvQ9s.s:989: Error:
register expected, not '#0xC0' -- `orr R0,R0,#0xC0'
/cygdrive/c/DOCUME~1/user/LOCALS~1/Temp/ccjgvQ9s.s:990: Error: bad
instruction `msr CPSR,R0'
/cygdrive/c/DOCUME~1/user/LOCALS~1/Temp/ccjgvQ9s.s:991: Error: lo
register required -- `ldmia SP!,{R0}'
/cygdrive/c/DOCUME~1/user/LOCALS~1/Temp/ccjgvQ9s.s:1030: Error: bad
instruction `stmdb SP!,{R0}'
/cygdrive/c/DOCUME~1/user/LOCALS~1/Temp/ccjgvQ9s.s:1031: Error: bad
instruction `mrs R0,CPSR'
/cygdrive/c/DOCUME~1/user/LOCALS~1/Temp/ccjgvQ9s.s:1032: Error:
register expected, not '#0xC0' -- `orr R0,R0,#0xC0'
/cygdrive/c/DOCUME~1/user/LOCALS~1/Temp/ccjgvQ9s.s:1033: Error: bad
instruction `msr CPSR,R0'
arm-elf-gcc -c -g -O1 -Tlpc2368.ld -I . -I FreeRTOS/Source/include -I
FreeRTOS/Source/portable/GCC/ARM7_LPC2000 -I
FreeRTOS/Demo/Common/include -I FreeRTOS/Demo/Common/Minimal -I
Demo/Common -mthumb FreeRTOS/Source/portable/GCC/ARM7_LPC2000/port.c
-o FreeRTOS/Source/portable/GCC/ARM7_LPC2000/port.o
arm-elf-gcc -c -g -O1 -Tlpc2368.ld -I . -I FreeRTOS/Source/include -I
FreeRTOS/Source/portable/GCC/ARM7_LPC2000 -I
FreeRTOS/Demo/Common/include -I FreeRTOS/Demo/Common/Minimal -I
Demo/Common -mthumb FreeRTOS/Source/portable/MemMang/heap_2.c -o
FreeRTOS/Source/portable/MemMang/heap_2.o
/cygdrive/c/DOCUME~1/user/LOCALS~1/Temp/ccjgvQ9s.s:1034: Error: lo
register required -- `ldmia SP!,{R0}'
make: *** [FreeRTOS/Source/tasks.o] Error 1
make: Target `all' not remade because of errors.

==For reference,
Makefile: http://paste-it.net/5977
boot.s: http://paste-it.net/5978 (default boot.s from 2368 demo)
==
Any suggestions?
> /cygdrive/c/DOCUME~1/user/LOCALS~1/Temp/ccjgvQ9s.s:987: Error: bad
> instruction `stmdb SP!,{R0}'
> /cygdrive/c/DOCUME~1/user/LOCALS~1/Temp/ccjgvQ9s.s:988: Error: bad
> instruction `mrs R0,CPSR'
> /cygdrive/c/DOCUME~1/user/LOCALS~1/Temp/ccjgvQ9s.s:989: Error:
You are trying to build ARM instructions into THUMB code.

Take a look at the files rom_thum.bat, ram_thumb.bat, rom_arm.bat and
ram_arm.bat in the FreeRTOS/Demo/ARM7_LPC2106_GCC directory. These show you
how to setup the environment to build for the different modes.

You are missing the USE_THUMB_MODE definition.

I missed the start of this thread so may miss the point, but if you are
wanting to create a build for an LPC2292 then you should just be able to
take an existing demo app for an LPC2000 device and change the linker script
to be correct for your memory map. The demo applications are provided so
you have all the compiler setup and options required pre-configured 'out of
the box'.

The one caveat to this is the timer setup which differs slightly between
devices, you will either need to include files from
FreeRTOS\Source\portable\GCC\ARM7_LPC23xx or
FreeRTOS\Source\portable\GCC\ARM7_LPC2000 depending on the timer
configuration of the LPC2292.
Also take a look at the following page:
http://www.freertos.org/porting-a-freertos-demo-to-different-hardware.html.
Regards,
Richard.

+ http://www.FreeRTOS.org
14 official architecture ports, 5000 downloads per month.

+ http://www.SafeRTOS.com
Certified by T as meeting the requirements for safety related systems.



--- In l..., "FreeRTOS.org Info" wrote:
>
> > /cygdrive/c/DOCUME~1/user/LOCALS~1/Temp/ccjgvQ9s.s:987: Error: bad
> > instruction `stmdb SP!,{R0}'
> > /cygdrive/c/DOCUME~1/user/LOCALS~1/Temp/ccjgvQ9s.s:988: Error: bad
> > instruction `mrs R0,CPSR'
> > /cygdrive/c/DOCUME~1/user/LOCALS~1/Temp/ccjgvQ9s.s:989: Error:
> You are trying to build ARM instructions into THUMB code.
>
> Take a look at the files rom_thum.bat, ram_thumb.bat, rom_arm.bat and
> ram_arm.bat in the FreeRTOS/Demo/ARM7_LPC2106_GCC directory. These
show you
> how to setup the environment to build for the different modes.
>
> You are missing the USE_THUMB_MODE definition.
>
> I missed the start of this thread so may miss the point, but if you are
> wanting to create a build for an LPC2292 then you should just be able to
> take an existing demo app for an LPC2000 device and change the
linker script
> to be correct for your memory map. The demo applications are
provided so
> you have all the compiler setup and options required pre-configured
'out of
> the box'.
>
> The one caveat to this is the timer setup which differs slightly between
> devices, you will either need to include files from
> FreeRTOS\Source\portable\GCC\ARM7_LPC23xx or
> FreeRTOS\Source\portable\GCC\ARM7_LPC2000 depending on the timer
> configuration of the LPC2292.
> Also take a look at the following page:
>
http://www.freertos.org/porting-a-freertos-demo-to-different-hardware.html.
>

Thanks for your quick reply.

I was already trying to configure the existing 2368 Eclipse demo
application for use with the 2292, as someone had suggested as a reply
to my first post. I changed the linker script memory ram and flash
sizes. There was no existing USE_THUMB_MODE definition so I did not
know that was necessary.

I also thought that it should compile 'out of the box' and was
wondering why I was having so much trouble.

So I should enable thumb mode?