Where is Memory Map/Usage

Technical questions regarding the xTIMEcomposer, xSOFTip Explorer and Programming with XMOS.
kster59
XCore Addict
Posts: 162
Joined: Thu Dec 31, 2009 8:51 am

Where is Memory Map/Usage

Postby kster59 » Wed Feb 10, 2010 9:37 am

In the XDE, where do I find the Memory Map/Usage for the my .Xc program?

I'd like to know how much memory usage I am using for code and variable space.
User avatar
trousers
Active Member
Posts: 44
Joined: Fri Dec 11, 2009 10:20 am

Postby trousers » Wed Feb 10, 2010 11:28 am

There isn't a specific button to press in the XDE but if you add the xmap option below then you'll get a memory usage map at the final link. You get the mapfile even if the program is too big to fit in memory (so you can see what's taking up all the space).

Code: Select all

--map <file>
Best friends with the code fairy.
JohnR
Experienced Member
Posts: 93
Joined: Fri Dec 11, 2009 1:39 pm

Postby JohnR » Wed Feb 10, 2010 3:08 pm

Where do you put the --map option in the IDE? I have tried putting it under the Mapper heading as well as the XC compiler heading. I specified the output as --map > test.txt. The best I got was an empty .txt file.

I also tried this option with the command line compiler without success. What is the correct invocation in this case?

Thanks

John.
User avatar
trousers
Active Member
Posts: 44
Joined: Fri Dec 11, 2009 10:20 am

Postby trousers » Wed Feb 10, 2010 3:28 pm

You don't need to (or rather "can't") use shell redirection with the --map option; it outputs to the named file, not stdout.

I'm told that in the XDE, when you find the correct box for adding xmap options, you need only add "--map file" i.e. you don't need the -Xmapper stuff shown below.

A worked example:

test.xc:

Code: Select all

int main(){return(0);}
Compile with:

Code: Select all

xcc test.xc -target=XK-1 -Xmapper --map -Xmapper mapfile
Output is in "mapfile":

Code: Select all

Memory map for node 0, core 0
==============================

Sections:

  Name                 Start    Length
  -------------------- -------- --------
  .text                00010000 000001b2
  .init                000101b2 0000005c
  .fini                0001020e 0000003a
  .gnu.linkonce.t.__call_exitprocs_impl 00010248 00000002
  .gnu.linkonce.t._cleanup_impl 0001024a 00000002
  .rodata              0001024c 00000004
  .bss                 00010250 00000000
  .cp.const4           00010250 00000000
  .cp.rodata           00010250 00000000
  .ctors               00010250 00000000
  .dtors               00010250 00000000
  .dp.data             00010250 00000014
  .eh_frame            00010264 00000004
  .dp.bss              00010268 00000020

Symbols:

  Address  Size     Section              Name
  -------- -------- -------------------- --------------------
  00010000 00000000 .text                _start
  00010026 00000000 .text                _InitThreadLoop
  00010030 00000000 .text                _GetRamEnd
  00010040 00000000 .text                _ExitWithError
  00010044 00000000 .text                _Join
  00010066 00000000 .text                _NonZeroReturn
  0001006a 00000000 .text                _InitThread
  00010080 00000000 .text                _TrapHandler
  00010084 00000000 .text                _InitThreadRoutine
  0001008a 00000000 .text                _TouchRegisters
  000100a4 00000000 .text                _SetupTraps
  000100aa 00000000 .text                __register_frame_info_bases
  000100aa 00000000 .text                __free_libc_hwlock
  000100ac 00000000 .text                main
  000100b0 00000000 .text                _DoException
  000100b4 00000000 .text                __libc_done
  000100ca 00000000 .text                _done
  000100d4 00000000 .text                _exit
  000100e0 00000000 .text                _exit_unlocked
  000100fa 00000000 .text                memset
  00010196 00000000 .text                _DoSyscall
  0001019a 00000000 .text                __call_exitprocs
  000101a2 00000000 .text                __alloc_libc_hwlock
  000101aa 00000000 .text                _cleanup
  000101b2 00000000 .init                _init
  00010202 00000000 .init                do_ctors_loop
  0001020c 00000000 .init                do_ctors_end
  0001020e 00000000 .fini                _fini
  00010230 00000000 .fini                do_dtors_loop
  0001023c 00000000 .fini                do_dtors_end
  00010248 00000000 .gnu.linkonce.t.__call_exitprocs_impl __call_exitprocs_impl
  0001024a 00000000 .gnu.linkonce.t._cleanup_impl _cleanup_impl
  0001024c 00000000 .rodata              _RamSize
  00010250 00000000 .cp.rodata           _cp
  00010250 00000000 .dp.data             _dp
  00010250 00000000 .bss                 _fbss
  00010250 00000000 .ctors               _CTOR_LIST_
  00010250 00000000 .dtors               _DTOR_LIST_
  00010250 00000000 .dp.data             _NullPtr
  00010250 00000000 .bss                 _ebss
  00010250 00000000 .dtors               _DTOR_END_
  00010250 00000000 .ctors               _CTOR_END_
  00010254 00000000 .dp.data             dtor_list_ptr
  00010258 00000000 .dp.data             dtors_size
  0001025c 00000000 .dp.data             ctor_list_ptr
  00010260 00000000 .dp.data             ctors_size
  00010264 00000000 .eh_frame            __EH_FRAME_BEGIN__
  00010264 00000000 .eh_frame            __EH_FRAME_END__
  00010268 00000000 .dp.bss              _fdp.bss
  00010268 00000004 .dp.bss              __libc_hwlock
  0001026c 00000000 .dp.bss              __eh_object
  00010288 00000000 .dp.bss              _edp.bss
Best friends with the code fairy.
JohnR
Experienced Member
Posts: 93
Joined: Fri Dec 11, 2009 1:39 pm

Postby JohnR » Wed Feb 10, 2010 7:13 pm

Thanks - that worked for both the IDE and the command compiler.
John.
kster59
XCore Addict
Posts: 162
Joined: Thu Dec 31, 2009 8:51 am

Postby kster59 » Wed Feb 10, 2010 9:58 pm

Thanks for the response. Which document has the memory map addresses for the L1-128? It doesn't seem to be in the datasheet.

Does memory start at 0x10000 and span for 64k -> so 0x10000-0x1FFFF ?

Thanks.
User avatar
trousers
Active Member
Posts: 44
Joined: Fri Dec 11, 2009 10:20 am

Postby trousers » Thu Feb 11, 2010 12:18 pm

The memory for each core occupies 64KB of contiguous space. The base address is configurable using the PS_RAM_BASE register however the boot ROM always programs it to 0x10000 and it would be of little value to change this.

The boot ROM lives at 0xffffc000.

I don't recall seeing a memory map anywhere, probably because it's so simple it doesn't really deserve to be drawn.
Best friends with the code fairy.
User avatar
Andy
Respected Member
Posts: 279
Joined: Fri Dec 11, 2009 1:34 pm

Postby Andy » Thu Feb 11, 2010 10:15 pm

I don't think it would be a terrible idea to display a basic output of memory usage on each core, by default, in the tools after compile. The current --show-report output is not the easiest thing to interpret.

Who is online

Users browsing this forum: No registered users and 0 guests