1config SPIRAM
2    bool "Support for external, SPI-connected RAM"
3    default "n"
4    help
5        This enables support for an external SPI RAM chip, connected in parallel with the
6        main SPI flash chip.
7
8menu "SPI RAM config"
9    depends on SPIRAM
10
11    choice SPIRAM_MODE
12        prompt "Mode (QUAD/OCT) of SPI RAM chip in use"
13        default SPIRAM_MODE_QUAD
14
15        config SPIRAM_MODE_QUAD
16            bool "Quad Mode PSRAM"
17
18        config SPIRAM_MODE_OCT
19            bool "Octal Mode PSRAM"
20    endchoice
21
22    choice SPIRAM_TYPE
23        prompt "Type of SPIRAM chip in use"
24        default SPIRAM_TYPE_AUTO
25
26        config SPIRAM_TYPE_AUTO
27            bool "Auto-detect"
28
29        config SPIRAM_TYPE_ESPPSRAM16
30            bool "ESP-PSRAM16 or APS1604"
31            depends on SPIRAM_MODE_QUAD
32
33        config SPIRAM_TYPE_ESPPSRAM32
34            bool "ESP-PSRAM32"
35            depends on SPIRAM_MODE_QUAD
36
37        config SPIRAM_TYPE_ESPPSRAM64
38            bool "ESP-PSRAM64 , LY68L6400 or APS6408"
39    endchoice
40
41    config SPIRAM_ALLOW_STACK_EXTERNAL_MEMORY
42        bool "Allow external memory as an argument to xTaskCreateStatic"
43        default y
44        help
45            Accessing memory in SPIRAM has certain restrictions, so task stacks allocated by xTaskCreate
46            are by default allocated from internal RAM.
47
48            This option allows for passing memory allocated from SPIRAM to be passed to xTaskCreateStatic.
49            This should only be used for tasks where the stack is never accessed while the cache is disabled.
50
51    config SPIRAM_CLK_IO
52        int
53        default 30
54
55    config SPIRAM_CS_IO
56        int
57        default 26
58
59    config SPIRAM_FETCH_INSTRUCTIONS
60        bool "Move Instructions in Flash to PSRAM"
61        default n
62        help
63            If enabled, instructions in flash will be moved into PSRAM on startup.
64            If SPIRAM_RODATA is also enabled, code that requires execution during an SPI1 Flash operation
65            can forgo being placed in IRAM, thus optimizing RAM usage (see External RAM documentation
66            for more details).
67
68
69    config SPIRAM_RODATA
70        bool "Move Read-Only Data in Flash to PSRAM"
71        default n
72        help
73            If enabled, rodata in flash will be moved into PSRAM on startup.
74            If SPIRAM_FETCH_INSTRUCTIONS is also enabled, code that requires execution during an SPI1 Flash operation
75            can forgo being placed in IRAM, thus optimizing RAM usage (see External RAM documentation
76            for more details).
77
78    choice SPIRAM_SPEED
79        prompt "Set RAM clock speed"
80        default SPIRAM_SPEED_40M
81        help
82            Select the speed for the SPI RAM chip.
83
84        config SPIRAM_SPEED_120M
85            depends on SPIRAM_MODE_QUAD || IDF_EXPERIMENTAL_FEATURES
86            bool "120MHz clock speed"
87
88            help
89                - Quad PSRAM 120 MHz is stable.
90
91                - Octal PSRAM 120 MHz is an experimental feature, it works when
92                  the temperature is stable.
93
94                    Risks:
95                        If your chip powers on at a certain temperature, then after the temperature
96                        increases or decreases by approximately 20 Celsius degrees (depending on the
97                        chip), the accesses to / from PSRAM will crash randomly.
98
99        config SPIRAM_SPEED_80M
100            bool "80MHz clock speed"
101        config SPIRAM_SPEED_40M
102            bool "40Mhz clock speed"
103    endchoice
104
105    config SPIRAM_SPEED
106        int
107        default 120 if SPIRAM_SPEED_120M
108        default 80 if SPIRAM_SPEED_80M
109        default 40 if SPIRAM_SPEED_40M
110
111    source "$IDF_PATH/components/esp_psram/Kconfig.spiram.common"    # insert non-chip-specific items here
112endmenu
113