#111704 - biolizard89 - Sat Dec 09, 2006 5:45 am
I see this in the FAQ:
Quote: |
Q: How do I put large (> 16 KB) arrays into a program without it crashing?
The linker script included with devkitARM puts arrays and other variables into IWRAM unless you tell it otherwise. Trouble is IWRAM is only 32 KiB. For arrays that you don't plan to modify, use the keyword const, which will instruct the linker to put the entire array into ROM (or EWRAM for .mb programs). For arrays that you do plan to modify, put them into EWRAM using a section attribute on the array's definition:
* __attribute__((section (".sbss"))) char foo[8192];
Puts the variable in EWRAM and initializes it to zero at program start. (Initializer values are ignored.)
* __attribute__((section (".ewram"))) char foo[8192] = {3, 4, /*... */ };
Puts the variable in EWRAM and initializes it to the given values at program start. (This uses space in the binary even if initializer values are not given.) |
I've been working with a program which does use the const keyword on some arrays (6 Direct Sound recordings which total 230KiB compiled), but it crashes when the arrays are compiled in. When the arrays are replaced with a single 4-byte array, the program works perfectly. Thing is, I'm using an old version of DevKitAdv (older than Aug 2004). Do old versions of DevKitAdv not recognize the const keyword the same way as current versions of DevKitARM?
Thanks in advance.
#111714 - tepples - Sat Dec 09, 2006 10:04 am
The first GBA port of TOD (developed in 2002) was done on DevKit Advance, and it seemed to do the right thing with the const qualifier back then.
When you run arm-agb-elf-nm -n mygame.elf (in modern devkit replace arm-agb-elf- with arm-eabi-), what addresses does it give for the sound? And is it really a size issue or just an alignment issue? And are you using C or assembly language to "compile in" the arrays?
_________________
-- Where is he?
-- Who?
-- You know, the human.
-- I think he moved to Tilwick.
#111727 - gmiller - Sat Dec 09, 2006 3:11 pm
I generally produce a map file to see where everything is loaded. It can be informative. I was surprised to see the use of the different memory regions.
Code: |
Archive member included because of file (symbol)
c:/devkitpro/devkitarm/bin/../lib/gcc/arm-eabi/4.1.1\libgcc.a(_call_via_rX.o)
c:/devkitpro/devkitarm/bin/../lib/gcc/arm-eabi/4.1.1/../../../../arm-eabi/lib/gba_crt0.o (_call_via_r3)
c:/devkitpro/devkitarm/bin/../lib/gcc/arm-eabi/4.1.1/../../../../arm-eabi/lib\libc.a(init.o)
c:/devkitpro/devkitarm/bin/../lib/gcc/arm-eabi/4.1.1/../../../../arm-eabi/lib/gba_crt0.o (__libc_init_array)
c:/devkitpro/devkitarm/bin/../lib/gcc/arm-eabi/4.1.1/../../../../arm-eabi/lib\libc.a(rand.o)
main.o (rand)
c:/devkitpro/devkitarm/bin/../lib/gcc/arm-eabi/4.1.1/../../../../arm-eabi/lib\libc.a(impure.o)
c:/devkitpro/devkitarm/bin/../lib/gcc/arm-eabi/4.1.1/../../../../arm-eabi/lib\libc.a(rand.o) (_impure_ptr)
c:/devkitpro/devkitarm/bin/../lib/gcc/arm-eabi/4.1.1/../../../../arm-eabi/lib\libsysbase.a(malloc_vars.o)
c:/devkitpro/devkitarm/bin/../lib/gcc/arm-eabi/4.1.1/../../../../arm-eabi/lib/gba_crt0.o (fake_heap_end)
Memory Configuration
Name Origin Length Attributes
rom 0x08000000 0x02000000
iwram 0x03000000 0x00008000
ewram 0x02000000 0x00040000
*default* 0x00000000 0xffffffff
Linker script and memory map
0x08000000 __text_start = 0x8000000
0x02040000 __eheap_end = 0x2040000
0x03000000 __iwram_start = 0x3000000
0x03008000 __iwram_top = 0x3008000
0x03007f00 __sp_irq = (__iwram_top - 0x100)
0x03007e00 __sp_usr = (__sp_irq - 0x100)
0x03007ff8 __irq_flags = 0x3007ff8
0x08000000 . = __text_start
.init 0x08000000 0x224
*(.init)
.init 0x08000000 0x20c c:/devkitpro/devkitarm/bin/../lib/gcc/arm-eabi/4.1.1/../../../../arm-eabi/lib/gba_crt0.o
0x080000c4 __boot_method
0x080000c5 __slave_number
0x08000000 _start
0x080000e0 start_vector
.init 0x0800020c 0xc c:/devkitpro/devkitarm/bin/../lib/gcc/arm-eabi/4.1.1/crti.o
0x0800020c _init
.init 0x08000218 0xc c:/devkitpro/devkitarm/bin/../lib/gcc/arm-eabi/4.1.1/crtn.o
0x08000224 . = ALIGN (0x4)
.plt 0x08000224 0x0
*(.plt)
0x08000224 . = ALIGN (0x4)
.text 0x08000228 0x9d0
*(EXCLUDE_FILE(*.iwram*) .text)
.text 0x08000228 0x0 c:/devkitpro/devkitarm/bin/../lib/gcc/arm-eabi/4.1.1/../../../../arm-eabi/lib/gba_crt0.o
.text 0x08000228 0x0 c:/devkitpro/devkitarm/bin/../lib/gcc/arm-eabi/4.1.1/crti.o
.text 0x08000228 0xa4 c:/devkitpro/devkitarm/bin/../lib/gcc/arm-eabi/4.1.1/crtbegin.o
.text 0x080002cc 0x8 bg.raw.o
0x080002cc bg_Bitmap_Size
.text 0x080002d4 0x794 main.o
0x0800033c MoveSprite
0x080003cc InitSprite
0x0800045c WaitVBlank
0x08000310 HideSprites
0x08000394 UpdateSpriteMemory
0x08000480 main
0x080002d4 Memory_DMAFastCopy
.text 0x08000a68 0x3c c:/devkitpro/devkitarm/bin/../lib/gcc/arm-eabi/4.1.1\libgcc.a(_call_via_rX.o)
0x08000a70 _call_via_r2
0x08000a80 _call_via_r6
0x08000a7c _call_via_r5
0x08000a74 _call_via_r3
0x08000a94 _call_via_fp
0x08000a88 _call_via_r8
0x08000a84 _call_via_r7
0x08000a68 _call_via_r0
0x08000a90 _call_via_sl
0x08000a9c _call_via_sp
0x08000a8c _call_via_r9
0x08000a78 _call_via_r4
0x08000a6c _call_via_r1
0x08000a98 _call_via_ip
0x08000aa0 _call_via_lr
.text 0x08000aa4 0xd4 c:/devkitpro/devkitarm/bin/../lib/gcc/arm-eabi/4.1.1/../../../../arm-eabi/lib\libc.a(init.o)
0x08000af0 __libc_init_array
0x08000aa4 __libc_fini_array
.text 0x08000b78 0x80 c:/devkitpro/devkitarm/bin/../lib/gcc/arm-eabi/4.1.1/../../../../arm-eabi/lib\libc.a(rand.o)
0x08000b94 rand
0x08000b78 srand
.text 0x08000bf8 0x0 c:/devkitpro/devkitarm/bin/../lib/gcc/arm-eabi/4.1.1/../../../../arm-eabi/lib\libc.a(impure.o)
.text 0x08000bf8 0x0 c:/devkitpro/devkitarm/bin/../lib/gcc/arm-eabi/4.1.1/../../../../arm-eabi/lib\libsysbase.a(malloc_vars.o)
.text 0x08000bf8 0x0 c:/devkitpro/devkitarm/bin/../lib/gcc/arm-eabi/4.1.1/crtend.o
.text 0x08000bf8 0x0 c:/devkitpro/devkitarm/bin/../lib/gcc/arm-eabi/4.1.1/crtn.o
*(.text.*)
*(.stub)
*(.gnu.warning)
*(.gnu.linkonce.t*)
*(.glue_7)
.glue_7 0x08000bf8 0x0 c:/devkitpro/devkitarm/bin/../lib/gcc/arm-eabi/4.1.1/../../../../arm-eabi/lib/gba_crt0.o
.glue_7 0x08000bf8 0x0 c:/devkitpro/devkitarm/bin/../lib/gcc/arm-eabi/4.1.1/crti.o
.glue_7 0x08000bf8 0x0 c:/devkitpro/devkitarm/bin/../lib/gcc/arm-eabi/4.1.1/crtbegin.o
.glue_7 0x08000bf8 0x0 bg.raw.o
.glue_7 0x08000bf8 0x0 main.o
.glue_7 0x08000bf8 0x0 c:/devkitpro/devkitarm/bin/../lib/gcc/arm-eabi/4.1.1\libgcc.a(_call_via_rX.o)
.glue_7 0x08000bf8 0x0 c:/devkitpro/devkitarm/bin/../lib/gcc/arm-eabi/4.1.1/../../../../arm-eabi/lib\libc.a(init.o)
.glue_7 0x08000bf8 0x0 c:/devkitpro/devkitarm/bin/../lib/gcc/arm-eabi/4.1.1/../../../../arm-eabi/lib\libc.a(rand.o)
.glue_7 0x08000bf8 0x0 c:/devkitpro/devkitarm/bin/../lib/gcc/arm-eabi/4.1.1/../../../../arm-eabi/lib\libc.a(impure.o)
.glue_7 0x08000bf8 0x0 c:/devkitpro/devkitarm/bin/../lib/gcc/arm-eabi/4.1.1/../../../../arm-eabi/lib\libsysbase.a(malloc_vars.o)
.glue_7 0x08000bf8 0x0 c:/devkitpro/devkitarm/bin/../lib/gcc/arm-eabi/4.1.1/crtend.o
.glue_7 0x08000bf8 0x0 c:/devkitpro/devkitarm/bin/../lib/gcc/arm-eabi/4.1.1/crtn.o
*(.glue_7t)
.glue_7t 0x08000bf8 0x0 c:/devkitpro/devkitarm/bin/../lib/gcc/arm-eabi/4.1.1/../../../../arm-eabi/lib/gba_crt0.o
.glue_7t 0x08000bf8 0x0 c:/devkitpro/devkitarm/bin/../lib/gcc/arm-eabi/4.1.1/crti.o
.glue_7t 0x08000bf8 0x0 c:/devkitpro/devkitarm/bin/../lib/gcc/arm-eabi/4.1.1/crtbegin.o
.glue_7t 0x08000bf8 0x0 bg.raw.o
.glue_7t 0x08000bf8 0x0 main.o
.glue_7t 0x08000bf8 0x0 c:/devkitpro/devkitarm/bin/../lib/gcc/arm-eabi/4.1.1\libgcc.a(_call_via_rX.o)
.glue_7t 0x08000bf8 0x0 c:/devkitpro/devkitarm/bin/../lib/gcc/arm-eabi/4.1.1/../../../../arm-eabi/lib\libc.a(init.o)
.glue_7t 0x08000bf8 0x0 c:/devkitpro/devkitarm/bin/../lib/gcc/arm-eabi/4.1.1/../../../../arm-eabi/lib\libc.a(rand.o)
.glue_7t 0x08000bf8 0x0 c:/devkitpro/devkitarm/bin/../lib/gcc/arm-eabi/4.1.1/../../../../arm-eabi/lib\libc.a(impure.o)
.glue_7t 0x08000bf8 0x0 c:/devkitpro/devkitarm/bin/../lib/gcc/arm-eabi/4.1.1/../../../../arm-eabi/lib\libsysbase.a(malloc_vars.o)
.glue_7t 0x08000bf8 0x0 c:/devkitpro/devkitarm/bin/../lib/gcc/arm-eabi/4.1.1/crtend.o
.glue_7t 0x08000bf8 0x0 c:/devkitpro/devkitarm/bin/../lib/gcc/arm-eabi/4.1.1/crtn.o
0x08000bf8 . = ALIGN (0x4)
0x08000bf8 __text_end = .
.fini 0x08000bf8 0x18
*(.fini)
.fini 0x08000bf8 0xc c:/devkitpro/devkitarm/bin/../lib/gcc/arm-eabi/4.1.1/crti.o
0x08000bf8 _fini
.fini 0x08000c04 0xc c:/devkitpro/devkitarm/bin/../lib/gcc/arm-eabi/4.1.1/crtn.o
0x08000c10 . = ALIGN (0x4)
.rodata 0x08000c10 0x13208
*(.rodata)
.rodata 0x08000c10 0x12c00 bg.raw.o
0x08000c10 bg_Bitmap
.rodata 0x08013810 0x600 main.o
0x08013c10 ballPalette
0x08013810 ballData
.rodata 0x08013e10 0x4 c:/devkitpro/devkitarm/bin/../lib/gcc/arm-eabi/4.1.1/../../../../arm-eabi/lib\libc.a(impure.o)
0x08013e10 _global_impure_ptr
*all.rodata*(*)
*(.roda)
*(.rodata.*)
.rodata.str1.4
0x08013e14 0x4 c:/devkitpro/devkitarm/bin/../lib/gcc/arm-eabi/4.1.1/../../../../arm-eabi/lib\libc.a(impure.o)
*(.gnu.linkonce.r*)
0x08013e18 . = ALIGN (0x4)
.ARM.extab
*(.ARM.extab* .gnu.linkonce.armextab.*)
0x08013e18 __exidx_start = .
.ARM.exidx
*(.ARM.exidx* .gnu.linkonce.armexidx.*)
0x08013e18 __exidx_end = .
.ctors 0x08013e18 0x0
*crtbegin.o(.ctors)
*(EXCLUDE_FILE(*crtend.o) .ctors)
*(SORT(.ctors.*))
*(.ctors)
0x08013e18 . = ALIGN (0x4)
.dtors 0x08013e18 0x0
*crtbegin.o(.dtors)
*(EXCLUDE_FILE(*crtend.o) .dtors)
*(SORT(.dtors.*))
*(.dtors)
0x08013e18 . = ALIGN (0x4)
.eh_frame 0x08013e18 0x4
*(.eh_frame)
.eh_frame 0x08013e18 0x0 c:/devkitpro/devkitarm/bin/../lib/gcc/arm-eabi/4.1.1/crtbegin.o
.eh_frame 0x08013e18 0x4 c:/devkitpro/devkitarm/bin/../lib/gcc/arm-eabi/4.1.1/crtend.o
0x08013e1c . = ALIGN (0x4)
.gcc_except_table
0x08013e1c 0x0
*(.gcc_except_table)
0x08013e1c . = ALIGN (0x4)
0x08013e1c __iwram_lma = .
.iwram 0x03000000 0x0 load address 0x08013e1c
0x03000000 __iwram_start = <code 342> (.)
*(.iwram)
*iwram.*(.text)
0x03000000 . = ALIGN (0x4)
0x03000000 __iwram_end = <code 342> (.)
0x08013e1c __data_lma = (__iwram_lma + SIZEOF (.iwram))
.bss 0x03000000 0x1024
0x03000000 __bss_start = <code 342> (.)
0x03000000 __bss_start__ = <code 342> (.)
*(.dynbss)
*(.gnu.linkonce.b*)
*(.bss*)
.bss 0x03000000 0x0 c:/devkitpro/devkitarm/bin/../lib/gcc/arm-eabi/4.1.1/../../../../arm-eabi/lib/gba_crt0.o
.bss 0x03000000 0x0 c:/devkitpro/devkitarm/bin/../lib/gcc/arm-eabi/4.1.1/crti.o
.bss 0x03000000 0x1c c:/devkitpro/devkitarm/bin/../lib/gcc/arm-eabi/4.1.1/crtbegin.o
.bss 0x0300001c 0x0 bg.raw.o
.bss 0x0300001c 0x1000 main.o
.bss 0x0300101c 0x0 c:/devkitpro/devkitarm/bin/../lib/gcc/arm-eabi/4.1.1\libgcc.a(_call_via_rX.o)
.bss 0x0300101c 0x0 c:/devkitpro/devkitarm/bin/../lib/gcc/arm-eabi/4.1.1/../../../../arm-eabi/lib\libc.a(init.o)
.bss 0x0300101c 0x0 c:/devkitpro/devkitarm/bin/../lib/gcc/arm-eabi/4.1.1/../../../../arm-eabi/lib\libc.a(rand.o)
.bss 0x0300101c 0x0 c:/devkitpro/devkitarm/bin/../lib/gcc/arm-eabi/4.1.1/../../../../arm-eabi/lib\libc.a(impure.o)
.bss 0x0300101c 0x8 c:/devkitpro/devkitarm/bin/../lib/gcc/arm-eabi/4.1.1/../../../../arm-eabi/lib\libsysbase.a(malloc_vars.o)
0x03001020 fake_heap_start
0x0300101c fake_heap_end
.bss 0x03001024 0x0 c:/devkitpro/devkitarm/bin/../lib/gcc/arm-eabi/4.1.1/crtend.o
.bss 0x03001024 0x0 c:/devkitpro/devkitarm/bin/../lib/gcc/arm-eabi/4.1.1/crtn.o
*(COMMON)
0x03001024 . = ALIGN (0x4)
0x03001024 __bss_end = <code 342> (.)
0x03001024 __bss_end__ = __bss_end
.data 0x03001024 0x41c load address 0x08013e1c
0x03001024 __data_start = <code 342> (.)
*(.data)
.data 0x03001024 0x0 c:/devkitpro/devkitarm/bin/../lib/gcc/arm-eabi/4.1.1/../../../../arm-eabi/lib/gba_crt0.o
.data 0x03001024 0x0 c:/devkitpro/devkitarm/bin/../lib/gcc/arm-eabi/4.1.1/crti.o
.data 0x03001024 0x4 c:/devkitpro/devkitarm/bin/../lib/gcc/arm-eabi/4.1.1/crtbegin.o
0x03001024 __dso_handle
.data 0x03001028 0x0 bg.raw.o
.data 0x03001028 0x0 main.o
.data 0x03001028 0x0 c:/devkitpro/devkitarm/bin/../lib/gcc/arm-eabi/4.1.1\libgcc.a(_call_via_rX.o)
.data 0x03001028 0x0 c:/devkitpro/devkitarm/bin/../lib/gcc/arm-eabi/4.1.1/../../../../arm-eabi/lib\libc.a(init.o)
.data 0x03001028 0x0 c:/devkitpro/devkitarm/bin/../lib/gcc/arm-eabi/4.1.1/../../../../arm-eabi/lib\libc.a(rand.o)
.data 0x03001028 0x418 c:/devkitpro/devkitarm/bin/../lib/gcc/arm-eabi/4.1.1/../../../../arm-eabi/lib\libc.a(impure.o)
0x03001028 _impure_ptr
.data 0x03001440 0x0 c:/devkitpro/devkitarm/bin/../lib/gcc/arm-eabi/4.1.1/../../../../arm-eabi/lib\libsysbase.a(malloc_vars.o)
.data 0x03001440 0x0 c:/devkitpro/devkitarm/bin/../lib/gcc/arm-eabi/4.1.1/crtend.o
.data 0x03001440 0x0 c:/devkitpro/devkitarm/bin/../lib/gcc/arm-eabi/4.1.1/crtn.o
*(.data.*)
*(.gnu.linkonce.d*)
0x03001440 . = ALIGN (0x4)
0x08014238 __preinit_lma = (__data_lma + SIZEOF (.data))
0x03001440 PROVIDE (__preinit_array_start, .)
.preinit_array 0x03001440 0x0 load address 0x08014238
*(.preinit_array)
0x03001440 PROVIDE (__preinit_array_end, .)
0x08014238 __init_lma = (__preinit_lma + SIZEOF (.preinit_array))
0x03001440 PROVIDE (__init_array_start, .)
.init_array 0x03001440 0x4 load address 0x08014238
*(.init_array)
.init_array 0x03001440 0x4 c:/devkitpro/devkitarm/bin/../lib/gcc/arm-eabi/4.1.1/crtbegin.o
0x03001444 PROVIDE (__init_array_end, .)
0x03001444 PROVIDE (__fini_array_start, .)
0x0801423c __fini_lma = (__init_lma + SIZEOF (.init_array))
.fini_array 0x03001444 0x4 load address 0x0801423c
*(.fini_array)
.fini_array 0x03001444 0x4 c:/devkitpro/devkitarm/bin/../lib/gcc/arm-eabi/4.1.1/crtbegin.o
0x03001448 PROVIDE (__fini_array_end, .)
0x08014240 __jcr_lma = (__fini_lma + SIZEOF (.fini_array))
.jcr 0x03001448 0x4 load address 0x08014240
*(.jcr)
.jcr 0x03001448 0x0 c:/devkitpro/devkitarm/bin/../lib/gcc/arm-eabi/4.1.1/crtbegin.o
.jcr 0x03001448 0x4 c:/devkitpro/devkitarm/bin/../lib/gcc/arm-eabi/4.1.1/crtend.o
0x0300144c __data_end = <code 342> (.)
0x08014244 __iwram_overlay_lma = (__jcr_lma + SIZEOF (.jcr))
0x0300144c __iwram_overlay_start = .
.iwram0 0x0300144c 0x0 load address 0x08014244
*(.iwram0)
0x0300144c . = ALIGN (0x4)
0x08014244 __load_start_iwram0 = LOADADDR (.iwram0)
0x08014244 __load_stop_iwram0 = (LOADADDR (.iwram0) + SIZEOF (.iwram0))
.iwram1 0x0300144c 0x0 load address 0x08014244
*(.iwram1)
0x0300144c . = ALIGN (0x4)
0x08014244 __load_start_iwram1 = LOADADDR (.iwram1)
0x08014244 __load_stop_iwram1 = (LOADADDR (.iwram1) + SIZEOF (.iwram1))
.iwram2 0x0300144c 0x0 load address 0x08014244
*(.iwram2)
0x0300144c . = ALIGN (0x4)
0x08014244 __load_start_iwram2 = LOADADDR (.iwram2)
0x08014244 __load_stop_iwram2 = (LOADADDR (.iwram2) + SIZEOF (.iwram2))
.iwram3 0x0300144c 0x0 load address 0x08014244
*(.iwram3)
0x0300144c . = ALIGN (0x4)
0x08014244 __load_start_iwram3 = LOADADDR (.iwram3)
0x08014244 __load_stop_iwram3 = (LOADADDR (.iwram3) + SIZEOF (.iwram3))
.iwram4 0x0300144c 0x0 load address 0x08014244
*(.iwram4)
0x0300144c . = ALIGN (0x4)
0x08014244 __load_start_iwram4 = LOADADDR (.iwram4)
0x08014244 __load_stop_iwram4 = (LOADADDR (.iwram4) + SIZEOF (.iwram4))
.iwram5 0x0300144c 0x0 load address 0x08014244
*(.iwram5)
0x0300144c . = ALIGN (0x4)
0x08014244 __load_start_iwram5 = LOADADDR (.iwram5)
0x08014244 __load_stop_iwram5 = (LOADADDR (.iwram5) + SIZEOF (.iwram5))
.iwram6 0x0300144c 0x0 load address 0x08014244
*(.iwram6)
0x0300144c . = ALIGN (0x4)
0x08014244 __load_start_iwram6 = LOADADDR (.iwram6)
0x08014244 __load_stop_iwram6 = (LOADADDR (.iwram6) + SIZEOF (.iwram6))
.iwram7 0x0300144c 0x0 load address 0x08014244
*(.iwram7)
0x0300144c . = ALIGN (0x4)
0x08014244 __load_start_iwram7 = LOADADDR (.iwram7)
0x08014244 __load_stop_iwram7 = (LOADADDR (.iwram7) + SIZEOF (.iwram7))
.iwram8 0x0300144c 0x0 load address 0x08014244
*(.iwram8)
0x0300144c . = ALIGN (0x4)
0x08014244 __load_start_iwram8 = LOADADDR (.iwram8)
0x08014244 __load_stop_iwram8 = (LOADADDR (.iwram8) + SIZEOF (.iwram8))
.iwram9 0x0300144c 0x0 load address 0x08014244
*(.iwram9)
0x0300144c . = ALIGN (0x4)
0x08014244 __load_start_iwram9 = LOADADDR (.iwram9)
0x08014244 __load_stop_iwram9 = (LOADADDR (.iwram9) + SIZEOF (.iwram9))
0x08014244 __ewram_lma = __load_stop_iwram9
0x0300144c __iwram_overlay_end = .
0x0300144c __iheap_start = .
0x02000000 __ewram_start = 0x2000000
.ewram 0x02000000 0x0 load address 0x08014244
*(.ewram)
0x02000000 . = ALIGN (0x4)
0x08014244 __pad_lma = (__ewram_lma + SIZEOF (.ewram))
.sbss 0x02000000 0x0
0x02000000 __sbss_start = <code 342> (.)
*(.sbss)
0x02000000 . = ALIGN (0x4)
0x02000000 __sbss_end = <code 342> (.)
0x02000000 __ewram_end = __sbss_end
0x02000000 __eheap_start = __sbss_end
0x02000000 __end__ = __sbss_end
0x02000000 end = __sbss_end
.pad 0x02000000 0x8 load address 0x08014244
0x02000000 0x4 LONG 0x52416b64
0x02000004 0x4 LONG 0x4d
0x02000008 . = ALIGN (0x4)
.stab
*(.stab)
.stabstr
*(.stabstr)
.stab.excl
*(.stab.excl)
.stab.exclstr
*(.stab.exclstr)
.stab.index
*(.stab.index)
.stab.indexstr
*(.stab.indexstr)
.comment 0x00000000 0x150
*(.comment)
.comment 0x00000000 0x2a c:/devkitpro/devkitarm/bin/../lib/gcc/arm-eabi/4.1.1/crtbegin.o
.comment 0x0000002a 0x2a bg.raw.o
.comment 0x00000054 0x2a main.o
.comment 0x0000007e 0x2a c:/devkitpro/devkitarm/bin/../lib/gcc/arm-eabi/4.1.1/../../../../arm-eabi/lib\libc.a(init.o)
.comment 0x000000a8 0x2a c:/devkitpro/devkitarm/bin/../lib/gcc/arm-eabi/4.1.1/../../../../arm-eabi/lib\libc.a(rand.o)
.comment 0x000000d2 0x2a c:/devkitpro/devkitarm/bin/../lib/gcc/arm-eabi/4.1.1/../../../../arm-eabi/lib\libc.a(impure.o)
.comment 0x000000fc 0x2a c:/devkitpro/devkitarm/bin/../lib/gcc/arm-eabi/4.1.1/../../../../arm-eabi/lib\libsysbase.a(malloc_vars.o)
.comment 0x00000126 0x2a c:/devkitpro/devkitarm/bin/../lib/gcc/arm-eabi/4.1.1/crtend.o
.debug
*(.debug)
.line
*(.line)
.debug_srcinfo
*(.debug_srcinfo)
.debug_sfnames
*(.debug_sfnames)
.debug_aranges 0x00000000 0x50
*(.debug_aranges)
.debug_aranges
0x00000000 0x28 c:/devkitpro/devkitarm/bin/../lib/gcc/arm-eabi/4.1.1/crti.o
.debug_aranges
0x00000028 0x28 c:/devkitpro/devkitarm/bin/../lib/gcc/arm-eabi/4.1.1/crtn.o
.debug_pubnames
*(.debug_pubnames)
.debug_info 0x00000000 0xb6
*(.debug_info)
.debug_info 0x00000000 0x5b c:/devkitpro/devkitarm/bin/../lib/gcc/arm-eabi/4.1.1/crti.o
.debug_info 0x0000005b 0x5b c:/devkitpro/devkitarm/bin/../lib/gcc/arm-eabi/4.1.1/crtn.o
.debug_abbrev 0x00000000 0x20
*(.debug_abbrev)
.debug_abbrev 0x00000000 0x10 c:/devkitpro/devkitarm/bin/../lib/gcc/arm-eabi/4.1.1/crti.o
.debug_abbrev 0x00000010 0x10 c:/devkitpro/devkitarm/bin/../lib/gcc/arm-eabi/4.1.1/crtn.o
.debug_line 0x00000000 0x92
*(.debug_line)
.debug_line 0x00000000 0x49 c:/devkitpro/devkitarm/bin/../lib/gcc/arm-eabi/4.1.1/crti.o
.debug_line 0x00000049 0x49 c:/devkitpro/devkitarm/bin/../lib/gcc/arm-eabi/4.1.1/crtn.o
.debug_frame
*(.debug_frame)
.debug_str
*(.debug_str)
.debug_loc
*(.debug_loc)
.debug_macinfo
*(.debug_macinfo)
.debug_weaknames
*(.debug_weaknames)
.debug_funcnames
*(.debug_funcnames)
.debug_typenames
*(.debug_typenames)
.debug_varnames
*(.debug_varnames)
.stack 0x00080000 0x0
0x00080000 _stack = .
*(.stack)
.note.gnu.arm.ident
*(.note.gnu.arm.ident)
.ARM.attributes
0x00000000 0x10
*(.ARM.attributes)
.ARM.attributes
0x00000000 0x20 c:/devkitpro/devkitarm/bin/../lib/gcc/arm-eabi/4.1.1/../../../../arm-eabi/lib/gba_crt0.o
.ARM.attributes
0x00000020 0x1e c:/devkitpro/devkitarm/bin/../lib/gcc/arm-eabi/4.1.1/crti.o
.ARM.attributes
0x0000003e 0x1e c:/devkitpro/devkitarm/bin/../lib/gcc/arm-eabi/4.1.1/crtbegin.o
.ARM.attributes
0x0000005c 0x1e bg.raw.o
.ARM.attributes
0x0000007a 0x1e main.o
.ARM.attributes
0x00000098 0x1e c:/devkitpro/devkitarm/bin/../lib/gcc/arm-eabi/4.1.1\libgcc.a(_call_via_rX.o)
.ARM.attributes
0x000000b6 0x1e c:/devkitpro/devkitarm/bin/../lib/gcc/arm-eabi/4.1.1/../../../../arm-eabi/lib\libc.a(init.o)
.ARM.attributes
0x000000d4 0x1e c:/devkitpro/devkitarm/bin/../lib/gcc/arm-eabi/4.1.1/../../../../arm-eabi/lib\libc.a(rand.o)
.ARM.attributes
0x000000f2 0x1c c:/devkitpro/devkitarm/bin/../lib/gcc/arm-eabi/4.1.1/../../../../arm-eabi/lib\libc.a(impure.o)
.ARM.attributes
0x0000010e 0x1c c:/devkitpro/devkitarm/bin/../lib/gcc/arm-eabi/4.1.1/../../../../arm-eabi/lib\libsysbase.a(malloc_vars.o)
.ARM.attributes
0x0000012a 0x1c c:/devkitpro/devkitarm/bin/../lib/gcc/arm-eabi/4.1.1/crtend.o
.ARM.attributes
0x00000146 0x1e c:/devkitpro/devkitarm/bin/../lib/gcc/arm-eabi/4.1.1/crtn.o
/DISCARD/
*(.note.GNU-stack)
LOAD c:/devkitpro/devkitarm/bin/../lib/gcc/arm-eabi/4.1.1/../../../../arm-eabi/lib/gba_crt0.o
LOAD c:/devkitpro/devkitarm/bin/../lib/gcc/arm-eabi/4.1.1/crti.o
LOAD c:/devkitpro/devkitarm/bin/../lib/gcc/arm-eabi/4.1.1/crtbegin.o
LOAD bg.raw.o
LOAD main.o
LOAD c:/devkitPro/libgba/lib\libgba.a
START GROUP
LOAD c:/devkitpro/devkitarm/bin/../lib/gcc/arm-eabi/4.1.1\libgcc.a
LOAD c:/devkitpro/devkitarm/bin/../lib/gcc/arm-eabi/4.1.1/../../../../arm-eabi/lib\libc.a
END GROUP
START GROUP
LOAD c:/devkitpro/devkitarm/bin/../lib/gcc/arm-eabi/4.1.1/../../../../arm-eabi/lib\libsysbase.a
LOAD c:/devkitpro/devkitarm/bin/../lib/gcc/arm-eabi/4.1.1/../../../../arm-eabi/lib\libc.a
END GROUP
LOAD c:/devkitpro/devkitarm/bin/../lib/gcc/arm-eabi/4.1.1/crtend.o
LOAD c:/devkitpro/devkitarm/bin/../lib/gcc/arm-eabi/4.1.1/crtn.o
OUTPUT(c:/cygwin/home/gmiller/ham/Sources/Chapter07/BounceSprite/BounceSprite.elf elf32-littlearm)
|
#111741 - biolizard89 - Sat Dec 09, 2006 7:01 pm
tepples wrote: |
The first GBA port of TOD (developed in 2002) was done on DevKit Advance, and it seemed to do the right thing with the const qualifier back then.
When you run arm-agb-elf-nm -n mygame.elf (in modern devkit replace arm-agb-elf- with arm-eabi-), what addresses does it give for the sound? And is it really a size issue or just an alignment issue? And are you using C or assembly language to "compile in" the arrays? |
The arrays are in C, and I doubt that it's an alignment issue, because the files containing the arrays were taken verbatim from another program which works. Haven't tried the arm-agb-elf-nm thing, because I just realized that the program does work fine with the 230KiB arrays compiled in, as long as a bunch of the other conditionally compiled program features are disabled, which reduces the file size of the program significantly. So I now think that it's the total file size of the program (592KiB with the sounds [doesn't work], 362KiB without the sounds [works], 386KiB with the sounds but with the three aforementioned features disabled [works]) that is causing problems. I'm using a Charmed Labs Xport Botball Controller (robotics controller which uses a GBA for processing purposes), along with official Charmed Labs libraries, so I guess my next step is to ask the guys at Charmed Labs whether a large program size is known to screw things up. Thanks for the help.
#111756 - tepples - Sat Dec 09, 2006 9:48 pm
I'd still like to see relevant lines from nm so as to know whether you are 1. misaligning something, 2. overrunning IWRAM, or 3. overrunning EWRAM.
_________________
-- Where is he?
-- Who?
-- You know, the human.
-- I think he moved to Tilwick.
#112122 - biolizard89 - Wed Dec 13, 2006 1:57 pm
tepples wrote: |
I'd still like to see relevant lines from nm so as to know whether you are 1. misaligning something, 2. overrunning IWRAM, or 3. overrunning EWRAM. |
Sorry for the delay, the results of nm are uploaded at http://staff.littlemoonproductions.com/biolizard89/interactive_c/arm-agb-elf-nm_firmware_toobig.txt
The sound files are named ahh, blue, hokey, muchacha, ouch, and prado.
Any ideas?
#115556 - biolizard89 - Wed Jan 17, 2007 3:35 am
Sorry to bump, but does the fact that no one has replied here indicate that the nm output I posted doesn't help?
Anyone have any clue what could be wrong? Any more questions about what I'm doing, feel free to ask.
Thanks, and sorry for the bump.
#115557 - tepples - Wed Jan 17, 2007 3:46 am
What the heck? I've always seen this set to 08000000, the start of cart space. Are you trying to use a custom link script to build a multi-game compilation with a 128 KiB start point for this ROM?
All six symbols that you named seem to be aligned correctly. Are you running out of stack?
_________________
-- Where is he?
-- Who?
-- You know, the human.
-- I think he moved to Tilwick.
#115600 - biolizard89 - Wed Jan 17, 2007 7:09 pm
tepples wrote: |
What the heck? I've always seen this set to 08000000, the start of cart space. Are you trying to use a custom link script to build a multi-game compilation with a 128 KiB start point for this ROM?
All six symbols that you named seem to be aligned correctly. Are you running out of stack? |
Now that you mention it, I remember that the program is loaded onto the XBC through a bootloader. The bootloader starts at 08000000, and starts my program at 08020000. That would explain the weird start address.
I have noticed another weird characteristic of my problem. Regardless of the file size of my program, it boots fine at first. My program receives a compiled P-code program over the XBC's RS232 port and stores it in the XBC's flash. When my program's file size is too big, it seems to be overwriting the P-code program stored in flash when I send my program to the XBC through the bootloader (because it reports that there is no program there, when I know for a fact that there was). It then works fine until I reload the P-code program onto it, after which my program refuses to boot (crashing at a different stage of booting depending on things that I'm not completely sure of - seems to include the file size of my program as well as the P-code program that was sent to it).
This makes me suspect that the problem is that the location in flash of the P-code program is hardcoded, and when the P-code program is loaded, it is corrupting the data in my program. I might be able to fix this by changing the location of the stored P-code program in flash. Problem is, most of this program wasn't written by me (it was written mostly by the Charmed Labs / KISS Institute for Practical Robotics people), so I'm not 100% sure what will happen if I try to reconfigure those locations. Looks like I'll have to contact Charmed Labs or KIPR again.
(Do my conclusions as to what the problem might be sound somewhat logical? I don't want to try to figure this out if it's probably not the main problem anyway.)
Thanks for the help.
EDIT: I looked through the code from Charmed Labs / KIPR and noticed a #define called IC_FLASH_ADDR. It was set to 0x08080000. This would correspond to the size limit I was encountering (0x08080000 - 0x08020000 = 0x60000, which would be 384KiB). I just tried setting that #define to 0x08150000, which would yield a limit of 1216KiB, and, amazingly, it worked without any other modifications! Now I can load huge binaries onto my XBC, with the serial transfer of P-code programs working fine. Problem (apparently) solved! Thanks again for the helpful comments.