EmbeddedRelated.com
Forums
Memfault Beyond the Launch

MCB2300 with LPC2387 - help: need freertos port

Started by nagik October 14, 2008
Dear All,

I am looking for the freertos port for the MCB2300 with LPC2387. I
tried with the version present in this group's (which was for MCB2300
with LPC2378) 'file' list but it didn't work. I would be grateful if
someone can share a working freertos port for LPC 2387.

Alternately, if someone can suggest the changes to be carried out for
converting the LPC2378 freertos port to LPC 2387, that would also be
of help to me.

Look forward to your responses.

Thanks and with regards,
- Nagi

An Engineer's Guide to the LPC2100 Series

> I am looking for the freertos port for the MCB2300 with
> LPC2387. I tried with the version present in this group's
> (which was for MCB2300 with LPC2378) 'file' list but it
> didn't work. I would be grateful if someone can share a
> working freertos port for LPC 2387.

Which compiler are you using?

Regards,
Richard.

+ http://www.FreeRTOS.org
17 official architecture ports, more than 6000 downloads per month.

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

I am using WinARM (gnu-ARM) compiler.

Thanks and with regards,
- Nagi

--- In l..., "FreeRTOS.org Info" wrote:
>
> > I am looking for the freertos port for the MCB2300 with
> > LPC2387. I tried with the version present in this group's
> > (which was for MCB2300 with LPC2378) 'file' list but it
> > didn't work. I would be grateful if someone can share a
> > working freertos port for LPC 2387.
>
> Which compiler are you using?
>
> Regards,
> Richard.
>
> + http://www.FreeRTOS.org
> 17 official architecture ports, more than 6000 downloads per month.
>
> + http://www.SafeRTOS.com
> Certified by T�V as meeting the requirements for safety related systems.
>

> I am using WinARM (gnu-ARM) compiler.

Both LPC2368 demos in the FreeRTOS.org download use flavours of GCC so I
would have thought (not knowing anything about the LPC2387) that there would
be little to do.

Other than peripherals, what are the differences between the LPC2368 and the
LPC2387.

What is the nature of your problem? Compiling? Crashing? Debugging?

Regards,
Richard.

+ http://www.FreeRTOS.org
17 official architecture ports, more than 6000 downloads per month.

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

I had success making a FreeRTOS LPC2387 port from the LPC2368
Eclipse port.
One thing that I needed to do was to make sure _bss_end was set
correct in LPC2368.ld file.

. = ALIGN(32 / 8); //line 44
_bss_end__ = . ; __bss_end__ = . ; //this must be moved
from the button part to line 45

You can test the _bss_end__ in the *.map file it must be within
RAM area. If it's outside RAM area the boot ram initialisation loop
will run forever.

The correct configPINSEL2_VALUE value must be selected.

Compile with make all and program the MCB2387 board through ISP,
e.g. the "Flash Magic" tool.

This got me a working port :-)

Best regards
Mikkel Kristiansen

PS, note that I'm new to FreeRTOS so my input may not be
the "correct" solution.

Dear Mr. Mikkel,

thank you for your mail. Please can you elaborate? I
am not able to understand what you mean.

the following is the LPC2368.ld file I am using:
--------------------start of file----------------

/*
* Defines memory layout
*/

MEMORY
{
flash (rx) : ORIGIN = 0x00000000, LENGTH = 512K
ram (rw) : ORIGIN = 0x40000000, LENGTH = 61440
ramstack (rw) : ORIGIN = 0x40007800, LENGTH = 4096
usbram (rw) : ORIGIN = 0x7FD00000, LENGTH = 16K
ethram (rw) : ORIGIN = 0x7FE00000, LENGTH = 16K
}

/*
* Define entry point, found in startarm.s
*/
ENTRY(_reset_handler)

/*
* Sections
*/
SECTIONS
{
/* Place memory counter at address 0 */
. = 0;

/* Place startup code at start of flash */
startup :
{
*(.startup)
} > flash =0

. = ALIGN(4);

/* Place program code */
prog :
{
*(.text)
*(.rodata)
*(.rodata*)
*(glue_7)
*(glue_7t)
} > flash =0

. = ALIGN(4);

__end_of_text__ = .;
__data_beg_src__ = .;
PROVIDE(etext = .);

/* Place initialized data */
.data : AT(__data_beg_src__)
{
__data_beg__ = .;
*(.data)
} > ram

. = ALIGN(4);
__data_end__ = .;
PROVIDE(edata = .);

/* Place zero initialized data */
.bss :
{
__bss_beg__ = .;
*(.bss)
} >ram
/* Align here to ensure that the .bss section occupies space up to
_end. Align after .bss to ensure correct alignment even if the
.bss section disappears because there are no input sections. */
. = ALIGN(32 / 8);

. = ALIGN(32 / 8);

/* Provide end markers */
_end = .;
_bss_end__ = .;
__bss_end__ = .;
__end__ = .;
PROVIDE(end = .);

stacklayout :
{
__stack_scv_bottom__ = .;
. = . + 0x0400;
__stack_scv_top__ = .;
__stack_irq_bottom__ = .;
. = . + 0x03BC;
__stack_irq_top__ = .;
__stack_fiq_bottom__ = .;
. = . + 0x0004;
__stack_fiq_top__ = .;
__stack_und_bottom__ = .;
. = . + 0x0004;
__stack_und_top__ = .;
__stack_iap_bottom__ = .;
} >ramstack

usbramlayout :
{
__usbram_start__ = .;
__usbram_end__ = 0x4000;
} >usbram

ethramlayout :
{
__ethram_start__ = .;
__ethram_end__ = 0x4000;
} > ethram
-------------------------------end of file--------------

Please tell me the modifications I have to carry out.

Thanks and with regards,
- Nagi
--- In l..., "mikkel.kristiansen"
wrote:
>
> I had success making a FreeRTOS LPC2387 port from the LPC2368
> Eclipse port.
> One thing that I needed to do was to make sure _bss_end was set
> correct in LPC2368.ld file.
>
> . = ALIGN(32 / 8); //line 44
> _bss_end__ = . ; __bss_end__ = . ; //this must be moved
> from the button part to line 45
>
> You can test the _bss_end__ in the *.map file � it must be within
> RAM area. If it's outside RAM area the boot ram initialisation loop
> will run forever.
>
> The correct configPINSEL2_VALUE value must be selected.
>
> Compile with make all and program the MCB2387 board through ISP,
> e.g. the "Flash Magic" tool.
>
> This got me a working port :-)
>
> Best regards
> Mikkel Kristiansen
>
> PS, note that I'm new to FreeRTOS so my input may not be
> the "correct" solution.
>

>
> thank you for your mail. Please can you elaborate? I am not
> able to understand what you mean.

I have changed the linker script in the FreeRTOS.org SVN repository already.
Take a look there (go the FreeRTOS section on SourceForge to find it).

Regards,
Richard.

+ http://www.FreeRTOS.org
17 official architecture ports, more than 6000 downloads per month.

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

Elaboration

My suggestion applies to FreeRTOSV5.0.3 ARM7_LPC2368_Eclipse port.

The problem I have observed:
Compiling the original source gives (found in the rtosdemo.map file):
0x4000084c __bss_beg__ = .
0x7fe00000 __bss_end__ = .

The boot.s file tries to clear the BSS RAM section, stating from
0x4000084c. Because the RAM area of the processor LPC2368 end at
0x40007fff, I thing this causes the "clear bss" loop in the boot.s
file to loop forever.

When moving the __bss_end__ statement in the lpc2368.ld file, I get:
0x4000084c __bss_beg__ = .
0x40007c54 __bss_end__ = .

Which is valid RAM addresses, and the code should now run on a
MCB2378 board.
I'm not exactly sure why some of us have seen this problem, but I
could have something to do with the tool-chain and the
compiler/linker versions.

I used this for a LPC2387, but that only changes the RAM area a
little.

BR, Mikkel
--- In l..., "mikkel.kristiansen"
wrote:
>
> I had success making a FreeRTOS LPC2387 port from the LPC2368
> Eclipse port.
> One thing that I needed to do was to make sure _bss_end was set
> correct in LPC2368.ld file.
>
> . = ALIGN(32 / 8); //line 44
> _bss_end__ = . ; __bss_end__ = . ; //this must be moved
> from the button part to line 45
>
> You can test the _bss_end__ in the *.map file it must be within
> RAM area. If it's outside RAM area the boot ram initialisation
loop
> will run forever.
>
> The correct configPINSEL2_VALUE value must be selected.
>
> Compile with make all and program the MCB2387 board through ISP,
> e.g. the "Flash Magic" tool.
>
> This got me a working port :-)
>
> Best regards
> Mikkel Kristiansen
>
> PS, note that I'm new to FreeRTOS so my input may not be
> the "correct" solution.
>

Hello Nagi,

I have not tested your .ld file, but the bss declarations seems to
be correct (it don't look like the FreeRTOS LPC2368 Eclipse port
that I have).

On you request, I have tried to elaborate my earlier comment,
http://tech.groups.yahoo.com/group/lpc2000/message/36716

I hope this clarifies what problem I had in the beginning :-)

I can see that FreeRTOS have updated the *.ld file that is also a
good idea to check that out.

BR, Mikkel
--- In l..., "nagik" wrote:
>
> Dear Mr. Mikkel,
>
> thank you for your mail. Please can you elaborate? I
> am not able to understand what you mean.
>
> the following is the LPC2368.ld file I am using:
> --------------------start of file----------------
>
> /*
> * Defines memory layout
> */
>
> MEMORY
> {
> flash (rx) : ORIGIN = 0x00000000, LENGTH = 512K
> ram (rw) : ORIGIN = 0x40000000, LENGTH = 61440
> ramstack (rw) : ORIGIN = 0x40007800, LENGTH = 4096
> usbram (rw) : ORIGIN = 0x7FD00000, LENGTH = 16K
> ethram (rw) : ORIGIN = 0x7FE00000, LENGTH = 16K
> }
>
> /*
> * Define entry point, found in startarm.s
> */
> ENTRY(_reset_handler)
>
> /*
> * Sections
> */
> SECTIONS
> {
> /* Place memory counter at address 0 */
> . = 0;
>
> /* Place startup code at start of flash */
> startup :
> {
> *(.startup)
> } > flash =0
>
> . = ALIGN(4);
>
> /* Place program code */
> prog :
> {
> *(.text)
> *(.rodata)
> *(.rodata*)
> *(glue_7)
> *(glue_7t)
> } > flash =0
>
> . = ALIGN(4);
>
> __end_of_text__ = .;
> __data_beg_src__ = .;
> PROVIDE(etext = .);
>
> /* Place initialized data */
> .data : AT(__data_beg_src__)
> {
> __data_beg__ = .;
> *(.data)
> } > ram
>
> . = ALIGN(4);
> __data_end__ = .;
> PROVIDE(edata = .);
>
> /* Place zero initialized data */
> .bss :
> {
> __bss_beg__ = .;
> *(.bss)
> } >ram
>
>
> /* Align here to ensure that the .bss section occupies space up
to
> _end. Align after .bss to ensure correct alignment even if the
> .bss section disappears because there are no input sections.
*/
> . = ALIGN(32 / 8);
>
> . = ALIGN(32 / 8);
>
> /* Provide end markers */
> _end = .;
> _bss_end__ = .;
> __bss_end__ = .;
> __end__ = .;
> PROVIDE(end = .);
>
> stacklayout :
> {
> __stack_scv_bottom__ = .;
> . = . + 0x0400;
> __stack_scv_top__ = .;
> __stack_irq_bottom__ = .;
> . = . + 0x03BC;
> __stack_irq_top__ = .;
> __stack_fiq_bottom__ = .;
> . = . + 0x0004;
> __stack_fiq_top__ = .;
> __stack_und_bottom__ = .;
> . = . + 0x0004;
> __stack_und_top__ = .;
> __stack_iap_bottom__ = .;
> } >ramstack
>
> usbramlayout :
> {
> __usbram_start__ = .;
> __usbram_end__ = 0x4000;
> } >usbram
>
> ethramlayout :
> {
> __ethram_start__ = .;
> __ethram_end__ = 0x4000;
> } > ethram
> -------------------------------end of file--------------
>
>
>
> Please tell me the modifications I have to carry out.
>
> Thanks and with regards,
> - Nagi
>
>
> --- In l..., "mikkel.kristiansen"
> wrote:
> >
> > I had success making a FreeRTOS LPC2387 port from the LPC2368
> > Eclipse port.
> > One thing that I needed to do was to make sure _bss_end was set
> > correct in LPC2368.ld file.
> >
> > . = ALIGN(32 / 8); //line 44
> > _bss_end__ = . ; __bss_end__ = . ; //this must be moved
> > from the button part to line 45
> >
> > You can test the _bss_end__ in the *.map file � it must be
within
> > RAM area. If it's outside RAM area the boot ram initialisation
loop
> > will run forever.
> >
> > The correct configPINSEL2_VALUE value must be selected.
> >
> > Compile with make all and program the MCB2387 board through ISP,
> > e.g. the "Flash Magic" tool.
> >
> > This got me a working port :-)
> >
> > Best regards
> > Mikkel Kristiansen
> >
> > PS, note that I'm new to FreeRTOS so my input may not be
> > the "correct" solution.
>
Thank you Richard
--- In l..., "FreeRTOS.org Info" wrote:
>
> >
> > thank you for your mail. Please can you elaborate? I am not
> > able to understand what you mean.
>
> I have changed the linker script in the FreeRTOS.org SVN repository
already.
> Take a look there (go the FreeRTOS section on SourceForge to find it).
>
> Regards,
> Richard.
>
> + http://www.FreeRTOS.org
> 17 official architecture ports, more than 6000 downloads per month.
>
> + http://www.SafeRTOS.com
> Certified by T�V as meeting the requirements for safety related systems.
>


Memfault Beyond the Launch