File tree Expand file tree Collapse file tree 6 files changed +34
-8
lines changed
boards/riscv/esp32c3_devkitm Expand file tree Collapse file tree 6 files changed +34
-8
lines changed Original file line number Diff line number Diff line change @@ -7,6 +7,9 @@ config BOARD
77 default "esp32c3"
88 depends on BOARD_ESP32C3_DEVKITM
99
10+ config ENTROPY_ESP32_RNG
11+ default y if ENTROPY_GENERATOR
12+
1013if BT
1114
1215config HEAP_MEM_POOL_SIZE
@@ -16,4 +19,4 @@ choice BT_HCI_BUS_TYPE
1619 default BT_ESP32
1720endchoice
1821
19- endif # BT
22+ endif # BT
Original file line number Diff line number Diff line change 2323 status = "okay";
2424 current-speed = <115200>;
2525};
26+
27+ &trng0 {
28+ status = "okay";
29+ };
Original file line number Diff line number Diff line change 55
66config ENTROPY_ESP32_RNG
77 bool "ESP32 entropy number generator driver"
8- depends on SOC_ESP32
8+ depends on SOC_ESP32 || SOC_ESP32C3
99 select ENTROPY_HAS_DRIVER
1010 default y
1111 help
Original file line number Diff line number Diff line change 77#define DT_DRV_COMPAT espressif_esp32_trng
88
99#include <string.h>
10- #include <drivers/entropy .h>
11- #include <soc/dport_reg .h>
10+ #include <hal/cpu_hal .h>
11+ #include <esp_clk .h>
1212#include <soc/rtc.h>
1313#include <soc/wdev_reg.h>
1414#include <soc/rtc_cntl_reg.h>
1515#include <soc/apb_ctrl_reg.h>
1616#include <esp_system.h>
1717#include <soc.h>
18- #include <xtensa/core-macros .h>
18+ #include <drivers/entropy .h>
1919
20- extern int esp_clk_cpu_freq (void );
21- extern int esp_clk_apb_freq (void );
20+ #ifdef CONFIG_SOC_ESP32
21+ #include <xtensa/core-macros.h>
22+ #include <soc/dport_reg.h>
23+ #endif
2224
2325static inline uint32_t entropy_esp32_get_u32 (void )
2426{
@@ -37,9 +39,10 @@ static inline uint32_t entropy_esp32_get_u32(void)
3739 uint32_t ccount ;
3840
3941 do {
40- ccount = XTHAL_GET_CCOUNT ();
42+ ccount = cpu_hal_get_cycle_count ();
4143 } while (ccount - last_ccount < cpu_to_apb_freq_ratio * 16 );
4244 last_ccount = ccount ;
45+
4346 return REG_READ (WDEV_RND_REG );
4447}
4548
Original file line number Diff line number Diff line change 88/ {
99 #address-cells = <1>;
1010 #size-cells = <1>;
11+ chosen {
12+ zephyr,entropy = &trng0;
13+ };
1114
1215 cpus {
1316 #address-cells = <1>;
3740 label = "UART_0";
3841 status = "disabled";
3942 };
43+
44+ trng0: trng@3ff700b0 {
45+ compatible = "espressif,esp32-trng";
46+ reg = <0x3FF700B0 0x4>;
47+ label = "TRNG_0";
48+ status = "disabled";
49+ };
4050 };
4151
4252};
Original file line number Diff line number Diff line change @@ -130,6 +130,12 @@ SECTIONS
130130 *libzephyr.a :log_backend_uart.*(.literal .text .literal .* .text .*)
131131 *liblib__libc__minimal.a :string.*(.literal .text .literal .* .text .*)
132132 *libgcov.a :(.literal .text .literal .* .text .*)
133+
134+ *libnet80211.a :( .wifi0iram .wifi0iram .* .wifislpiram .wifislpiram .*)
135+ *libpp.a :( .wifi0iram .wifi0iram .* .wifislpiram .wifislpiram .*)
136+ *libnet80211.a :( .wifirxiram .wifirxiram .* .wifislprxiram .wifislprxiram .*)
137+ *libpp.a :( .wifirxiram .wifirxiram .* .wifislprxiram .wifislprxiram .*)
138+
133139 . = ALIGN (4 );
134140 _init_end = ABSOLUTE (.);
135141 _iram_text_end = ABSOLUTE (.); *(.srodata )
You can’t perform that action at this time.
0 commit comments