1.. zephyr:code-sample:: esp32-spiram 2 :name: SPIRAM 3 4 Allocate memory from SPIRAM. 5 6Overview 7******** 8 9This sample shows how to allocate memory from SPIRAM by using 10:c:func:`shared_multi_heap_aligned_alloc` with ``SMH_REG_ATTR_EXTERNAL`` attribute. Checks if the 11memory was correctly allocated then frees it by calling :c:func:`shared_multi_heap_free`. 12It also allocates memory from internal memory and checks if the address range is correct. 13 14Supported SoCs 15************** 16 17The following SoCs are supported by this sample code so far: 18 19* ESP32 20* ESP32-S2 21* ESP32-S3 22 23Building and Running 24******************** 25 26Make sure you have your board connected over USB port. 27 28.. code-block:: console 29 30 west build -b esp32s3_devkitm/esp32s3/procpu samples/boards/espressif/spiram_test 31 west flash 32 33If using another supported Espressif board, replace the argument in the above 34command with a proper board name (e.g., ``esp32s2_saola``). 35 36Sample Output 37============= 38 39To check output of this sample, run ``west espressif monitor`` or any other serial 40console program (e.g., minicom, putty, screen, etc). 41This example uses ``west espressif monitor``, which automatically detects the serial 42port at ``/dev/ttyUSB0``: 43 44.. code-block:: console 45 46 $ west espressif monitor 47 48.. code-block:: console 49 50 *** Booting Zephyr OS build v3.7.0-446-g93c9da66944c *** 51 SPIRAM mem test pass 52 Internal mem test pass 53