Forums

ADSP-21065L SYSCON overwrite

Started by Steve Holle March 4, 2004
I have a problem I'm hoping someone can help me with.  I have an
ADSP-20165L system with external SRAM and have moved the $C_CPP_LIBS
to SRAM as shown in the snip from my ldf below:

...
$DEF_LIBS 	= libdsp.dlb;
$C_CPP_LIBS = libc.dlb, libcpp.dlb, libcpprt.dlb, libio.dlb;
$LIBRARIES = $DEF_LIBS, $C_CPP_LIBS;
...
seg_pm_sdram 	{ TYPE(PM RAM) START(0x00020000) END(0x00027fff)
WIDTH(32) }
seg_dm_sdram 	{ TYPE(DM RAM) START(0x00030000) END(0x0005ffff)
WIDTH(32) }

    SECTIONS
    {
		...
		// .text output section
		seg_pm_sdram
		{
//			INPUT_SECTIONS( $C_CPP_LIBS(seg_pmco) ... )
			INPUT_SECTIONS( $C_CPP_LIBS(seg_pmco) ... )
		} > seg_pm_sdram

Ignore the sdram labels and substitute sram as this system has no
sdram.

When I load this program in the IDE using the F7 Build Project key, my
SYSCON and WAIT registers get trashed.  I have traced the problem to a
section of the library initialization in "__lib_setup_heaps" in the
section with the heading "loop_thru_heaps".  After fairly large number
of iterations, SYSCON and WAIT get overwritten, usually with
0x00000000.

Any ideas?
sholle@link-comm.com (Steve Holle) wrote in 
news:ba83847d.0403041413.57c4860a@posting.google.com:

> When I load this program in the IDE using the F7 Build Project key, my > SYSCON and WAIT registers get trashed. I have traced the problem to a > section of the library initialization in "__lib_setup_heaps" in the > section with the heading "loop_thru_heaps". After fairly large number > of iterations, SYSCON and WAIT get overwritten, usually with > 0x00000000.
Did you define any heaps? You need a small amount of space in that section to satisfy one iteration of the initializer loop. It's been a long time since I looked at it so I don't recall in detail how much you need, but I think it was 4-6 words of zero.
Kenneth Porter <ken.blacklist@sewingwitch.com> wrote in message news:<Xns94A2D3022ED88shivawellcom@64.164.98.49>...
> sholle@link-comm.com (Steve Holle) wrote in > news:ba83847d.0403041413.57c4860a@posting.google.com: > > > When I load this program in the IDE using the F7 Build Project key, my > > SYSCON and WAIT registers get trashed. I have traced the problem to a > > section of the library initialization in "__lib_setup_heaps" in the > > section with the heading "loop_thru_heaps". After fairly large number > > of iterations, SYSCON and WAIT get overwritten, usually with > > 0x00000000. > > Did you define any heaps? You need a small amount of space in that section > to satisfy one iteration of the initializer loop. It's been a long time > since I looked at it so I don't recall in detail how much you need, but I > think it was 4-6 words of zero.
The following is the heap sections of my ldf. ... seg_heap { TYPE(DM RAM) START(0x0000ddb9) END(0x0000deff) WIDTH(32) } ... heap { // allocate a heap for the application ldf_heap_space = .; ldf_heap_length = MEMORY_SIZEOF(seg_heap); ldf_heap_end = ldf_heap_space + ldf_heap_length - 1; } > seg_heap
I finally got the SYSCON overwrite problem fixed.  The label
___lib_end_of_heap_descriptions in "seg_init.asm" was not getting
placed in memory but was being eliminated.  I had to put the following
in my init code so that the variable was used and not eliminated :

.extern ___lib_end_of_heap_descriptions ;
.global _Init_DSP;
_Init_DSP:
  leaf_entry
  
  r0 = pm(___lib_end_of_heap_descriptions) ;

This is a dummy that I don't do anything with but it eliminated the
problem.  The problem with the library is that the label CAN be
eliminated.

Depending on the state of memory after a reset, the library heap
loader may or may not find what it considers a "valid heap int"
section.

sholle@link-comm.com (Steve Holle) wrote in message news:<ba83847d.0403041413.57c4860a@posting.google.com>...
> I have a problem I'm hoping someone can help me with. I have an > ADSP-20165L system with external SRAM and have moved the $C_CPP_LIBS > to SRAM as shown in the snip from my ldf below: > > ... > $DEF_LIBS = libdsp.dlb; > $C_CPP_LIBS = libc.dlb, libcpp.dlb, libcpprt.dlb, libio.dlb; > $LIBRARIES = $DEF_LIBS, $C_CPP_LIBS; > ... > seg_pm_sdram { TYPE(PM RAM) START(0x00020000) END(0x00027fff) > WIDTH(32) } > seg_dm_sdram { TYPE(DM RAM) START(0x00030000) END(0x0005ffff) > WIDTH(32) } > > SECTIONS > { > ... > // .text output section > seg_pm_sdram > { > // INPUT_SECTIONS( $C_CPP_LIBS(seg_pmco) ... ) > INPUT_SECTIONS( $C_CPP_LIBS(seg_pmco) ... ) > } > seg_pm_sdram > > Ignore the sdram labels and substitute sram as this system has no > sdram. > > When I load this program in the IDE using the F7 Build Project key, my > SYSCON and WAIT registers get trashed. I have traced the problem to a > section of the library initialization in "__lib_setup_heaps" in the > section with the heading "loop_thru_heaps". After fairly large number > of iterations, SYSCON and WAIT get overwritten, usually with > 0x00000000. > > Any ideas?