[rpi bsp] configure fb section in mmu table and improvement for mailbox

Pavel Pisa pisa at cmp.felk.cvut.cz
Tue Jul 28 00:31:11 UTC 2015


Hello Qiao Yang,

On Saturday 25 of July 2015 14:53:35 QIAO YANG wrote:
> Hi Pavel Pisa,
>
> I've added the auto-configuration for fb section in mmu table.
> I reserve a section at the end of mmu table, make the table non-const to
> avoid errors, allocate fb before mmu initialization and fill in the table
> with the right parameters.
>
> As far as I've tested, I've found that the zero-length array did not behave
> like I expected. So I decided to go back to my first choice at the
> begining. What doesn't change is that we offer a structure of entries and a
> function for every operation/interface of videocore and hide the detail of
> tag structures.

I am not sure what you consider zero length array.

If it is that zero entry at the end then it should
be filled before bsp_memory_management_initialize()
is called from bsp_start_hook_1(). In the fact
bsp_start_copy_sections() should run before,
because it can be responsible for data section initialization
in some scenarios. But that should not be RPi case.

rtems/c/src/lib/libbsp/arm/raspberrypi/startup/bspstarthooks.c

void BSP_START_TEXT_SECTION bsp_start_hook_1(void)
{
  bsp_start_copy_sections();

/* section adjust has top be put there */

  bsp_memory_management_initialize();
  bsp_start_clear_bss();
}

You cannot leave there zero entry but you can compute
adjust
  arm_cp15_start_mmu_config_table_size
appropriately.

You cannot allocate dynamic memory at that time.
So the entry has to be preallocated.
Problem is the const attribute which
is declared in common 

rtems/c/src/lib/libbsp/arm/shared/include/arm-cp15-start.h

But I think that you should not copy that header file
to be RPi specific if there is other option.
It is too complex and would diverge in time so
minimal code which resolves this is change in RPi
specific mminit.c.

I think that you can change name of the table,
i.e.

BSP_START_DATA_SECTION arm_cp15_start_section_config
  arm_cp15_start_mmu_config_table_rw[] = {
...
}

const size_t arm_cp15_start_mmu_config_table_rw_size =
  RTEMS_ARRAY_SIZE(arm_cp15_start_mmu_config_table_rw);

Then you need to declare these variables in some local
header file and adapt the 

rtems/c/src/lib/libbsp/arm/raspberrypi/startup/mminit.c
  bsp_memory_management_initialize()

rtems-yangqiao/c/src/lib/libbsp/arm/raspberrypi/startup

 bsp_memory_management_initialize(void)

to use changed name variables instead of original const ones.
You do not declare these const at all so if there
is some unexpected use in future then it result in the link
error.

You can leave mapping there even in VC is not used but it has to start
after all memory used by RTEMS directly or by heap and application.

> I think it's much closer to what we expected. you may checkout my github
> and my dropbox. 
> https://github.com/yangqiao/rtems/tree/framebuffer
> https://www.dropbox.com/sh/95bu6skofkmrlvc/AABXjwvvFhQScJdo_rwj12V6a?dl=0
>
> The commits log is messy, I'll rebase it afterward until we think it's
> acceptable.

I think that Sebastian, Joel or some other core developer opinion
would be nice there.


Best wishes,

             Pavel



More information about the devel mailing list