LPC2214 Porting Problem: The sequel

nobody wrote on Thursday, July 14, 2005:

Hi again
Yesterday I got the FreeRTOS kernel compiled for the first time after some problems
Unfortunately my problems werent over :frowning:
I included a small test application to see if the kernel was running correctly, a small LED flasher
The LED flasher task is added by using xTaskCreate and the kernel was started. Nothing happened the LED wasnt flashing. Ive tested the LED flasher program without the kernel and it works fine.
I dont know where the problem lays, if its a stack problem, a setup problem or.

Regards Jens Alsig

nobody wrote on Thursday, July 14, 2005:

Are you able to step through the code?  If so then I can tell you things to look for.

Otherwise, can you see what the return value of xTaskCreate() is, also does the call to start the scheduler return?  If the scheduler starts the call should not return.

nobody wrote on Thursday, July 14, 2005:

I can’t step through the code :frowning:
I’ve just tested your proposal and the return code from xTaskCreate() is pdPASS.
Also the scheduler doesnt return.

rtel wrote on Thursday, July 14, 2005:

which compiler are you using?

If you send me your project (source files, makefiles, etc.) then I can take a look.  Zip up the files and send them to the email address listed on the contact page of the FreeRTOS web site (r dot barry at free … ).


nobody wrote on Thursday, July 14, 2005:

I’m using gcc - winarm.
2 sec and I will send a mail to you, Richard

rtel wrote on Thursday, July 14, 2005:

The problem seems to relate to the startup code and linker script.

The startup code you have does not call main() in the correct mode.  It must be in Supervisor mode when main() is called.

Correcting this causes an abort before the kernel even gets started due to a return address on the stack getting overwritten.  I suspect this is also a startup file issue.

Also the compiler options are suspect - especially the structure packing.

Can you use the startup files, makefile and linker script as per the download for the LPC2106 demo?  This way everything will be setup correctly.  You will have to alter the linker script slightly for the different size of ROM and RAM.


rtel wrote on Thursday, July 14, 2005:

I just tried this:

+ Copy the command line options from the LPC2106 demo makefile into your makefile.

+ Copy the linker script from the LPC2106 demo into your directory and rename it appropriately.

+ Change just two lines of the linker script where the start and size of the flash and ram is defined to be correct for your CPU.

+ Copy the boot.s file into your directory and rename it crt0.S.

+ make clean

+ make rtosdemo.elf

Works!  (at least in the GCC simulator).


I will email the files I have changed.