Skip to content

Commit 1c1f8ba

Browse files
committed
arch: microblaze: add MicroBlaze to arch/KConfig
Internal references: FWRIVERHD-4554 Signed-off-by: Alp Sayin <alpsayin@gmail.com>
1 parent e8fdca5 commit 1c1f8ba

File tree

9 files changed

+211
-7
lines changed

9 files changed

+211
-7
lines changed

arch/Kconfig

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -106,6 +106,18 @@ config NIOS2
106106
help
107107
Nios II Gen 2 architecture
108108

109+
config MICROBLAZE
110+
bool
111+
select ARCH_IS_SET
112+
select ATOMIC_OPERATIONS_C
113+
select GEN_ISR_TABLES
114+
select GEN_SW_ISR_TABLE
115+
select ARCH_HAS_EXTRA_EXCEPTION_INFO
116+
imply DYNAMIC_INTERRUPTS
117+
imply ARCH_HAS_CUSTOM_BUSY_WAIT
118+
help
119+
MicroBlaze architecture
120+
109121
config RISCV
110122
bool
111123
select ARCH_IS_SET

arch/archs.yml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,3 +19,5 @@ archs:
1919
path: xtensa
2020
- name: x86
2121
path: x86
22+
- name: microblaze
23+
path: microblaze

arch/microblaze/Kconfig

Lines changed: 114 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,114 @@
1+
# Copyright (c) 2023 Advanced Micro Devices, Inc. (AMD)
2+
# Copyright (c) 2023 Alp Sayin <alpsayin@gmail.com>
3+
# SPDX-License-Identifier: Apache-2.0
4+
5+
6+
menu "MicroBlaze Options"
7+
depends on MICROBLAZE
8+
9+
config ARCH
10+
string
11+
default "microblaze"
12+
13+
config CPU_MICROBLAZE
14+
bool
15+
default y
16+
help
17+
This option signifies the use of a MicroBlaze CPU
18+
19+
config CPU_VERSION
20+
prompt "MicroBlaze CPU Version"
21+
string
22+
default "v9.00.a"
23+
help
24+
Use features of, and schedule code for, the given CPU.
25+
Supported values are in the format "vX.YY.Z",
26+
where X is a major version, YY is the minor version, and Z is compatibility code.
27+
Example values are "v3.00.a", "v4.00.b", "v5.00.a", "v5.00.b", "v6.00.a".
28+
Taken from https://gcc.gnu.org/onlinedocs/gcc/MicroBlaze-Options.html
29+
30+
config GEN_IRQ_VECTOR_TABLE
31+
bool
32+
default n if MICROBLAZE
33+
help
34+
MicroBlaze has a single interrupt and therefore doesn't have an IRQ vector table.
35+
36+
config BIG_ENDIAN
37+
bool
38+
default n if MICROBLAZE
39+
help
40+
Our current default endianness is Little-endian.
41+
42+
config ARCH_SW_ISR_TABLE_ALIGN
43+
prompt "SW_ISR Table Align Size"
44+
default 4
45+
46+
config NUM_IRQS
47+
int
48+
default 1
49+
help
50+
This isn't really a choice either because a barebones MicroBlaze offers
51+
only 1 external interrupt pin (which is usually connected to an Xlnx Intc
52+
or probably a single peripheral which a user wants IRQs from).
53+
54+
choice
55+
prompt "Idle Sleep Option"
56+
default MICROBLAZE_IDLE_NOP
57+
58+
config MICROBLAZE_IDLE_NOP
59+
bool "NOP (no power saving)"
60+
help
61+
Executes pseudo-assembly instruction nop in idle.
62+
Reset_Mode[0:1] is set to 10
63+
64+
config MICROBLAZE_IDLE_SLEEP
65+
bool "Sleep"
66+
help
67+
Executes pseudo-assembly instruction sleep in idle.
68+
Reset_Mode[0:1] is set to 10
69+
70+
config MICROBLAZE_IDLE_HIBERNATE
71+
bool "Hibernate"
72+
help
73+
Executes pseudo-assembly instruction hibernate in idle.
74+
75+
config MICROBLAZE_IDLE_SUSPEND
76+
bool "Suspend"
77+
help
78+
Executes pseudo-assembly instruction suspend in idle.
79+
endchoice
80+
81+
config MICROBLAZE_DUMP_ON_EXCEPTION
82+
bool "Dump core on exceptions"
83+
default y
84+
85+
config EXTRA_EXCEPTION_INFO
86+
bool "Extra exception debug information"
87+
default y
88+
help
89+
Have exceptions print additional useful debugging information in
90+
human-readable form, at the expense of code size. For example,
91+
the cause code for an exception will be supplemented by a string
92+
describing what that cause code means.
93+
94+
# Bump the kernel default stack size values.
95+
config MAIN_STACK_SIZE
96+
default 4096 if COVERAGE_GCOV
97+
default 2048
98+
99+
config IDLE_STACK_SIZE
100+
default 1024
101+
102+
config ISR_STACK_SIZE
103+
default 4096
104+
105+
config TEST_EXTRA_STACK_SIZE
106+
default 4096 if COVERAGE_GCOV
107+
default 2048
108+
109+
config SYSTEM_WORKQUEUE_STACK_SIZE
110+
default 4096
111+
112+
source "arch/microblaze/Kconfig.features"
113+
114+
endmenu

arch/microblaze/Kconfig.features

Lines changed: 76 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,76 @@
1+
# Copyright (c) 2023 Advanced Micro Devices, Inc. (AMD)
2+
# Copyright (c) 2023 Alp Sayin <alpsayin@gmail.com>
3+
# SPDX-License-Identifier: Apache-2.0
4+
5+
6+
menu "HW Feature Options"
7+
depends on MICROBLAZE
8+
9+
# Picolibc with C++ support in Zephyr SDK is handled by Zephyr SDK's own Kconfig.
10+
config PICOLIBC_SUPPORTED
11+
bool
12+
default n
13+
help
14+
Microblaze doesn't have picolibc support yet
15+
16+
config MICROBLAZE_USE_MSR_INSTR
17+
prompt "Use msrset & msrclr instructions"
18+
def_bool y
19+
help
20+
This depends on CPU supporting msrset/msrclr instructions.
21+
xparameters would define this as MICROBLAZE_USE_MSR_INSTR = 1.
22+
23+
config MICROBLAZE_USE_BARREL_SHIFT_INSTR
24+
prompt "Use barrel shift instructions"
25+
def_bool y
26+
help
27+
This depends on CPU supporting barrel shift instructions.
28+
xparameters would define this as USE_BARREL = 1.
29+
30+
config MICROBLAZE_USE_PATTERN_COMPARE_INSTR
31+
prompt "Use pattern compare instructions"
32+
def_bool y
33+
help
34+
This depends on CPU supporting pattern compare instructions.
35+
xparameters would define this as USE_PCMP = 1.
36+
37+
config MICROBLAZE_USE_DIV_INSTR
38+
prompt "Use division instructions"
39+
def_bool y
40+
help
41+
This depends on CPU supporting hardware division instructions.
42+
xparameters would define this as USE_DIV = 1.
43+
44+
config MICROBLAZE_USE_MUL_INSTR
45+
prompt "Use multiplication instructions"
46+
def_bool y
47+
help
48+
This depends on CPU supporting hardware multiplication instructions.
49+
xparameters would define this as USE_HW_MUL >= 1.
50+
51+
config MICROBLAZE_USE_MULHI_INSTR
52+
prompt "Use mulhi for multiplication of higher bits"
53+
def_bool y
54+
depends on MICROBLAZE_USE_MUL_INSTR
55+
help
56+
Use multiply high instructions for high part of 32x32 multiply.
57+
This depends on CPU supporting hardware high multiplication instructions.
58+
xparameters would define this as USE_HW_MUL = 2.
59+
60+
config MICROBLAZE_USE_HARDWARE_FLOAT_INSTR
61+
def_bool n
62+
depends on CPU_HAS_FPU
63+
help
64+
This depends on CPU supporting hardware float instructions.
65+
xparameters would define this as USE_FPU = 1.
66+
67+
config MICROBLAZE_DATA_IS_TEXT_RELATIVE
68+
bool "Assume data & text segment distance is static"
69+
default y
70+
help
71+
Assume that the displacement between the text and data segments is fixed at
72+
static link time. This allows data to be referenced by offset from start of
73+
text address instead of GOT (r20) since PC-relative addressing is not supported.
74+
Injects -mpic-data-is-text-relative
75+
76+
endmenu

arch/microblaze/core/exception.S

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ _exception_handler_entry:
3939
mfs TEMP_DATA_REG, rmsr
4040
STORE_TO_STACK(TEMP_DATA_REG, ESF_OFFSET(msr))
4141

42-
#if defined(CONFIG_USE_HARDWARE_FLOAT_INSTR)
42+
#if defined(CONFIG_MICROBLAZE_USE_HARDWARE_FLOAT_INSTR)
4343
/* Stack FSR using TEMP_DATA_REG(temp1) */
4444
mfs TEMP_DATA_REG, rfsr
4545
STORE_TO_STACK(TEMP_DATA_REG, ESF_OFFSET(fsr))

arch/microblaze/core/fatal.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -65,7 +65,7 @@ FUNC_NORETURN void z_microblaze_fatal_error(unsigned int reason,
6565
printk("r31:\t0x%x\n", dump->esf.r31);
6666

6767
printk("MSR:\t0x%08x\t(exc)\n", dump->esf.msr);
68-
#if defined(CONFIG_USE_HARDWARE_FLOAT_INSTR)
68+
#if defined(CONFIG_MICROBLAZE_USE_HARDWARE_FLOAT_INSTR)
6969
printk("FSR:\t%08x\n", dump->esf.fsr);
7070
#endif
7171
printk("ESR:\t0x%08x\n", dump->esr);

arch/microblaze/core/isr.S

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -71,7 +71,7 @@ _interrupt_handler:
7171
mfs TEMP_DATA_REG, rmsr
7272
STORE_TO_STACK(TEMP_DATA_REG, ESF_OFFSET(msr))
7373

74-
#if defined(CONFIG_USE_HARDWARE_FLOAT_INSTR)
74+
#if defined(CONFIG_MICROBLAZE_USE_HARDWARE_FLOAT_INSTR)
7575
/* Stack FSR using TEMP_DATA_REG(temp1) */
7676
mfs TEMP_DATA_REG, rfsr
7777
STORE_TO_STACK(TEMP_DATA_REG, ESF_OFFSET(fsr))
@@ -211,7 +211,7 @@ _isr_restore_carry:
211211
mts rmsr, TEMP_DATA_REG
212212
/* END restore carry bit */
213213

214-
#if defined(CONFIG_USE_HARDWARE_FLOAT_INSTR)
214+
#if defined(CONFIG_MICROBLAZE_USE_HARDWARE_FLOAT_INSTR)
215215
/* Reload the FSR from the stack. */
216216
LOAD_FROM_STACK(TEMP_DATA_REG, ESF_OFFSET(fsr))
217217
mts rfsr, TEMP_DATA_REG

arch/microblaze/core/offsets/offsets.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,7 @@ GEN_OFFSET_SYM(z_arch_esf_t, r4);
4848
GEN_OFFSET_SYM(z_arch_esf_t, r3);
4949
GEN_OFFSET_SYM(z_arch_esf_t, r2);
5050
GEN_OFFSET_SYM(z_arch_esf_t, msr);
51-
#if defined(CONFIG_USE_HARDWARE_FLOAT_INSTR)
51+
#if defined(CONFIG_MICROBLAZE_USE_HARDWARE_FLOAT_INSTR)
5252
GEN_OFFSET_SYM(z_arch_esf_t, fsr);
5353
#endif
5454

arch/microblaze/core/swap.S

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -79,7 +79,7 @@ SECTION_FUNC(exception.other, arch_swap)
7979
mfs TEMP_DATA_REG, rmsr
8080
STORE_TO_STACK(TEMP_DATA_REG, ESF_OFFSET(msr))
8181

82-
#if defined(CONFIG_USE_HARDWARE_FLOAT_INSTR)
82+
#if defined(CONFIG_MICROBLAZE_USE_HARDWARE_FLOAT_INSTR)
8383
/* Stack FSR using TEMP_DATA_REG(temp1) */
8484
mfs TEMP_DATA_REG, rfsr
8585
STORE_TO_STACK(TEMP_DATA_REG, ESF_OFFSET(fsr))
@@ -178,7 +178,7 @@ _swap_restore_carry:
178178
mts rmsr, TEMP_DATA_REG
179179
/* END restore carry bit */
180180

181-
#if defined(CONFIG_USE_HARDWARE_FLOAT_INSTR)
181+
#if defined(CONFIG_MICROBLAZE_USE_HARDWARE_FLOAT_INSTR)
182182
/* Reload the FSR from the stack. */
183183
LOAD_FROM_STACK(TEMP_DATA_REG, ESF_OFFSET(fsr))
184184
mts rfsr, TEMP_DATA_REG

0 commit comments

Comments
 (0)