public inbox for ecos-discuss@sourceware.org
 help / color / mirror / Atom feed
* Re: [ECOS] AT91SAM7SE with external SDRAM
       [not found] <E1IN2rI-00066c-00@londo.lunn.ch>
@ 2007-08-20 10:15 ` Andrew Lunn
  2007-08-20 11:36   ` jc.caquet
                     ` (2 more replies)
  0 siblings, 3 replies; 5+ messages in thread
From: Andrew Lunn @ 2007-08-20 10:15 UTC (permalink / raw)
  To: jc.caquet; +Cc: ecos-discuss

On Mon, Aug 20, 2007 at 10:43:31AM +0200, jc.caquet@kerlink.fr wrote:
> Dear all,
> we are trying to setup ECOS in order to use an SDRAM connected on the
> external bus of an AT91SAM7SE. We had a look at the init process of ECOS and
> we have some difficulties to understand when software is supposed to
> configure SDRAM controller

hal_platform_setup.h normally does this. For example, take a look at
hal/arm/ebsa285/current/include/hal_platform_setup.h. It defines the
macros PLATFORM_SETUP1 which gets called in vectors.S early in the
startup process. PLATFORM_SETUP1 includes the macro call
CALL_MEMINIT_CODE. This macros calls into the function __mem285_init
in packages/hal/arm/ebsa285/current/src/mem285.S. This is all in
assembly because at this point you don't have any RAM, just the
processor registers.

> and so when it is supposed to switch from internal SRAM to external
> SDRAM.

This is not the usual model. Few processors have both internal SRAM
and external SDRAM. Those that do, generally follow the process above,
ie start the SDRAM in assembly during the early state up code and then
use the external SDRAM and virtually ignore the SRAM. Maybe using
compiler attributes they move some data structures into SRAM, but
otherwise it is not used.

> Massa chapter HAL startup explains that a storage area is reserved for
> insterrupt stack?; should it be in SDRAM?at that point?? When does ECOS
> start using the heap??
> The only place where we find SDRAM address/size is in

> hal/arm/at91/at91sam7s/current/include/pkgconf/mlt_arm_at91sam7s256_rom.h /
> mlt_arm_at91sam7s256_rom.ldi. How are they generated??

They are "generated" by hand.

You have to think, do you want to follow this model? Or do you want to
do something different?

   Andrew

-- 
Before posting, please read the FAQ: http://ecos.sourceware.org/fom/ecos
and search the list archive: http://ecos.sourceware.org/ml/ecos-discuss

^ permalink raw reply	[flat|nested] 5+ messages in thread

* RE: [ECOS] AT91SAM7SE with external SDRAM
  2007-08-20 10:15 ` [ECOS] AT91SAM7SE with external SDRAM Andrew Lunn
@ 2007-08-20 11:36   ` jc.caquet
       [not found]   ` <60i8ie$1m4j24@mgcp1.bloomberg.com>
       [not found]   ` <E1IN5Yg-0006d9-00@londo.lunn.ch>
  2 siblings, 0 replies; 5+ messages in thread
From: jc.caquet @ 2007-08-20 11:36 UTC (permalink / raw)
  To: 'Andrew Lunn'; +Cc: ecos-discuss



-----Message d'origine-----
De : ecos-discuss-owner@ecos.sourceware.org
[mailto:ecos-discuss-owner@ecos.sourceware.org] De la part de Andrew Lunn
Envoyé : lundi 20 août 2007 11:15
À : jc.caquet@kerlink.fr
Cc : ecos-discuss@ecos.sourceware.org
Objet : Re: [ECOS] AT91SAM7SE with external SDRAM

On Mon, Aug 20, 2007 at 10:43:31AM +0200, jc.caquet@kerlink.fr wrote:
> Dear all,
> we are trying to setup ECOS in order to use an SDRAM connected on the
> external bus of an AT91SAM7SE. We had a look at the init process of ECOS
and
> we have some difficulties to understand when software is supposed to
> configure SDRAM controller

hal_platform_setup.h normally does this. For example, take a look at
hal/arm/ebsa285/current/include/hal_platform_setup.h. It defines the
macros PLATFORM_SETUP1 which gets called in vectors.S early in the
startup process. PLATFORM_SETUP1 includes the macro call
CALL_MEMINIT_CODE. This macros calls into the function __mem285_init
in packages/hal/arm/ebsa285/current/src/mem285.S. This is all in
assembly because at this point you don't have any RAM, just the
processor registers.

> and so when it is supposed to switch from internal SRAM to external
> SDRAM.

This is not the usual model. Few processors have both internal SRAM
and external SDRAM. Those that do, generally follow the process above,
ie start the SDRAM in assembly during the early state up code and then
use the external SDRAM and virtually ignore the SRAM. Maybe using
compiler attributes they move some data structures into SRAM, but
otherwise it is not used.

> Massa chapter HAL startup explains that a storage area is reserved for
> insterrupt stack?; should it be in SDRAM?at that point?? When does ECOS
> start using the heap??
> The only place where we find SDRAM address/size is in

> hal/arm/at91/at91sam7s/current/include/pkgconf/mlt_arm_at91sam7s256_rom.h
/
> mlt_arm_at91sam7s256_rom.ldi. How are they generated??

They are "generated" by hand.

You have to think, do you want to follow this model? Or do you want to
do something different?

   Andrew


As soon as SDRAM config has been done at the right place is it enough to
change address/size values in mt_arm_at91sam7se512_rom.h/.ldi files so that
ECOS uses SDRAM ?
Why not to configure SDRAM in hal_hardware_init that seems to be the first C
code section called from vectors.S, we don't have any skills in ARM assembly
here...

JC


--
Before posting, please read the FAQ: http://ecos.sourceware.org/fom/ecos
and search the list archive: http://ecos.sourceware.org/ml/ecos-discuss

^ permalink raw reply	[flat|nested] 5+ messages in thread

* RE: [ECOS] AT91SAM7SE with external SDRAM
       [not found]   ` <60i8ie$1m4j24@mgcp1.bloomberg.com>
@ 2007-08-20 12:29     ` Chris Zimman
  0 siblings, 0 replies; 5+ messages in thread
From: Chris Zimman @ 2007-08-20 12:29 UTC (permalink / raw)
  To: jc.caquet; +Cc: ecos-discuss

> As soon as SDRAM config has been done at the right place is it enough
to
> change address/size values in mt_arm_at91sam7se512_rom.h/.ldi files so
> that ECOS uses SDRAM ?
> Why not to configure SDRAM in hal_hardware_init that seems to be the
first > C code section called from vectors.S, we don't have any skills
in ARM
> assembly here...

Most of the platforms use a templated setup in hal_platform_setup.h, eg.

packages/hal/arm/at91/[your
platform]/current/include/hal_platform_setup.h

[...]

_InitMemory:
        .long   0x01002529  // 0x01000000, 16MB,  2 cycles  after
transfer, 				    // 16-bit, 6 wait states
        .long   0x02002121  // 0x02000000, 16MB,  0 cycles after
transfer, 				    // 16-bit, 1 wait state
        .long   0x20000000  // unused
        .long   0x30000000  // unused
        .long   0x05002021  // 0x05000000, 1MB,   0 cycles after
transfer, 				    // 16-bit, 1 wait state
(MEC01 on CS4)
        .long   0x05102021  // 0x05100000, 1MB,   0 cycles after
transfer, 				    // 16-bit, 1 wait state
(MEC01 on CS5)
        .long   0x60000000  // unused
        .long   0x70000000  // unused
        .long   0x00000001  // REMAP command
        .long   0x00000000  // Standard read protocol
        .long   AT91_EBI    // External Bus Interface address
        .long   10f         // address where to jump

[...]

Figure out what the correct values for the EBI chip selects are for your
platform and then add them here.

Extensive ARM assembly skills are not required, just a little bit of
reading and perhaps stepping through the setup code with a debugger if
things don't go how you're expecting.

--Chris

--
Before posting, please read the FAQ: http://ecos.sourceware.org/fom/ecos
and search the list archive: http://ecos.sourceware.org/ml/ecos-discuss

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [ECOS] AT91SAM7SE with external SDRAM
       [not found]   ` <E1IN5Yg-0006d9-00@londo.lunn.ch>
@ 2007-08-20 13:09     ` Andrew Lunn
  0 siblings, 0 replies; 5+ messages in thread
From: Andrew Lunn @ 2007-08-20 13:09 UTC (permalink / raw)
  To: jc.caquet; +Cc: 'Andrew Lunn', ecos-discuss

> As soon as SDRAM config has been done at the right place is it enough to
> change address/size values in mt_arm_at91sam7se512_rom.h/.ldi files so that
> ECOS uses SDRAM ?

Probably that is all that is needed. However i cannot guarantee it. If
it does not work, you will need to single step thought the start up
code. The start up code unmaps the FLASH from 0x0 and maps the SRAM to
0x0. In particularly you need to check that the interrupt vectors stay
in SRAM at 0x0-0x40 and don't get placed at SDRAM+0 - SDRAM+0x40.

> Why not to configure SDRAM in hal_hardware_init that seems to be the first C
> code section called from vectors.S, we don't have any skills in ARM assembly
> here...

The problem is that C requires a stack. The stack has to be in
RAM. But until you have the SDRAM controller initialized, you don't
have any RAM.

However for the AT91SAM7 what you might be able to do is in assembly
language, in your hal_platform_setup is set the stack pointer to the
SRAM. Then call into a C function which initializes the SDRAM
controller. When the C function exists normal eCos code with take over
and then correctly setup the stack in SDRAM.

    Andrew

-- 
Before posting, please read the FAQ: http://ecos.sourceware.org/fom/ecos
and search the list archive: http://ecos.sourceware.org/ml/ecos-discuss

^ permalink raw reply	[flat|nested] 5+ messages in thread

* [ECOS] AT91SAM7SE with external SDRAM
@ 2007-08-20  8:43 jc.caquet
  0 siblings, 0 replies; 5+ messages in thread
From: jc.caquet @ 2007-08-20  8:43 UTC (permalink / raw)
  To: ecos-discuss

Dear all,
we are trying to setup ECOS in order to use an SDRAM connected on the
external bus of an AT91SAM7SE. We had a look at the init process of ECOS and
we have some difficulties to understand when software is supposed to
configure SDRAM controller, and so when it is supposed to switch from
internal SRAM to external SDRAM.
Massa chapter HAL startup explains that a storage area is reserved for
insterrupt stack ; should it be in SDRAM at that point ? When does ECOS
start using the heap ?
The only place where we find SDRAM address/size is in
hal/arm/at91/at91sam7s/current/include/pkgconf/mlt_arm_at91sam7s256_rom.h /
mlt_arm_at91sam7s256_rom.ldi. How are they generated ?

JC



--
Before posting, please read the FAQ: http://ecos.sourceware.org/fom/ecos
and search the list archive: http://ecos.sourceware.org/ml/ecos-discuss

^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2007-08-20 13:09 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
     [not found] <E1IN2rI-00066c-00@londo.lunn.ch>
2007-08-20 10:15 ` [ECOS] AT91SAM7SE with external SDRAM Andrew Lunn
2007-08-20 11:36   ` jc.caquet
     [not found]   ` <60i8ie$1m4j24@mgcp1.bloomberg.com>
2007-08-20 12:29     ` Chris Zimman
     [not found]   ` <E1IN5Yg-0006d9-00@londo.lunn.ch>
2007-08-20 13:09     ` Andrew Lunn
2007-08-20  8:43 jc.caquet

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).