Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
35 changes: 33 additions & 2 deletions scripts/list_boards.py
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down
33 changes: 31 additions & 2 deletions scripts/list_hardware.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#!/usr/bin/env python3

Check warning on line 1 in scripts/list_hardware.py

View workflow job for this annotation

GitHub Actions / Run compliance checks on patch series (PR)

R0801

scripts/list_hardware.py:1 Similar lines in 2 files ==list_boards:[13:55] ==list_hardware:[11:50] 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 try: from yaml import CSafeLoader as SafeLoader except ImportError: from yaml import SafeLoader (duplicate-code)

# Copyright (c) 2023 Nordic Semiconductor ASA
# SPDX-License-Identifier: Apache-2.0
Expand All @@ -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
Expand Down
45 changes: 40 additions & 5 deletions soc/renesas/ra/ra4m1/soc.h
Original file line number Diff line number Diff line change
Expand Up @@ -11,14 +11,49 @@
#ifndef ZEPHYR_SOC_RENESAS_RA4M1_SOC_H_
#define ZEPHYR_SOC_RENESAS_RA4M1_SOC_H_

#include <bsp_api.h>

#ifndef BSP_EXCEPTIONS_H
#include <bsp_exceptions.h>
#endif
#ifndef R7FA4M1AB_H
#include <R7FA4M1AB.h>
#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 <zephyr/irq.h> 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 <zephyr/irq.h>

#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)
Comment on lines +52 to +55

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P1 Badge Override FSP critical macros before including vendor headers

The Zephyr wrappers for FSP_CRITICAL_SECTION_* are defined only after bsp_api.h has been included. Inline helpers in the FSP headers (for example R_BSP_PinAccessEnable in bsp_io.h) expand these macros while the vendor defaults are still in force, so those helpers continue to manipulate PRIMASK/Basepri directly and never use irq_lock. This leaves most FSP code with its original interrupt semantics despite the change. Move the override ahead of the bsp_api.h inclusion so all inline functions pick up the Zephyr-aware macros.

Useful? React with 👍 / 👎.

#define FSP_CRITICAL_SECTION_EXIT do { irq_unlock(fsp_irq_lock_key); } while (false)
#endif

#include <bsp_api.h>

#endif /* ZEPHYR_SOC_RENESAS_RA4M1_SOC_H_ */
Loading