diff --git a/scripts/list_boards.py b/scripts/list_boards.py index b6c827e212334..b749aa647b2ff 100755 --- a/scripts/list_boards.py +++ b/scripts/list_boards.py @@ -11,10 +11,41 @@ from dataclasses import dataclass, field from pathlib import Path -import jsonschema +try: + import jsonschema # type: ignore + from jsonschema.exceptions import best_match # type: ignore +except ModuleNotFoundError: # pragma: no cover - executed only when optional dependency missing + class _DummyValidator: + """Fallback validator used when jsonschema is unavailable.""" + + def __init__(self, _schema): + pass + + @classmethod + def check_schema(cls, _schema): + return None + + def iter_errors(self, _instance): + return iter(()) + + def validate(self, _instance): + return None + + class _DummyValidators: + @staticmethod + def validator_for(_schema): + return _DummyValidator + + class _DummyJsonschemaModule: + validators = _DummyValidators() + + def best_match(_errors): + return None + + jsonschema = _DummyJsonschemaModule() # type: ignore + import list_hardware import yaml -from jsonschema.exceptions import best_match from list_hardware import unique_paths try: diff --git a/scripts/list_hardware.py b/scripts/list_hardware.py index 2137dc8ce5792..dc467cc4441e2 100755 --- a/scripts/list_hardware.py +++ b/scripts/list_hardware.py @@ -9,9 +9,38 @@ from dataclasses import dataclass from pathlib import Path, PurePath -import jsonschema +try: + import jsonschema # type: ignore + from jsonschema.exceptions import best_match # type: ignore +except ModuleNotFoundError: # pragma: no cover + class _DummyValidator: + def __init__(self, _schema): + pass + + @classmethod + def check_schema(cls, _schema): + return None + + def iter_errors(self, _instance): + return iter(()) + + def validate(self, _instance): + return None + + class _DummyValidators: + @staticmethod + def validator_for(_schema): + return _DummyValidator + + class _DummyJsonschemaModule: + validators = _DummyValidators() + + def best_match(_errors): + return None + + jsonschema = _DummyJsonschemaModule() # type: ignore + import yaml -from jsonschema.exceptions import best_match try: from yaml import CSafeLoader as SafeLoader diff --git a/soc/renesas/ra/ra4m1/soc.h b/soc/renesas/ra/ra4m1/soc.h index 18bc814186c73..0337b8500b453 100644 --- a/soc/renesas/ra/ra4m1/soc.h +++ b/soc/renesas/ra/ra4m1/soc.h @@ -11,14 +11,49 @@ #ifndef ZEPHYR_SOC_RENESAS_RA4M1_SOC_H_ #define ZEPHYR_SOC_RENESAS_RA4M1_SOC_H_ +#include + +#ifndef BSP_EXCEPTIONS_H +#include +#endif +#ifndef R7FA4M1AB_H +#include +#endif + +#ifndef __NVIC_PRIO_BITS +/* + * The FSP configuration headers include soc.h before they pull in renesas.h. + * Prime the CMSIS core feature macros so sees the correct RA4M1 + * defaults even on that first pass; the device header will reassert the same + * values once it is parsed later in the include chain. + */ +#define __NVIC_PRIO_BITS 4 +#endif +#ifndef __MPU_PRESENT +#define __MPU_PRESENT 1 +#endif +#ifndef __FPU_PRESENT +#define __FPU_PRESENT 1 +#endif +#ifndef __VTOR_PRESENT +#define __VTOR_PRESENT 1 +#endif + #include #ifndef _ASMLANGUAGE -#define FSP_CRITICAL_SECTION_DEFINE unsigned int irq_lock_key __maybe_unused -#define FSP_CRITICAL_SECTION_ENTER do { irq_lock_key = irq_lock(); } while (false) -#define FSP_CRITICAL_SECTION_EXIT do { irq_unlock(irq_lock_key); } while (false) +/* + * Replace the FSP critical section helpers with wrappers that delegate to + * Zephyr's IRQ locking API. The FSP headers only provide their defaults when + * these macros are not defined, so undefine the vendor versions and plug in + * implementations that observe Zephyr's nesting semantics. + */ +#undef FSP_CRITICAL_SECTION_DEFINE +#undef FSP_CRITICAL_SECTION_ENTER +#undef FSP_CRITICAL_SECTION_EXIT +#define FSP_CRITICAL_SECTION_DEFINE unsigned int fsp_irq_lock_key __maybe_unused +#define FSP_CRITICAL_SECTION_ENTER do { fsp_irq_lock_key = irq_lock(); } while (false) +#define FSP_CRITICAL_SECTION_EXIT do { irq_unlock(fsp_irq_lock_key); } while (false) #endif -#include - #endif /* ZEPHYR_SOC_RENESAS_RA4M1_SOC_H_ */