7 years, 7 months ago.

uVisor, Unlocking the upper SRAM subregion only

I'm trying to build my project with the latest modification on uVisor, it seems that the position of page heap section has changed, so i tried to do something similar to : (vmpu_armv7m.c)

     *     2^n     <-- region end
     *     ...
     * .---------. <-- uvisor_config.sram_end
     * |  box 0  |
     * | public  |
     * | memory  |
     * +---------+ <-- uvisor_config.page_end: n/8th of _region_ size (not SRAM size)
     * |  page   |
     * |  heap   |
     * +---------+ <-- aligned to page size
     * | wastage | <-- wasted SRAM is less than 1 page size
     * +---------+ <-- uvisor_config.page_start
     * |  uVisor |
     * |   bss   |
     * '---------' <-- uvisor_config.sram_start, region start

I Succeed to pass the first sanity check ( line 463 in the same file : if (protected_size % subregions_size != 0) ), but then it failed during the unlock of the upper SRAM subregion exatcly during the vmpu_map_acl() function. i tried to understand why, but first i didn't get why in (line 472 same file) :

/* Unlock the upper SRAM subregion only. */
    vmpu_mpu_set_static_acl(
        1,
        (uint32_t) __uvisor_config.sram_start,
        total_size,
        UVISOR_TACLDEF_DATA | UVISOR_TACL_UEXECUTE | UVISOR_TACL_SUBREGIONS(subregions_disable_mask)
    );

we use total_size to Unlock only the upper SRAM subregion, why it's not subregions_size?

One last thing, I think that ALIGN( (1 << LOG2CEIL(LENGTH(SRAM)) / 8 )) <=> ALIGN(0), Am I wrong?

1 Answer

-deleted-
7 years, 7 months ago.

This change within uVisor depends on a linkerscript change to move the page heap above uVisor bss. See the PR in mbed-os.

Edit: I forgot, that PR is for K64F only, so that's not very helpful for you. At the moment that's the only officially ported target. You can try my port to EFM32, but it's experimental and may not work. YMMV.

One last thing, I think that ALIGN( (1 << LOG2CEIL(LENGTH(SRAM)) / 8 )) <=> ALIGN(0), Am I wrong?

(1 << LOG2CEIL(LENGTH(SRAM)) / 8 is always > 0, if LENGTH(SRAM) > 0.

Accepted Answer

@"HALT_ERROR(./core/system/src/mpu/vmpu_armv7m_mpu.c#178): inferred ACL's (0x003F) don't mat\ ch exptected ACL's (0x0037)\n" 486,122 @"\n" I'm getting this error after fixing the page_heap problem in the linker. Do you have any idea about it?

posted by abdou sen 01 Sep 2016

We can reproduce this issue and are tracking it here: https://github.com/ARMmbed/uvisor/issues/319

posted by -deleted- 05 Sep 2016

Is it normal to have have 0kb free for page heap? I know there is still space available in the SRAM, before this change, i had like 32kb free for the page heap for the same application.

posted by abdou sen 12 Sep 2016