RPi Graphic testing

Pavel Pisa pisa at cmp.felk.cvut.cz
Mon Jul 20 22:52:15 UTC 2015


Hello Qiao Yang,

On Monday 20 of July 2015 20:50:32 QIAO YANG wrote:
> So it has got the right pointer for frame buffer.
>
> Please set the macros
>
> BCM2835_FBMEM_BASE to 0x1C006000
> and BCM2835_FBMEM_SIZE to 0x500000
> according to your log.

I have got to testing at home where I have other RPi board
and have no luck till. The memory setup is different there so I tried
to recompiled for that one. I will rerun test at the university
on the previous board again on Wednesday. If you have some
enhancements, commit them to your RTEMS git, please.

As for memory map adaptation, RTEMS does not include infrastructure
for memory management setup changes at runtime but the before
bsp_memory_management_initialize() is called then CPU runs in 1:1
mapping where physical and virtual addresses match. The main
reason to setup and enable MMU on ARM is that without MMU
cache cannot be enabled so execution is slow. Even instruction
cache can be enabled without MMU enable on some ARM models.
So the system is mostly/completely operational before MMU
enable.

arm_cp15_start_mmu_config_table table is declared as const
but if it is not marked that way and compiler error is prevented
then it can be manipulated before bsp_memory_management_initialize();
in bsp_start_hook_1() is called

rtems/c/src/lib/libbsp/arm/raspberrypi/startup/bspstarthooks.c 
  bsp_start_hook_1(void)

So it should be possible to parse ATAGs or even access VideoCore
before MMU is configured.

The MMU config requires arm_cp15_start_mmu_config_table to be global
variable. There is other solution even if problem with
const does not allows simple modification of the table
(but brute cast in the function adding video region would work either).

It is most probable possible to skip to call 
bsp_memory_management_initialize() from the hook
and use local variant of that code which would be RPi BSP
specific

rtems-yangqiao/c/src/lib/libbsp/arm/shared/mminit.c
  bsp_memory_management_initialize();

#define ARM_CP15_TEXT_SECTION BSP_START_TEXT_SECTION

#include <bsp/start.h>
#include <bsp/arm-cp15-start.h>
#include <bsp/linker-symbols.h>
#include <bsp/mm.h>

BSP_START_TEXT_SECTION void bsp_memory_management_initialize(void)
{
  uint32_t ctrl = arm_cp15_get_control();

  ctrl |= ARM_CP15_CTRL_AFE | ARM_CP15_CTRL_S | ARM_CP15_CTRL_XP;

  arm_cp15_start_setup_translation_table_and_enable_mmu_and_cache(
    ctrl,
    (uint32_t *) bsp_translation_table_base,
    ARM_MMU_DEFAULT_CLIENT_DOMAIN,
    &arm_cp15_start_mmu_config_table[0],
    arm_cp15_start_mmu_config_table_size
  );
}

So it is quite short sequence and even highly dynamic table can be used.

The mechanism to obtain installed/board provided memory size
is required even to setup correctly size of memory and heap
available for RTEMS system workspace and user application.

So this should be solved (at least in long term horizon) some
more generic/autoconfigured way.

Best wishes,

             Pavel



More information about the devel mailing list