|
1 | 1 | /*
|
2 |
| - * Copyright 2024 NXP |
| 2 | + * Copyright (c) 2023 Google LLC. |
| 3 | + * Copyright 2024, 2025 NXP |
3 | 4 | *
|
4 | 5 | * SPDX-License-Identifier: Apache-2.0
|
5 | 6 | */
|
6 | 7 |
|
7 | 8 | #ifndef __XTENSA_MEMORY_H__
|
8 | 9 | #define __XTENSA_MEMORY_H__
|
9 | 10 |
|
10 |
| -#include <zephyr/autoconf.h> |
| 11 | +#include <zephyr/devicetree.h> |
11 | 12 |
|
12 |
| -#define IRAM_RESERVE_HEADER_SPACE 0x400 |
| 13 | +#define TEXT_BASE (DT_REG_ADDR(DT_NODELABEL(adsp_text))) |
| 14 | +#define TEXT_SIZE (DT_REG_SIZE(DT_NODELABEL(adsp_text))) |
| 15 | +#define DATA_BASE (DT_REG_ADDR(DT_NODELABEL(adsp_data))) |
| 16 | +#define DATA_SIZE (DT_REG_SIZE(DT_NODELABEL(adsp_data))) |
| 17 | +#define RESET_BASE (DT_REG_ADDR(DT_NODELABEL(adsp_reset))) |
| 18 | +#define RESET_SIZE (DT_REG_SIZE(DT_NODELABEL(adsp_reset))) |
13 | 19 |
|
14 |
| -#define IRAM_BASE 0x24020000 |
15 |
| -#define IRAM_SIZE 0x10000 |
| 20 | +#if TEXT_BASE == 0 || TEXT_SIZE == 0 |
| 21 | +#error "Text memory region is improperly defined - missing adsp_text in DT?" |
| 22 | +#endif |
16 | 23 |
|
17 |
| -#define DRAM_BASE 0x24000000 |
18 |
| -#define DRAM_SIZE 0x10000 |
| 24 | +#if DATA_BASE == 0 || DATA_SIZE == 0 |
| 25 | +#error "Data memory region is improperly defined - missing adsp_data in DT?" |
| 26 | +#endif |
19 | 27 |
|
20 |
| -#define SDRAM0_BASE 0x20200000 |
21 |
| -#define SDRAM0_SIZE 0xFFFFF |
| 28 | +#if RESET_BASE == 0 || RESET_SIZE == 0 |
| 29 | +#error "Reset memory region is improperly defined - missing adsp_reset in DT?" |
| 30 | +#endif |
22 | 31 |
|
23 |
| -/* The reset vector address in IRAM and its size. */ |
24 |
| -#define XCHAL_RESET_VECTOR0_PADDR_IRAM IRAM_BASE |
25 |
| -#define MEM_RESET_TEXT_SIZE (0x2E0) |
| 32 | +/* The reset vector address in SRAM and its size. */ |
| 33 | +#define XCHAL_RESET_VECTOR0_PADDR_IRAM (RESET_BASE) |
| 34 | +#define MEM_RESET_TEXT_SIZE (0x2e0) |
26 | 35 | #define MEM_RESET_LIT_SIZE (0x120)
|
27 | 36 |
|
28 | 37 | /* Base address of all interrupt vectors in IRAM. */
|
29 |
| -#define XCHAL_VECBASE_RESET_PADDR_IRAM (IRAM_BASE + IRAM_RESERVE_HEADER_SPACE) |
| 38 | +#define XCHAL_VECBASE_RESET_PADDR_IRAM (TEXT_BASE) |
30 | 39 | #define MEM_VECBASE_LIT_SIZE (0x178)
|
| 40 | + |
31 | 41 | /* Vector and literal sizes. */
|
32 | 42 | #define MEM_VECT_LIT_SIZE (0x4)
|
33 | 43 | #define MEM_VECT_TEXT_SIZE (0x1C)
|
|
42 | 52 | #define XCHAL_USER_VECTOR_PADDR_IRAM (XCHAL_INT_VECTOR_ADDR(0x21C))
|
43 | 53 | #define XCHAL_DOUBLEEXC_VECTOR_PADDR_IRAM (XCHAL_INT_VECTOR_ADDR(0x23C))
|
44 | 54 |
|
45 |
| -/* Location for the intList section which is later used to construct the |
| 55 | + |
| 56 | +/* Size and location of the intList section. Later used to construct the |
46 | 57 | * Interrupt Descriptor Table (IDT). This is a bogus address as this
|
47 |
| - * section will be stripped off in the final image. |
| 58 | + * section will be stripped off in the final image. Situated before the DSP's |
| 59 | + * ITCM - prevents memory region inflation in zephyr_pre0.elf. |
48 | 60 | */
|
49 |
| -#define IDT_BASE (IRAM_BASE + IRAM_SIZE) |
50 |
| - |
51 |
| -/* Size of the Interrupt Descriptor Table (IDT). */ |
52 | 61 | #define IDT_SIZE (0x2000)
|
| 62 | +#define IDT_BASE (RESET_BASE - IDT_SIZE) |
53 | 63 |
|
54 | 64 | #endif
|
0 commit comments