Unable to run run-time loaded code on ZedBoard

Pavel Pisa ppisa4lists at pikron.com
Tue Nov 17 20:51:05 UTC 2015


Hello Patrick,

On Sunday 15 of November 2015 00:36:21 Patrick Gauvin wrote:
> Pavel,
>
> Sorry for the delay, but I tried your refined approach:
> > If the area is smaller than cache size then
> > use use of regions operations should take shorter
> > and generally means less unrelated latencies to unrelated code/data
> >
> >  void rtems_cache_flush_multiple_data_lines( const void *, size_t );
> >
> >  void rtems_cache_invalidate_multiple_instruction_lines( const void *,
> > size_t );
>
> I cheated a little since I knew the addresses and lengths from the RTL
> trace output ("rtl: loading: .text -> 0x213148 (88)"), but adding
>
>   rtems_cache_invalidate_multiple_instruction_lines((void *)0x213148, 88);
>   rtems_cache_flush_multiple_data_lines((void *)0x213148, 88);
>
> before calling the loaded function resulted in the dl01 test running
> successfully. At least for dl01, only the .text section needed
> attention.
>
> I also tried with the
> rtems_cache_invalidate_multiple_instruction_lines call omitted, and it
> still worked. However, leaving out the
> rtems_cache_flush_multiple_data_lines call causes it to fail.

thanks for testing.

As for the rtems_cache_invalidate_multiple_instruction_lines,
if there has been no code executed from that area before,
than there is no line in the instruction cache and no risk
of stale data. But if you run dlopen, then dlclose (and implementation
really frees memory - I have not checked) and then run dlopen of different
code then bad things can happen. But even in such case cache for given
area can be overwritten/cleaned by pressure of other execution.

The ELF file provides full information about section start addresses
and size so it would be great if Chris could call
rtems_cache_flush_multiple_data_lines and
rtems_cache_invalidate_multiple_instruction_lines directly from
dlopen code according to sections info.
The rtems_cache_flush_multiple_data_lines has to be run after relocation
is done. I would suggest to place
rtems_cache_invalidate_multiple_instruction_lines
after data flush. But probably not critical, nothing should be run
from area during load and relocation time.

Thanks for help again,

                           Pavel




More information about the users mailing list