IN THE KNOW
Go to bottomPage: 1
TOPIC:
#986
Confusing "All RAM" linker space allocation report 1 Year ago Karma: 0
Hi all,

I'm confused by the SPACE ALLOCATION reported by the linker in "All RAM" mode.

I'm using:
* ZDS 5.2.0
* eZ80F91 E-NET MODULE 99C0879-001 (non ROHS)
* eZ80 Family Evaluation Platform 99C0858-001

I'm trying to configure the linker to use only the 512KB off-chip RAM for both code and data when developing. But the linker report is:

Code:


SPACE ALLOCATION:
=================

Group: group->name                          Base         Top      Size      Used    Unused
------------------------------------ ----------- ----------- --------- --------- ---------
Space: ROM                                000000      0619FC   100000H    41E64H    BE19CH
                                                            (  1048576    269924    778652)
Space: RAM                                040400      05FDF2    80000H    1F9F3H    6060DH
                                                            (   524288    129523    394765)

Space                     Base         Top      Size      Used    Unused
------------------ ----------- ----------- --------- --------- ---------
RAM                   D:040400    D:05FDF2    80000H    1F9F3H    6060DH
                                          (   524288    129523    394765)
ROM                   C:000000    C:0619FC   100000H    41E64H    BE19CH
                                          (  1048576    269924    778652)



It's reporting ~512K RAM and ~1024K ROM. Why? When I've only configured 512K RAM and no ROM? I've noticed that it seems to allocate ROM with size double what I enter in the RAM range.

The relevant project settings are:
* Link Configuration: All RAM
* Address Spaces: ROM: 000000-07FFFF
* Address Spaces: RAM: (empty)

Debugger settings:
* Target: eZ80DevPlatform_F91_RAM
* Program Counter: 0
* SPL Stack Pointer: 7FFFF
* Chip Select 1 (CS1) Bounds: 000000-07FFFF (this maps RAM into address beginning at 0)
* External RAM: 0-0
* Enable Data RAM: yes
* Enable EMAC RAM: yes
* Enable Flash: no

The space allocation report makes sense when in "Standard" mode.

Cheers
Duncan Campbell-Wilson (User)
Fresh Boarder
Posts: 6
graphgraph
User Offline Click here to see the profile of this user
The administrator has disabled public write access.
 
#989
Re: Confusing "All RAM" linker space allocation report 1 Year ago Karma: 1
Hi Duncan,

This is a clear problem in ZDS concerning calculation of space allocation. I suggest you log this into Zilog's technical support to guarantee that this will be monitored.

I tried the settings you provided using the LedDemo sample program and its running fine. Reviewing the whole map file, it appears that the only problem is on this portion about space allocation. Other than space allocation, everything else in the map file looks good.
angelica mae (User)
Fresh Boarder
Posts: 3
graphgraph
User Offline Click here to see the profile of this user
The administrator has disabled public write access.
 
#1003
Re: Confusing "All RAM" linker space allocation report 1 Year ago Karma: 0
Historically, there was always a ROM and RAM section.
The linker map reflects which code is allocated into which section.
The sections can be contiguous and physically located in SRAM.
From the ZDS2ide.chm help file:

All RAM Configuration

In this configuration, the linker maps all segments associated with the logical ROM address space to physical RAM. ZDS II therefore automatically generates two linker commands. One command combines the spaces into one, and the other defines the physical address range for the combined spaces. The two linker commands are:

GROUP MEMORY=ROM,RAM
This command defines a new address space (MEMORY) that contains the existing logical address spaces RAM and ROM.

RANGE MEMORY $0 : $FFFF
This command defines the valid addresses for the new space.

ZDS II creates the RANGE command starting with the lowest address specified in the New Project Wizard dialog box or the Address Spaces page of the Project Settings dialog box and ending with the highest address. The lowest address is min (min(ROM), min(RAM)) and the highest address is max (max(ROM),max(RAM)). These two ZDS II-generated commands are critical for building an All RAM configuration.

Both the GROUP MEMORY and RANGE MEMORY commands are required for the All RAM configuration. A common error made by users trying to set up this configuration manually is to omit the RANGE MEMORY command. To illustrate the effects of such an error, suppose the New Project Wizard dialog box or the Address Spaces page of the Project Settings dialog box has the following values for a 64K memory machine:

ROM: 0-7FFF

RAM: 8000-FFFF

If the All RAM configuration is not used to create the linker command file, ZDS II converts the values in the New Project Wizard dialog box or the Address Spaces page of the Project Settings dialog box to the following linker commands:

RANGE ROM $0 : $7FFF

RANGE RAM $8000 : $FFFF

which, if followed by

GROUP MEMORY=ROM,RAM

results in ROM segments starting at address $0 and RAM segments starting at $8000, potentially wasting space if the ROM segments do not fully occupy the range from $0 - $7FFF. The following command

RANGE MEMORY $0 : $FFFF

overrides the RANGE commands for the component address spaces and binds the RAM segments immediately after the ROM segments.

NOTE: The names following the = in the GROUP command define an ordering for the new GROUP. In the preceding example, all of the ROM segments are allocated memory at lower addresses than the RAM segments. However, the following GROUP statement locates all of the RAM segments first:

GROUP MEMORY=RAM,ROM

Directives for the All RAM Configuration

Apart from the common directives, the following needs to be added for this configuration:
/* Stack pointer initialization */
DEFINE __stack = highaddr of MEMORY + 1
/* Required for malloc() and free() */
DEFINE __heaptop = highaddr of MEMORY
DEFINE __heapbot = top of MEMORY + 1
/* This is set to 1 only for Copy To RAM configuration */
DEFINE __copy_code_to_ram = 0
Douglas Beattie (User)
Fresh Boarder
Posts: 1
graphgraph
User Offline Click here to see the profile of this user
Location: Greater Salt Lake Area, Utah, USA
The administrator has disabled public write access.
 
Go to topPage: 1