Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 7375f9f

Browse files
committed
feat(wear_levelling): modify wear_levelling for ESP8266
1 parent 4bf6cae commit 7375f9f

File tree

2 files changed

+12
-4
lines changed

2 files changed

+12
-4
lines changed

components/wear_levelling/crc32.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212
// limitations under the License.
1313

1414
#include "crc32.h"
15-
#include "esp32/rom/crc.h"
15+
#include "rom/crc.h"
1616

1717
unsigned int crc32::crc32_le(unsigned int crc, unsigned char const *buf, unsigned int len)
1818
{

components/wear_levelling/test/test_wl.c

Lines changed: 11 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,17 +2,25 @@
22
#include <string.h>
33
#include "unity.h"
44
#include "wear_levelling.h"
5+
#include "esp_system.h"
6+
#include "esp_timer.h"
57
#include "test_utils.h"
68
#include "freertos/FreeRTOS.h"
7-
#include "freertos/portable.h"
9+
//#include "freertos/portable.h"
810
#include "freertos/task.h"
911
#include "freertos/semphr.h"
1012
#ifdef CONFIG_IDF_TARGET_ESP32
1113
#include "esp32/clk.h"
14+
#include "soc/cpu.h"
1215
#elif defined(CONFIG_IDF_TARGET_ESP32S2BETA)
1316
#include "esp32s2beta/clk.h"
14-
#endif
1517
#include "soc/cpu.h"
18+
#elif CONFIG_IDF_TARGET_ESP8266
19+
#include "esp_clk.h"
20+
#endif
21+
22+
#define xPortGetFreeHeapSize() esp_get_free_heap_size()
23+
#define RSR(_c, _t) _t = (uint32_t) esp_timer_get_time()
1624

1725
TEST_CASE("wl_unmount doesn't leak memory", "[wear_levelling]")
1826
{
@@ -101,7 +109,7 @@ static void read_write_task(void* param)
101109
esp_err_t err;
102110
srand(args->seed);
103111
for (size_t i = 0; i < args->word_count; ++i) {
104-
uint32_t val = rand();
112+
uint32_t val = i * 77;
105113
if (args->write) {
106114
err = wl_write(args->handle, args->offset + i * sizeof(val), &val, sizeof(val));
107115
if (err != ESP_OK) {

0 commit comments

Comments
 (0)