Various fixes and improvements (#515)
* Optional internal pull-ups for SD/MMC pins in DTS * Selectable on‑chip LDO channel for SD/MMC power (can be disabled) * Added several sensor/driver modules to generic ESP32 device configurations so that they become part of the SDKs * SD card mount now prints card information for clearer diagnostics * Fix for bug DTS boolean parsing. Improved tests to catch these issues. * Expanded SDK integration test to include new modules and headers * Modularized packaging to generate per‑module build files and include driver assets
This commit is contained in:
committed by
GitHub
parent
be2cdc0b90
commit
4170b86137
@@ -0,0 +1,16 @@
|
||||
description: Boolean test device binding
|
||||
compatible: "test,bool-device"
|
||||
properties:
|
||||
binding-default-true-setting-implied:
|
||||
type: boolean
|
||||
default: true
|
||||
binding-default-false-setting-implied:
|
||||
type: boolean
|
||||
default: false
|
||||
binding-default-false-setting-direct:
|
||||
type: boolean
|
||||
default: false
|
||||
binding-implied-true-setting-direct:
|
||||
type: boolean
|
||||
binding-implied-true-setting-implied:
|
||||
type: boolean
|
||||
+2
-4
@@ -1,11 +1,9 @@
|
||||
description: Test device binding
|
||||
compatible: "test,device"
|
||||
description: Generic test device binding
|
||||
compatible: "test,generic-device"
|
||||
properties:
|
||||
reg:
|
||||
type: int
|
||||
required: true
|
||||
boolean-prop:
|
||||
type: boolean
|
||||
int-prop:
|
||||
type: int
|
||||
string-prop:
|
||||
@@ -0,0 +1,57 @@
|
||||
// Default headers
|
||||
#include <tactility/device.h>
|
||||
#include <tactility/dts.h>
|
||||
#include <tactility/module.h>
|
||||
// DTS headers
|
||||
#include <test_include.h>
|
||||
|
||||
static const root_config_dt root_config = {
|
||||
"Test Model"
|
||||
};
|
||||
|
||||
static struct Device root = {
|
||||
.name = "/",
|
||||
.config = &root_config,
|
||||
.parent = NULL,
|
||||
.internal = NULL
|
||||
};
|
||||
|
||||
static const generic_device_config_dt test_device@0_config = {
|
||||
0,
|
||||
42,
|
||||
"hello"
|
||||
};
|
||||
|
||||
static struct Device test_device@0 = {
|
||||
.name = "test-device@0",
|
||||
.config = &test_device@0_config,
|
||||
.parent = &root,
|
||||
.internal = NULL
|
||||
};
|
||||
|
||||
static const bool_device_config_dt bool_test_device_config = {
|
||||
true,
|
||||
false,
|
||||
true,
|
||||
true,
|
||||
true
|
||||
};
|
||||
|
||||
static struct Device bool_test_device = {
|
||||
.name = "bool-test-device",
|
||||
.config = &bool_test_device_config,
|
||||
.parent = &root,
|
||||
.internal = NULL
|
||||
};
|
||||
|
||||
struct DtsDevice dts_devices[] = {
|
||||
{ &root, "test,root", DTS_DEVICE_STATUS_OKAY },
|
||||
{ &test_device@0, "test,generic-device", DTS_DEVICE_STATUS_OKAY },
|
||||
{ &bool_test_device, "test,bool-device", DTS_DEVICE_STATUS_OKAY },
|
||||
DTS_DEVICE_TERMINATOR
|
||||
};
|
||||
|
||||
|
||||
struct Module* dts_modules[] = {
|
||||
NULL
|
||||
};
|
||||
@@ -0,0 +1,17 @@
|
||||
#pragma once
|
||||
#include <tactility/error.h>
|
||||
#include <tactility/dts.h>
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
// Array of device tree modules terminated with DTS_MODULE_TERMINATOR
|
||||
extern struct DtsDevice dts_devices[];
|
||||
|
||||
// Array of module symbols terminated with NULL
|
||||
extern struct Module* dts_modules[];
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
@@ -7,11 +7,16 @@
|
||||
model = "Test Model";
|
||||
|
||||
test_device1: test-device@0 {
|
||||
compatible = "test,device";
|
||||
compatible = "test,generic-device";
|
||||
reg = <0>;
|
||||
status = "okay";
|
||||
boolean-prop;
|
||||
int-prop = <42>;
|
||||
string-prop = "hello";
|
||||
};
|
||||
|
||||
bool-test-device {
|
||||
compatible = "test,bool-device";
|
||||
binding-default-false-setting-direct;
|
||||
binding-implied-true-setting-direct;
|
||||
};
|
||||
};
|
||||
|
||||
@@ -30,13 +30,23 @@ def test_compile_success():
|
||||
print(f"FAILED: Compilation failed: {result.stderr} {result.stdout}")
|
||||
return False
|
||||
|
||||
if not os.path.exists(os.path.join(output_dir, "devicetree.c")):
|
||||
print("FAILED: devicetree.c not generated")
|
||||
return False
|
||||
for filename in ["devicetree.c", "devicetree.h"]:
|
||||
generated_path = os.path.join(output_dir, filename)
|
||||
expected_path = os.path.join(TEST_DATA_DIR, f"expected_{filename}")
|
||||
|
||||
if not os.path.exists(os.path.join(output_dir, "devicetree.h")):
|
||||
print("FAILED: devicetree.h not generated")
|
||||
return False
|
||||
if not os.path.exists(generated_path):
|
||||
print(f"FAILED: {filename} not generated")
|
||||
return False
|
||||
|
||||
if not os.path.exists(expected_path):
|
||||
print(f"FAILED: {os.path.basename(expected_path)} not found in test data")
|
||||
return False
|
||||
|
||||
diff_result = subprocess.run(["diff", "-u", expected_path, generated_path], capture_output=True, text=True)
|
||||
if diff_result.returncode != 0:
|
||||
print(f"FAILED: {filename} does not match expected_{filename}")
|
||||
print(diff_result.stdout)
|
||||
return False
|
||||
|
||||
print("PASSED")
|
||||
return True
|
||||
|
||||
Reference in New Issue
Block a user