Commit graph

16 commits

Author SHA1 Message Date
Benjamin Cabé 9d1df132b1 script: gen_isr_tables: remove unnecessary warning log
Remove a message that had a typo in it but, more importantly that was
not needed.
The CONFIG_ISR_TABLES_LOCAL_DECLARATION already selects EXPERIMENTAL so
a user is properly alerted about the consequences just like any other
EXPERIMENTAL features if they enable WARN_EXPERIMENTAL.

Signed-off-by: Benjamin Cabé <benjamin@zephyrproject.org>
2024-02-26 11:55:59 +00:00
Laurentiu Mihalcea 89a2a147a9 build: gen_isr_tables.py: fix bad IRQ index computation for L3 interrupts
According to the Zephyr documentation, the multi-level interrupts
are encoded as follows:

`L1_ID | ((L2_ID + 1) << L2_BITS) | ((L3_ID + 1) << (L3_BITS + L2_BITS))`

This means that when L3 interrupts are enabled, the gen_isr_table.py
script will receive the value of L2_ID + 1. Currently, the script
takes this value and directly compares it with the offsets set via
`CONFIG_3RD_LVL_INTR_xx_OFFSET`. This is wrong because the values from
said configurations are the same as L2_ID and because of that the
script will generate an error. To fix this, use the value of L2_ID
instead of L2_ID + 1.

Signed-off-by: Laurentiu Mihalcea <laurentiu.mihalcea@nxp.com>
2024-02-14 22:57:29 +01:00
Radoslaw Koppel 0ae48ecb58 scripts: build: gen_isr_tables: Implement local ISR generation
This commit moves all the functionality related to the current
interrupt parser into gen_isr_tables_parser_carrays.py file.
The new parser file gen_isr_tables_parser_local.py file is
implemented with the new parser that.
Additional information added to the generated interrupt header
that contains data required by the new parser.

Signed-off-by: Radosław Koppel <radoslaw.koppel@nordicsemi.no>
2024-02-02 19:49:36 +01:00
Radoslaw Koppel 568cced14f scripts: gen_isr_tables: Break code into classes
This commit breaks the code into functional classes.
This way the functionality is visibly splitted into
functional parts and it is easier to replace the
specific parser part to implement new code generators.

There is also common functionality to handle multi level interrupts
moved to configuration class.

Signed-off-by: Radosław Koppel <radoslaw.koppel@nordicsemi.no>
2024-02-02 19:49:36 +01:00
Radoslaw Koppel 4360acb27e scripts: gen_isr_tables: Code cleanup
This commit cleans up the gen_isr_tables code for better clarity
and easier modification.
Changes include:
- Separate functions to load intList section.
- Replace spurious handlers in internal data with None.
  Now it is the output generator work to choose right function.
- All the work to generate vt and swt separated into its own functions.
- Remove the need for internal shared array - all the information
  is here in swt array.
- The update_masks function - more functionality moved here.
- Simplify bit_mask function.

Signed-off-by: Radosław Koppel <radoslaw.koppel@nordicsemi.no>
2024-02-02 19:49:36 +01:00
Yong Cong Sin 89fb8f8b98 gen_isr_tables: print index number at the end of each entry as comment
Make it easier to debug by printing the index number at the
end, this is especially helpful when there's a lot of
interrupts.

Before:

```c
/* build/zephyr/isr_tables.c */
{(const void *)0x0, (ISR)((uintptr_t)&z_irq_spurious)},
{(const void *)0x0, (ISR)((uintptr_t)&z_irq_spurious)},
{(const void *)0x0, (ISR)((uintptr_t)&z_irq_spurious)},
{(const void *)0x0, (ISR)((uintptr_t)&z_irq_spurious)},
{(const void *)0x0, (ISR)((uintptr_t)&z_irq_spurious)},
{(const void *)0x0, (ISR)((uintptr_t)&z_irq_spurious)},
{(const void *)0x0, (ISR)((uintptr_t)&z_irq_spurious)},
```

After:

```c
/* build/zephyr/isr_tables.c */
{(const void *)0x0, (ISR)((uintptr_t)&z_irq_spurious)}, /* 0 */
{(const void *)0x0, (ISR)((uintptr_t)&z_irq_spurious)}, /* 1 */
{(const void *)0x0, (ISR)((uintptr_t)&z_irq_spurious)}, /* 2 */
{(const void *)0x0, (ISR)((uintptr_t)&z_irq_spurious)}, /* 3 */
{(const void *)0x0, (ISR)((uintptr_t)&z_irq_spurious)}, /* 4 */
{(const void *)0x0, (ISR)((uintptr_t)&z_irq_spurious)}, /* 5 */
{(const void *)0x0, (ISR)((uintptr_t)&z_irq_spurious)}, /* 6 */
```

Signed-off-by: Yong Cong Sin <ycsin@meta.com>
2024-01-23 06:40:32 -05:00
Greter Raffael 7bcd0699e6 gen_isr_tables: Add meaningful error message
When using direct isrs, a vector table is needed. However, if none is
present , i.e. `CONFIG_GEN_IRQ_VECTOR_TABLE=n`, this script failed. The
given error message was not helpful (`'NoneType' has no len()`).
This change makes it clearer, where to look for the problem.

Signed-off-by: Greter Raffael <rgreter@baumer.com>
2024-01-22 15:28:39 +01:00
Yong Cong Sin 0884a33ee3 scripts: build: gen_isr_tables: add some debug prints
Add some debug prints for the interrupts bits and bitmasks
in each level.

Signed-off-by: Yong Cong Sin <ycsin@meta.com>
2023-12-18 15:09:19 -05:00
Yong Cong Sin b4db285c1f scripts: build: gen_isr_tables: change naming of bitmask variables
Rename the bitmask variables from `*_LVL_INTERRUPTS` to
`INTERRUPT_LVL_BITMASK[]` array to be consistent with
`INTERRUPT_BITS`, making it easier to loop over the bitmasks.

Signed-off-by: Yong Cong Sin <ycsin@meta.com>
2023-12-18 15:09:19 -05:00
Yong Cong Sin 56570cc8c1 scripts: build: gen_isr_tables: fix calculation of THIRD_LVL_INTERRUPTS
The calculation of `THIRD_LVL_INTERRUPTS` bitmask in the
`update_masks()` function is wrong, the number of bits to shift
should be the sum of the first two levels.

Signed-off-by: Yong Cong Sin <ycsin@meta.com>
2023-12-18 15:09:19 -05:00
Radoslaw Koppel 48b93ee0aa scripts: build: gen_isr_tables: Cleanup access to ".intList"
This commit removes the needs or generating isrList.bin temporary file.
Now gen_isr_tables.py script access the required section directly in
elf file, that was accessed by the script anyway.
It simplifies the building removing one step.

Signed-off-by: Radosław Koppel <radoslaw.koppel@nordicsemi.no>
2023-10-20 14:58:55 +02:00
Laurentiu Mihalcea 017cf89a83 arch: Add support for static shared interrupts
This commit introduces all the necessary changes for
enabling the usage of shared interrupts.

This works by using a second interrupt table: _shared_sw_isr_table
which keeps track of all of the ISR/arg pairs sharing the same
interrupt line. Whenever a second ISR/arg pair is registered
on the same interrupt line using IRQ_CONNECT(), the entry in
_sw_isr_table will be overwriten by a
(shared_isr, _shared_sw_isr_table[irq]) pair. In turn, shared_isr()
will invoke all of the ISR/arg pairs registered on the same
interrupt line.

This feature only works statically, meaning you can only make use
of shared interrupts using IRQ_CONNECT(). Attempting to dynamically
register a ISR/arg pair will overwrite the hijacked _sw_isr_table
entry.

Signed-off-by: Laurentiu Mihalcea <laurentiu.mihalcea@nxp.com>
2023-09-14 08:35:12 +02:00
Joshua Lilly cce530cae4 scripts: build: gen_isr_tables: make bit masks configurable
Some architectures such as RISC-v support more than 255 interrupts
per aggrigator. This diff adds the ability to forgo the aggrigator
pattern and use a configurable number of bits for multilevel
interruts.

Signed-off-by: Joshua Lilly <jgl@meta.com>
2023-08-10 10:55:41 -04:00
Aurelien Jarno bdb3fd0ae9 scripts: gen_isr_tables: fix pylint issues
pylint reports the following issues on the
scripts/build/gen_isr_tables.py:

 C0325:Unnecessary parens after '=' keyword (superfluous-parens)
File:scripts/build/gen_isr_tables.py
Line:16
Column:0
 C0325:Unnecessary parens after '=' keyword (superfluous-parens)
File:scripts/build/gen_isr_tables.py
Line:316
Column:0

Fix that so that unrelated PR touching the same file have a chance to
pass the compliance checks.

Signed-off-by: Aurelien Jarno <aurelien@aurel32.net>
2023-04-26 12:58:13 +02:00
Jamie McCrae ec7044437e treewide: Disable automatic argparse argument shortening
Disables allowing the python argparse library from automatically
shortening command line arguments, this prevents issues whereby
a new command is added and code that wrongly uses the shortened
command of an existing argument which is the same as the new
command being added will silently change script behaviour.

Signed-off-by: Jamie McCrae <jamie.mccrae@nordicsemi.no>
2023-01-26 20:12:36 +09:00
Anas Nashif c36307ea86 scripts: move gen_isr_tables.py to scripts/build/gen_isr_tables.py
Move scripts needed by the build system and not designed to be run
individually or standalone into the build subfolder.

Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2022-07-12 10:03:45 +02:00
Renamed from scripts/gen_isr_tables.py (Browse further)