You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@nuttx.apache.org by "cwespressif (via GitHub)" <gi...@apache.org> on 2023/11/08 02:03:10 UTC

[PR] xtensa/esp32s3: Support malloc from external RAM and internal RAM [nuttx]

cwespressif opened a new pull request, #11144:
URL: https://github.com/apache/nuttx/pull/11144

   ## Summary
   
   This PR intends to enable the separation of Kernel and Userspace heaps in ESP32S3 operating under Flat mode.
   
   This new feature enables the allocation of the entire Userspace heap into SPI RAM and reserving the Internal RAM exclusively for the Kernel heap, which may benefit some timing-constrained Kernel components (e.g. Wi-Fi driver).
   
   ## Impact
   
   ## Testing
   
   * Successful execution of ostest in `esp32s3-devkit:psram_usrheap` defconfig.
   * Successful connection to Wi-Fi network using a custom version of `esp32s3-devkit:wapi` and enable SPIRAM config: `CONFIG_ESP32S3_SPIRAM/CONFIG_ESP32S3_SPIRAM_USER_HEAP/CONFIG_XTENSA_IMEM_USE_SEPARATE_HEAP`
   
   ![企业微信截图_16983983556458](https://github.com/apache/nuttx/assets/63690793/0a220993-55f9-4333-b868-6d0a09bf78f0)
   


-- 
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


Re: [PR] xtensa/esp32s3: Support malloc from external RAM and internal RAM [nuttx]

Posted by "acassis (via GitHub)" <gi...@apache.org>.
acassis merged PR #11144:
URL: https://github.com/apache/nuttx/pull/11144


-- 
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


Re: [PR] xtensa/esp32s3: Support malloc from external RAM and internal RAM [nuttx]

Posted by "cwespressif (via GitHub)" <gi...@apache.org>.
cwespressif commented on code in PR #11144:
URL: https://github.com/apache/nuttx/pull/11144#discussion_r1386519392


##########
arch/xtensa/include/esp32s3/memory_layout.h:
##########
@@ -0,0 +1,83 @@
+/****************************************************************************
+ * arch/xtensa/include/esp32s3/memory_layout.h
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.  The
+ * ASF licenses this file to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance with the
+ * License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
+ * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.  See the
+ * License for the specific language governing permissions and limitations
+ * under the License.
+ *
+ ****************************************************************************/
+
+/****************************************************************************
+ * Included Files
+ ****************************************************************************/
+
+#include <nuttx/config.h>
+
+/****************************************************************************
+ * Pre-processor Definitions
+ ****************************************************************************/
+
+/* The heap overview:
+ *
+ * HEAP_REGION0_START                        g_allocable_vaddr_start
+ *     :
+ *     : g_mmheap (CONFIG_ESP32_SPIRAM)
+ *     :
+ * HEAP_REGION0_END                          g_allocable_vaddr_end
+ *     :
+ *---------------------------------------------------------------------
+ * if CONFIG_MM_KERNEL_HEAP && MM_USER_HEAP_IRAM
+ *
+ * HEAP_REGION1_START                        _sheap
+ *     :
+ *     : g_iheap (CONFIG_XTENSA_IMEM_USE_SEPARATE_HEAP)
+ *     :
+ * HEAP_REGION1_START + CONFIG_XTENSA_IMEM_REGION_SIZE
+ *     :
+ *     : g_mmheap region1
+ *     :
+ * HEAP_REGION1_END                          3fcc fff0
+ *     :
+ * HEAP_REGION2_START                        3fcd 0000
+ *     :
+ *     : g_mmheap region2
+ *     :
+ * HEAP_REGION2_END                          dram0_rtos_reserved_start
+ *     :
+ *---------------------------------------------------------------------
+ * if !CONFIG_MM_KERNEL_HEAP || !MM_USER_HEAP_IRAM
+ *
+ * HEAP_REGION1_START                            _sheap
+ *     :
+ *     : g_iheap (CONFIG_XTENSA_IMEM_USE_SEPARATE_HEAP)
+ *     :
+ * HEAP_REGION1_START + CONFIG_XTENSA_IMEM_REGION_SIZE
+ *     :
+ *     : g_mmheap region1
+ *     :
+ * HEAP_REGION1_END                          dram0_rtos_reserved_start
+ *     :
+ *---------------------------------------------------------------------
+ */
+
+#ifdef CONFIG_MM_KERNEL_HEAP
+#define HEAP_REGION1_END      0x3fccfff0
+#define HEAP_REGION2_START    0x3fcd0000

Review Comment:
   Done



-- 
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


Re: [PR] xtensa/esp32s3: Support malloc from external RAM and internal RAM [nuttx]

Posted by "cwespressif (via GitHub)" <gi...@apache.org>.
cwespressif commented on PR #11144:
URL: https://github.com/apache/nuttx/pull/11144#issuecomment-1801174275

   > > This new feature enables the allocation of the entire Userspace heap into SPI RAM and reserving the Internal RAM exclusively for the Kernel heap, which may benefit some timing-constrained Kernel components (e.g. Wi-Fi driver).
   > 
   > just curious; did it actually make wifi work better?
   
   - If WiFi internal malloc from external RAM, it will cause the system to block, using this PR can avoid Wi-Fi internal malloc  from external RAM. In addition, the kernel drivers uses `kmm_malloc` to apply for memory from internal RAM rather than external RAM, which can usually avoid some possible performance problems or compatibility issues.


-- 
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


Re: [PR] xtensa/esp32s3: Support malloc from external RAM and internal RAM [nuttx]

Posted by "xiaoxiang781216 (via GitHub)" <gi...@apache.org>.
xiaoxiang781216 commented on code in PR #11144:
URL: https://github.com/apache/nuttx/pull/11144#discussion_r1386478799


##########
arch/xtensa/include/esp32s3/memory_layout.h:
##########
@@ -0,0 +1,83 @@
+/****************************************************************************
+ * arch/xtensa/include/esp32s3/memory_layout.h
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.  The
+ * ASF licenses this file to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance with the
+ * License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
+ * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.  See the
+ * License for the specific language governing permissions and limitations
+ * under the License.
+ *
+ ****************************************************************************/
+
+/****************************************************************************
+ * Included Files
+ ****************************************************************************/
+
+#include <nuttx/config.h>
+
+/****************************************************************************
+ * Pre-processor Definitions
+ ****************************************************************************/
+
+/* The heap overview:
+ *
+ * HEAP_REGION0_START                        g_allocable_vaddr_start
+ *     :
+ *     : g_mmheap (CONFIG_ESP32_SPIRAM)
+ *     :
+ * HEAP_REGION0_END                          g_allocable_vaddr_end
+ *     :
+ *---------------------------------------------------------------------
+ * if CONFIG_MM_KERNEL_HEAP && MM_USER_HEAP_IRAM
+ *
+ * HEAP_REGION1_START                        _sheap
+ *     :
+ *     : g_iheap (CONFIG_XTENSA_IMEM_USE_SEPARATE_HEAP)
+ *     :
+ * HEAP_REGION1_START + CONFIG_XTENSA_IMEM_REGION_SIZE
+ *     :
+ *     : g_mmheap region1
+ *     :
+ * HEAP_REGION1_END                          3fcc fff0
+ *     :
+ * HEAP_REGION2_START                        3fcd 0000
+ *     :
+ *     : g_mmheap region2
+ *     :
+ * HEAP_REGION2_END                          dram0_rtos_reserved_start
+ *     :
+ *---------------------------------------------------------------------
+ * if !CONFIG_MM_KERNEL_HEAP || !MM_USER_HEAP_IRAM
+ *
+ * HEAP_REGION1_START                            _sheap
+ *     :
+ *     : g_iheap (CONFIG_XTENSA_IMEM_USE_SEPARATE_HEAP)
+ *     :
+ * HEAP_REGION1_START + CONFIG_XTENSA_IMEM_REGION_SIZE
+ *     :
+ *     : g_mmheap region1
+ *     :
+ * HEAP_REGION1_END                          dram0_rtos_reserved_start
+ *     :
+ *---------------------------------------------------------------------
+ */
+
+#ifdef CONFIG_MM_KERNEL_HEAP
+#define HEAP_REGION1_END      0x3fccfff0
+#define HEAP_REGION2_START    0x3fcd0000

Review Comment:
   add indent



-- 
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


Re: [PR] xtensa/esp32s3: Support malloc from external RAM and internal RAM [nuttx]

Posted by "yamt (via GitHub)" <gi...@apache.org>.
yamt commented on PR #11144:
URL: https://github.com/apache/nuttx/pull/11144#issuecomment-1800934735

   > This new feature enables the allocation of the entire Userspace heap into SPI RAM and reserving the Internal RAM exclusively for the Kernel heap, which may benefit some timing-constrained Kernel components (e.g. Wi-Fi driver).
   
   just curious; did it actually make wifi work better?
   


-- 
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