You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@nuttx.apache.org by GitBox <gi...@apache.org> on 2022/10/06 12:54:07 UTC

[GitHub] [incubator-nuttx] pussuw commented on a diff in pull request #7246: RISC-V address environments: Add basic sanity checks for section boundaries

pussuw commented on code in PR #7246:
URL: https://github.com/apache/incubator-nuttx/pull/7246#discussion_r989012303


##########
arch/risc-v/src/mpfs/mpfs_mm_init.c:
##########
@@ -205,6 +210,19 @@ static void map_region(uintptr_t paddr, uintptr_t vaddr, size_t size,
 
 void mpfs_kernel_mappings(void)
 {
+  /* Ensure the sections are aligned properly, requirement is 2MB due to the
+   * L3 page table size (one table maps 2MB of memory). This mapping cannot
+   * handle unaligned L3 sections.
+   */
+
+  DEBUGASSERT((KFLASH_START & RV_MMU_SECTION_ALIGN) == 0);
+  DEBUGASSERT((KSRAM_START & RV_MMU_SECTION_ALIGN) == 0);
+  DEBUGASSERT((PGPOOL_START & RV_MMU_SECTION_ALIGN) == 0);
+
+  /* Check that the L3 table is of sufficient size */
+
+  DEBUGASSERT(PGT_L3_SIZE >= PGT_L3_MIN_SIZE);

Review Comment:
   Yes it is a hard requirement. Tbh I was not even aware of a difference between DEBUGASSERT and plain ASSERT.
   
   I'll change the tests



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@nuttx.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org