public inbox for ecos-discuss@sourceware.org
 help / color / mirror / Atom feed
* [ECOS] unaligned half-word flash memory access on a EB55/AT91
@ 2005-05-06 18:51 Marcel Ovidiu Achim
  2005-05-06 19:31 ` Marcel Ovidiu Achim
  2005-05-06 20:12 ` Andrew Lunn
  0 siblings, 2 replies; 3+ messages in thread
From: Marcel Ovidiu Achim @ 2005-05-06 18:51 UTC (permalink / raw)
  To: ecos-discuss, ecos-discuss

Hi all,

I am using eCos on an Atmel EB55 board. For an application I need to
store data into the on board flash device. My compiled code seams to
do an unaligned access to the on board flash which is enabled by the
NCS0 line.

This is a very simple code for a better understanding.

// Set the EBI_CSR0 register for 16 bit access etc.
HAL_WRITE_UINT32(0xFFE00000, 0x010030A1);

// Write 0xAA to address 0x555 of into the flash device.
// Note: this is not the whole prog. seq.
HAL_WRITE_UINT16(0x01000000 + 0x555, 0xAA);

An osciloscope shows that the write seqence did start from A0
instead of A1 which should be implicated for a half-word access.

The header file hal_io.h defines HAL_WRITE_UNIT16 to be of type
"short". However, for my compiled code short is 32bit (word) wide.
I expected "short" to be 16 bit. I compiled my code with gcc without
any flags.

I wonder why gcc compiles "short" into a "word" type. Do I need to
set a flag for gcc while compiling my code or do I even need to
recompile gcc itself? Is there any other register for the AT91 that
influence the MAS[0:1] bus for the ARM7TDMI to force the core to do
a half-word reading or writing?

Thanks for your advice and greetings from Stuttgart/Germany

Marcel Achim

-- 
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] 3+ messages in thread

* [ECOS] unaligned half-word flash memory access on a EB55/AT91
  2005-05-06 18:51 [ECOS] unaligned half-word flash memory access on a EB55/AT91 Marcel Ovidiu Achim
@ 2005-05-06 19:31 ` Marcel Ovidiu Achim
  2005-05-06 20:12 ` Andrew Lunn
  1 sibling, 0 replies; 3+ messages in thread
From: Marcel Ovidiu Achim @ 2005-05-06 19:31 UTC (permalink / raw)
  To: ecos-discuss, ecos-discuss

Hi all,

I am using eCos on an Atmel EB55 board. For an application I need to
store data into the on board flash device. My compiled code seams to
do an unaligned access to the on board flash which is enabled by the
NCS0 line.

This is a very simple code for a better understanding.

// Set the EBI_CSR0 register for 16 bit access etc.
HAL_WRITE_UINT32(0xFFE00000, 0x010030A1);

// Write 0xAA to address 0x555 of into the flash device.
// Note: this is not the whole prog. seq.
HAL_WRITE_UINT16(0x01000000 + 0x555, 0xAA);

An osciloscope shows that the write seqence did start from A0
instead of A1 which should be implicated for a half-word access.

The header file hal_io.h defines HAL_WRITE_UNIT16 to be of type
"short". However, for my compiled code short is 32bit (word) wide.
I expected "short" to be 16 bit. I compiled my code with gcc without
any flags.

I wonder why gcc compiles "short" into a "word" type. Do I need to
set a flag for gcc while compiling my code or do I even need to
recompile gcc itself? Is there any other register for the AT91 that
influence the MAS[0:1] bus for the ARM7TDMI to force the core to do
a half-word reading or writing?

Thanks for your advice and greetings from Stuttgart/Germany

Marcel Achim

-- 
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] 3+ messages in thread

* Re: [ECOS] unaligned half-word flash memory access on a EB55/AT91
  2005-05-06 18:51 [ECOS] unaligned half-word flash memory access on a EB55/AT91 Marcel Ovidiu Achim
  2005-05-06 19:31 ` Marcel Ovidiu Achim
@ 2005-05-06 20:12 ` Andrew Lunn
  1 sibling, 0 replies; 3+ messages in thread
From: Andrew Lunn @ 2005-05-06 20:12 UTC (permalink / raw)
  To: Marcel Ovidiu Achim; +Cc: ecos-discuss

On Fri, May 06, 2005 at 08:51:17PM +0200, Marcel Ovidiu Achim wrote:
> Hi all,
> 
> I am using eCos on an Atmel EB55 board. For an application I need to
> store data into the on board flash device. My compiled code seams to
> do an unaligned access to the on board flash which is enabled by the
> NCS0 line.
> 
> This is a very simple code for a better understanding.
> 
> // Set the EBI_CSR0 register for 16 bit access etc.
> HAL_WRITE_UINT32(0xFFE00000, 0x010030A1);
> 
> // Write 0xAA to address 0x555 of into the flash device.
> // Note: this is not the whole prog. seq.
> HAL_WRITE_UINT16(0x01000000 + 0x555, 0xAA);

I don't think this is allowed. You have to do 16 bit accesses on 16
bit aligned addresses. Maybe you want to do:

HAL_WRITE_UINT8(0x01000000 + 0x555, 0xAA);
HAL_WRITE_UINT8(0x01000000 + 0x556, 0x00);

which will acheive the same but will do it in a legal way.

        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] 3+ messages in thread

end of thread, other threads:[~2005-05-06 20:04 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2005-05-06 18:51 [ECOS] unaligned half-word flash memory access on a EB55/AT91 Marcel Ovidiu Achim
2005-05-06 19:31 ` Marcel Ovidiu Achim
2005-05-06 20:12 ` Andrew Lunn

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).