public inbox for ecos-discuss@sourceware.org
 help / color / mirror / Atom feed
From: eibach@gdsys.de
To: ecos-discuss@sources.redhat.com
Subject: [ECOS] Using eb40a external SRAM HOWTO
Date: Mon, 20 Oct 2003 06:33:00 -0000	[thread overview]
Message-ID: <DIIE.00000CD90005C8A6@gdproxy2.gdsys.de> (raw)

Hello,

I have successfully expanded the ram on my eb40a to 1MB. 
I will try to give you a small HOWTO. 

First of all I would suggest to create your own hal subdirectory in order not to mess up the original code. So copy the original /packages/hal/arm/at91/eb40a to somethong like /packages/hal/arm/at91/my_eb40a. In /packages/ecos.ecc you should create your own target that uses the new hal directory. Have a look at the file and do some copy and paste there.
After that you should have a look at my_eb40a/.../include/hal_platform_setup.h. 
There you find the following section:

...
_InitMemory:
long   0x01002535  // 0x01000000, 16MB   This is the Flash ROM
long   0x02002121  // 0x02000000, 16MB   This is the external RAM
...

These values get directly loaded to the EBI Chip Select Registers in the AT91R40008. If you want to know what these values mean, have a look at the datasheet, You only have to change them if you install slow memory chips that need more than 1 wait state or some wait cycles after transfer. I had to do this in may configuration, I also had to change the page size, so here a little example:

...
long   0x02002225  // 0x02000000, 1MB,  1 cycle after transfer, 16-bit, 2 wait states
...

After that have a look at the files in the my_eb40a/.../include/pkgconf/ directory. They define the memory layout of the board. They are all similar, so I give only an example for the RAM version.
Let's start with mlt_arm_at91_eb40a_ram.h.

// original configuration, using the internal RAM
#define CYGMEM_REGION_ram (0x00000000)
#define CYGMEM_REGION_ram_SIZE (0x00040000)
#define CYGMEM_SECTION_heap1_SIZE (0x00040000 - (size_t) CYG_LABEL_NAME (__heap1))

// modified version, using 1MB of external RAM
#define CYGMEM_REGION_ram (0x02000000)
#define CYGMEM_REGION_ram_SIZE (0x00100000)
#define CYGMEM_SECTION_heap1_SIZE (0x02100000 - (size_t) CYG_LABEL_NAME (__heap1))

Next you have to modify mlt_arm_at91_eb40a_ram.ldi.

// original configuration, using the internal RAM
MEMORY
{
    ram : ORIGIN = 0x00000000, LENGTH = 0x40000
}

SECTIONS
{
    SECTIONS_BEGIN
    SECTION_fixed_vectors (ram, 0x20, LMA_EQ_VMA)
    SECTION_rom_vectors (ram, 0xc000, LMA_EQ_VMA)
    SECTION_text (ram, ALIGN (0x4), LMA_EQ_VMA)
    SECTION_fini (ram, ALIGN (0x4), LMA_EQ_VMA)
    SECTION_rodata (ram, ALIGN (0x4), LMA_EQ_VMA)
    SECTION_rodata1 (ram, ALIGN (0x4), LMA_EQ_VMA)
    SECTION_fixup (ram, ALIGN (0x4), LMA_EQ_VMA)
    SECTION_gcc_except_table (ram, ALIGN (0x4), LMA_EQ_VMA)
    SECTION_data (ram, ALIGN (0x4), LMA_EQ_VMA)
    SECTION_bss (ram, ALIGN (0x4), LMA_EQ_VMA)
    CYG_LABEL_DEFN(__heap1) = ALIGN (0x8);
    SECTIONS_END
}

// modified version, using 1MB of external RAM
MEMORY
{
    ram : ORIGIN = 0x02000000, LENGTH = 0x100000
}

SECTIONS
{
    SECTIONS_BEGIN
    SECTION_fixed_vectors (ram, 0x02000020, LMA_EQ_VMA)
    SECTION_rom_vectors (ram, 0x0200c000, LMA_EQ_VMA)
    SECTION_text (ram, ALIGN (0x4), LMA_EQ_VMA)
    SECTION_fini (ram, ALIGN (0x4), LMA_EQ_VMA)
    SECTION_rodata (ram, ALIGN (0x4), LMA_EQ_VMA)
    SECTION_rodata1 (ram, ALIGN (0x4), LMA_EQ_VMA)
    SECTION_fixup (ram, ALIGN (0x4), LMA_EQ_VMA)
    SECTION_gcc_except_table (ram, ALIGN (0x4), LMA_EQ_VMA)
    SECTION_data (ram, ALIGN (0x4), LMA_EQ_VMA)
    SECTION_bss (ram, ALIGN (0x4), LMA_EQ_VMA)
    CYG_LABEL_DEFN(__heap1) = ALIGN (0x8);
    SECTIONS_END
}

Do these changes also to the ROM and the ROMRAM configurations.

Now you have to build a new redboot, that uses your modified my_eb40a package.
After flashing redboot, your prompt should look like that:

RedBoot(tm) bootstrap and debug environment [ROM]
Non-certified release, version UNKNOWN - built 16:04:24, Oct 10 2003

Platform: Atmel AT91/EB40A (ARM7TDMI)
Copyright (C) 2000, 2001, 2002, Red Hat, Inc.

RAM: 0x02000000-0x02100000, 0x0200a7a8-0x020ff000 available
FLASH: 0x01010000 - 0x01200000, 31 blocks of 0x00010000 bytes each.
RedBoot>

Now you have to build ecos with the new package an link it to your application. That's all.

I hope this is helpful. Any suggestions for improvement are appreciated.

Best regards to all the ecos freaks out there,
Dirk


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

             reply	other threads:[~2003-10-20  6:33 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2003-10-20  6:33 eibach [this message]
2003-10-22  6:43 ` Greg Holdren

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=DIIE.00000CD90005C8A6@gdproxy2.gdsys.de \
    --to=eibach@gdsys.de \
    --cc=ecos-discuss@sources.redhat.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).