-
Notifications
You must be signed in to change notification settings - Fork 7.5k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'master' into release/v3.1.x
- Loading branch information
Showing
9 changed files
with
732 additions
and
32 deletions.
There are no files selected for viewing
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
{ | ||
"platforms": { | ||
"qemu": false, | ||
"wokwi": false | ||
}, | ||
"requires": [ | ||
"CONFIG_SPIRAM=y" | ||
], | ||
"targets": { | ||
"esp32c3": false, | ||
"esp32c6": false, | ||
"esp32h2": false | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,112 @@ | ||
#include <Arduino.h> | ||
#include <unity.h> | ||
|
||
#define MAX_TEST_SIZE 512 * 1024 // 512KB | ||
|
||
void *buf = NULL; | ||
|
||
void test_malloc_success(void) { | ||
buf = ps_malloc(MAX_TEST_SIZE); | ||
TEST_ASSERT_NOT_NULL(buf); | ||
free(buf); | ||
buf = NULL; | ||
} | ||
|
||
void test_calloc_success(void) { | ||
buf = ps_calloc(MAX_TEST_SIZE, 1); | ||
TEST_ASSERT_NOT_NULL(buf); | ||
free(buf); | ||
buf = NULL; | ||
} | ||
|
||
void test_realloc_success(void) { | ||
buf = ps_malloc(MAX_TEST_SIZE); | ||
TEST_ASSERT_NOT_NULL(buf); | ||
buf = ps_realloc(buf, MAX_TEST_SIZE + 1024); | ||
TEST_ASSERT_NOT_NULL(buf); | ||
free(buf); | ||
buf = NULL; | ||
} | ||
|
||
void test_malloc_fail(void) { | ||
buf = ps_malloc(0xFFFFFFFF); | ||
TEST_ASSERT_NULL(buf); | ||
} | ||
|
||
void test_memset_all_zeroes(void) { | ||
memset(buf, 0, MAX_TEST_SIZE); | ||
for (size_t i = 0; i < MAX_TEST_SIZE; i++) { | ||
TEST_ASSERT_EQUAL(0, ((uint8_t *)buf)[i]); | ||
} | ||
} | ||
|
||
void test_memset_all_ones(void) { | ||
memset(buf, 0xFF, MAX_TEST_SIZE); | ||
for (size_t i = 0; i < MAX_TEST_SIZE; i++) { | ||
TEST_ASSERT_EQUAL(0xFF, ((uint8_t *)buf)[i]); | ||
} | ||
} | ||
|
||
void test_memset_alternating(void) { | ||
for (size_t i = 0; i < MAX_TEST_SIZE; i++) { | ||
((uint8_t *)buf)[i] = i % 2 == 0 ? 0x00 : 0xFF; | ||
} | ||
memset(buf, 0xAA, MAX_TEST_SIZE); | ||
for (size_t i = 0; i < MAX_TEST_SIZE; i++) { | ||
TEST_ASSERT_EQUAL(0xAA, ((uint8_t *)buf)[i]); | ||
} | ||
} | ||
|
||
void test_memset_random(void) { | ||
for (size_t i = 0; i < MAX_TEST_SIZE; i++) { | ||
((uint8_t *)buf)[i] = random(0, 256); | ||
} | ||
memset(buf, 0x55, MAX_TEST_SIZE); | ||
for (size_t i = 0; i < MAX_TEST_SIZE; i++) { | ||
TEST_ASSERT_EQUAL(0x55, ((uint8_t *)buf)[i]); | ||
} | ||
} | ||
|
||
void test_memcpy(void) { | ||
void *buf2 = malloc(1024); // 1KB | ||
TEST_ASSERT_NOT_NULL(buf2); | ||
memset(buf, 0x55, MAX_TEST_SIZE); | ||
memset(buf2, 0xAA, 1024); | ||
|
||
#pragma GCC diagnostic push | ||
#pragma GCC diagnostic ignored "-Wpointer-arith" | ||
|
||
for (size_t i = 0; i < MAX_TEST_SIZE; i += 1024) { | ||
memcpy(buf + i, buf2, 1024); | ||
} | ||
|
||
for (size_t i = 0; i < MAX_TEST_SIZE; i += 1024) { | ||
TEST_ASSERT_NULL(memcmp(buf + i, buf2, 1024)); | ||
} | ||
|
||
#pragma GCC diagnostic pop | ||
|
||
free(buf2); | ||
} | ||
|
||
void setup() { | ||
Serial.begin(115200); | ||
while (!Serial) { | ||
delay(10); | ||
} | ||
|
||
UNITY_BEGIN(); | ||
RUN_TEST(test_malloc_success); | ||
RUN_TEST(test_malloc_fail); | ||
RUN_TEST(test_calloc_success); | ||
RUN_TEST(test_realloc_success); | ||
buf = ps_malloc(MAX_TEST_SIZE); | ||
RUN_TEST(test_memset_all_zeroes); | ||
RUN_TEST(test_memset_all_ones); | ||
RUN_TEST(test_memset_alternating); | ||
RUN_TEST(test_memset_random); | ||
RUN_TEST(test_memcpy); | ||
UNITY_END(); | ||
} | ||
|
||
void loop() {} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
def test_psram(dut): | ||
dut.expect_unity_test_output(timeout=120) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
#ifndef Pins_Arduino_h | ||
#define Pins_Arduino_h | ||
|
||
#include <stdint.h> | ||
|
||
static const uint8_t LED_BUILTIN = 2; | ||
#define BUILTIN_LED LED_BUILTIN // backward compatibility | ||
#define LED_BUILTIN LED_BUILTIN // allow testing #ifdef LED_BUILTIN | ||
|
||
static const uint8_t A0 = 14; | ||
static const uint8_t A1 = 13; | ||
static const uint8_t A2 = 12; | ||
static const uint8_t A3 = 4; | ||
static const uint8_t A4 = 2; | ||
static const uint8_t A5 = 0; | ||
|
||
static const uint8_t TX = 1; | ||
static const uint8_t RX = 3; | ||
|
||
static const uint8_t TX_4G = 17; | ||
static const uint8_t RX_4G = 16; | ||
|
||
static const uint8_t SDA = 21; | ||
static const uint8_t SCL = 22; | ||
|
||
static const uint8_t SS = 5; | ||
static const uint8_t MOSI = 23; | ||
static const uint8_t MISO = 19; | ||
static const uint8_t SCK = 18; | ||
|
||
#endif /* Pins_Arduino_h */ |
Oops, something went wrong.
@me-no-dev is the change correct?
Isn't it still
SOC_UART_HP_NUM
?