Problems in boot_card() with configuration

Matthew J Fletcher amimjf at gmail.com
Thu Feb 14 19:57:59 UTC 2013



On 14/02/13 19:16, Joel Sherrill wrote:
> On 2/14/2013 1:09 PM, Matthew J Fletcher wrote:
>> Hi,
>>
>> I am using RTEMS 4.10.2, and a custom BSP based on the ARM rtl22xx.
>>
>> I am running through the asm startup ok and calling into boot_card(),
>> stepping through its all working fine, work_area_start, work_area_size,
>> heap_start and heap_size are setup as i expect from my linkscript.
>>
>> But the test of "work_area_size <= Configuration.work_space_size" fails
>> because Configuration.work_space_size looks like 0xfffffff, the only
>> place that assigns to Configuration.work_space_size is a few lines
>> further down.
>>
>> Does this code presume that the BSP has set the Configuration structure
>> to zero, or the whole memory ? even so the aforementioned test seems odd
>> as its just testing memory has been initialised.
>>
>> Or am i missing some RTEMS initialisation call that needs to be done
>> before boot_card() ?
> No but there may be some basic C language assumptions not
> being met. Configuration is in the .data section and that value
> does not look like it was initialized to.
> 
> Is your download correct?

Pretty sure, its via JTAG, am less sure about the .data section. The
rtl22xx specific start.s only seems to zero the bss

        ldr     r1, =_bss_end_
        ldr     r0, =_bss_start_

_bss_init:
        mov     r2, #0
        cmp     r0, r1
        strlot  r2, [r0], #4
        blo     _bss_init        /* loop while r0 < r1 */

I did think that was a bit remiss so in my of asm startup i do

        ldr   r1,=_etext                // -> ROM data start
        ldr   r2,=_data                 // -> data start
        ldr   r3,=_edata                // -> end of data
loop_a:	ldr   r0,[r1]
		str   r0,[r2]
		add   r1,#4
		add   r2,#4
		cmp   r2,r3                     // check if data to move
        blo   loop_a                    // loop until done

and in my custom linkerscript i define

  /* .data section which is used for initialized data */
  .data : AT (_etext)
  {
    _data = .;
    *(.data)
  } > RAM

  . = ALIGN(4);
  _edata = . ;
  PROVIDE (edata = .);

but the rtl22xx linkerscript it does

  .data :
  {
    *(.data)
    *(.data.*)
    *(.gnu.linkonce.d*)
    *(.jcr)
    SORT(CONSTRUCTORS)
    _edata = .;
  } > sdram

i am not overly interested in C++ constructors but i guess the
*(.data.*) is additional linker magic for gcc4, my previous usage of
this linkerscript was gcc3.





>>
>> - Matthew
>> _______________________________________________
>> rtems-users mailing list
>> rtems-users at rtems.org
>> http://www.rtems.org/mailman/listinfo/rtems-users
> 
> 



More information about the users mailing list