llext: hotfix: fix device API tests for platforms without console

LLEXT tests currently fail on platforms where a console was chosen but
its underlying device is not enabled. This might happen for example on
multicore SoCs, where the console is only enabled on the most powerful
CPU.

Fix this by only allowing testing the device API if the console device
is both chosen and enabled in the final DT.

Signed-off-by: Luca Burelli <l.burelli@arduino.cc>
This commit is contained in:
Luca Burelli 2024-10-03 14:37:54 +02:00 committed by Fabio Baltieri
parent b43e7387db
commit 7773fe8dd6
2 changed files with 2 additions and 2 deletions

View file

@ -109,7 +109,7 @@ static void threads_objects_test_setup(struct llext *, struct k_thread *llext_th
k_object_access_grant(&my_sem, llext_thread);
k_object_access_grant(&my_thread, llext_thread);
k_object_access_grant(&my_thread_stack, llext_thread);
#if DT_HAS_CHOSEN(zephyr_console)
#if DT_HAS_CHOSEN(zephyr_console) && DT_NODE_HAS_STATUS_OKAY(DT_CHOSEN(zephyr_console))
k_object_access_grant(DEVICE_DT_GET(DT_CHOSEN(zephyr_console)), llext_thread);
#endif
}

View file

@ -22,7 +22,7 @@
* Some platforms do not define any usable DT devices (not even the console).
* In those cases the device API test can't be executed.
*/
#if DT_HAS_CHOSEN(zephyr_console)
#if DT_HAS_CHOSEN(zephyr_console) && DT_NODE_HAS_STATUS_OKAY(DT_CHOSEN(zephyr_console))
#define CONSOLE_DT_NODE DT_CHOSEN(zephyr_console)
#endif