Open akifejaz opened 1 day ago
Hi,
I can't seem to reproduce the exact error you've attached using the instructions you've provided, but
Is there no MMU Support for RISCV arch
That's correct, Zepyr's RISC-V port, as of date, doesn't support MMU.
If you try to build Zephyr for RISC-V with MMU support enabled, you should see a warning message about unsatisfied Kconfig dependencies:
% west build -p always -b qemu_riscv64 samples/hello_world -- -DCONFIG_MMU=y
[...]
warning: MMU (defined at kernel/Kconfig.vm:101) was assigned the value 'y' but got the value 'n'.
Check these unsatisfied dependencies: CPU_HAS_MMU (=n). See
http://docs.zephyrproject.org/latest/kconfig.html#CONFIG_MMU and/or look up MMU in the
menuconfig/guiconfig interface. The Application Development Primer, Setting Configuration Values,
and Kconfig - Tips and Best Practices sections of the manual might be helpful too.
I can't seem to reproduce the exact error you've attached using the instructions you've provided, but
Hi @fkokosinski Thanks for response, yeah I forgot to mention I also enabled an internal flag CPU_HAS_MMU
from arch/Kconfig
Changes:
diff --git a/samples/hello_world/prj.conf b/samples/hello_world/prj.conf
index b2a4ba59104..3dec296304f 100644
--- a/samples/hello_world/prj.conf
+++ b/samples/hello_world/prj.conf
@@ -1 +1 @@
-# nothing here
+CONFIG_MMU=y
t_aejaz@ip<>:~/Zephyr/zephyrproject/zephyr$ git diff arch/Kconfig
diff --git a/arch/Kconfig b/arch/Kconfig
index 355a6247af3..7bb338d7763 100644
--- a/arch/Kconfig
+++ b/arch/Kconfig
@@ -783,6 +783,7 @@ config CPU_HAS_MPU
config CPU_HAS_MMU
bool
+ default y
help
This hidden option is selected when the CPU has a Memory Management Unit
(MMU).
Full Build Logs:
t_aejaz@ip-172-32-3-31:~/Zephyr/zephyrproject/zephyr$ west build -p always -b qemu_riscv64 samples/hello_world
-- west build: making build dir /home/t_aejaz/Zephyr/zephyrproject/zephyr/build pristine
-- west build: generating a build system
ZEPHYR_BASE is set to: /home/t_aejaz/Zephyr/zephyrproject/zephyr
Loading Zephyr default modules (Zephyr base).
-- Application: /home/t_aejaz/Zephyr/zephyrproject/zephyr/samples/hello_world
-- CMake version: 3.30.2
-- Found Python3: /home/t_aejaz/Zephyr/zephyrproject/.venv/bin/python3 (found suitable version "3.10.12", minimum required is "3.10") found components: Interpre
ter
-- Cache files will be written to: /home/t_aejaz/.cache/zephyr
-- Zephyr version: 4.0.0-rc1 (/home/t_aejaz/Zephyr/zephyrproject/zephyr)
-- Found west (found suitable version "1.3.0", minimum required is "0.14.0")
-- Board: qemu_riscv64, qualifiers: qemu_virt_riscv64
-- ZEPHYR_TOOLCHAIN_VARIANT not set, trying to locate Zephyr SDK
-- Found host-tools: zephyr 0.16.8 (/home/t_aejaz/Zephyr/zephyr-sdk-0.16.8)
-- Found toolchain: zephyr 0.16.8 (/home/t_aejaz/Zephyr/zephyr-sdk-0.16.8)
-- Found Dtc: /home/t_aejaz/Zephyr/zephyr-sdk-0.16.8/sysroots/x86_64-pokysdk-linux/usr/bin/dtc (found suitable version "1.6.0", minimum required is "1.4.6")
-- Found BOARD.dts: /home/t_aejaz/Zephyr/zephyrproject/zephyr/boards/qemu/riscv64/qemu_riscv64.dts
-- Generated zephyr.dts: /home/t_aejaz/Zephyr/zephyrproject/zephyr/build/zephyr/zephyr.dts
-- Generated pickled edt: /home/t_aejaz/Zephyr/zephyrproject/zephyr/build/zephyr/edt.pickle
-- Generated zephyr.dts: /home/t_aejaz/Zephyr/zephyrproject/zephyr/build/zephyr/zephyr.dts
-- Generated devicetree_generated.h: /home/t_aejaz/Zephyr/zephyrproject/zephyr/build/zephyr/include/generated/zephyr/devicetree_generated.h
-- Including generated dts.cmake file: /home/t_aejaz/Zephyr/zephyrproject/zephyr/build/zephyr/dts.cmake
Parsing /home/t_aejaz/Zephyr/zephyrproject/zephyr/Kconfig
Loaded configuration '/home/t_aejaz/Zephyr/zephyrproject/zephyr/boards/qemu/riscv64/qemu_riscv64_defconfig'
Merged configuration '/home/t_aejaz/Zephyr/zephyrproject/zephyr/samples/hello_world/prj.conf'
Configuration saved to '/home/t_aejaz/Zephyr/zephyrproject/zephyr/build/zephyr/.config'
Kconfig header saved to '/home/t_aejaz/Zephyr/zephyrproject/zephyr/build/zephyr/include/generated/zephyr/autoconf.h'
-- Found GnuLd: /home/t_aejaz/Zephyr/zephyr-sdk-0.16.8/riscv64-zephyr-elf/riscv64-zephyr-elf/bin/ld.bfd (found version "2.38")
-- The C compiler identification is GNU 12.2.0
-- The CXX compiler identification is GNU 12.2.0
-- The ASM compiler identification is GNU
-- Found assembler: /home/t_aejaz/Zephyr/zephyr-sdk-0.16.8/riscv64-zephyr-elf/bin/riscv64-zephyr-elf-gcc
Zephyr package found at: /home/t_aejaz/Zephyr/zephyrproject/zephyr/share/zephyr-package/cmake
-- Configuring done (6.5s)
-- Generating done (0.1s)
-- Build files have been written to: /home/t_aejaz/Zephyr/zephyrproject/zephyr/build
-- west build: building application
[1/103] Preparing syscall dependency handling
[2/103] Generating include/generated/zephyr/version.h
-- Zephyr version: 4.0.0-rc1 (/home/t_aejaz/Zephyr/zephyrproject/zephyr), build: v4.0.0-rc1-10-gafce5329f772
[98/103] Linking C executable zephyr/zephyr_pre0.elf
FAILED: zephyr/zephyr_pre0.elf zephyr/zephyr_pre0.map /home/t_aejaz/Zephyr/zephyrproject/zephyr/build/zephyr/zephyr_pre0.map
: && ccache /home/t_aejaz/Zephyr/zephyr-sdk-0.16.8/riscv64-zephyr-elf/bin/riscv64-zephyr-elf-gcc -gdwarf-4 -gdwarf-4 zephyr/CMakeFiles/zephyr_pre0.dir/misc/empty_file.c.obj -o zephyr/zephyr_pre0.elf zephyr/CMakeFiles/offsets.dir/./arch/riscv/core/offsets/offsets.c.obj -T zephyr/linker_zephyr_pre0.cmd -Wl,-Map=/home/t_aejaz/Zephyr/zephyrproject/zephyr/build/zephyr/zephyr_pre0.map -Wl,--whole-archive app/libapp.a zephyr/libzephyr.a zephyr/arch/common/libarch__common.a zephyr/arch/arch/riscv/core/libarch__riscv__core.a zephyr/lib/libc/picolibc/liblib__libc__picolibc.a zephyr/lib/libc/common/liblib__libc__common.a zephyr/drivers/interrupt_controller/libdrivers__interrupt_controller.a zephyr/drivers/console/libdrivers__console.a zephyr/drivers/serial/libdrivers__serial.a zephyr/drivers/timer/libdrivers__timer.a -Wl,--no-whole-archive zephyr/kernel/libkernel.a -L/home/t_aejaz/Zephyr/zephyrproject/zephyr/build/zephyr zephyr/arch/common/libisr_tables.a -mcmodel=medany -mabi=lp64 -march=rv64imac_zicsr_zifencei -fuse-ld=bfd -Wl,--gc-sections -Wl,--build-id=none -Wl,--sort-common=descending -Wl,--sort-section=alignment -Wl,-u,_OffsetAbsSyms -Wl,-u,_ConfigAbsSyms -nostdlib -static -Wl,-X -Wl,-N -Wl,--orphan-handling=warn -Wl,-no-pie -specs=picolibc.specs -DPICOLIBC_LONG_LONG_PRINTF_SCANF -L"/home/t_aejaz/Zephyr/zephyr-sdk-0.16.8/riscv64-zephyr-elf/bin/../lib/gcc/riscv64-zephyr-elf/12.2.0/rv64imac_zicsr_zifencei/lp64/medany" -lc -lgcc && cd /home/t_aejaz/Zephyr/zephyrproject/zephyr/build/zephyr && /usr/bin/cmake -E true
/home/t_aejaz/Zephyr/zephyr-sdk-0.16.8/riscv64-zephyr-elf/bin/../lib/gcc/riscv64-zephyr-elf/12.2.0/../../../../riscv64-zephyr-elf/bin/ld.bfd: zephyr/kernel/libkernel.a(mmu.c.obj): in function `k_mem_map_phys_bare':
/home/t_aejaz/Zephyr/zephyrproject/zephyr/kernel/mmu.c:976: undefined reference to `arch_mem_map'
/home/t_aejaz/Zephyr/zephyr-sdk-0.16.8/riscv64-zephyr-elf/bin/../lib/gcc/riscv64-zephyr-elf/12.2.0/../../../../riscv64-zephyr-elf/bin/ld.bfd: zephyr/kernel/libkernel.a(mmu.c.obj): in function `z_mem_manage_init':
/home/t_aejaz/Zephyr/zephyrproject/zephyr/kernel/mmu.c:1103: undefined reference to `z_mapped_start'
collect2: error: ld returned 1 exit status
ninja: build stopped: subcommand failed.
FATAL ERROR: command exited with status 1: /usr/bin/cmake --build /home/t_aejaz/Zephyr/zephyrproject/zephyr/build
Describe the bug
I've tried to enable CONFIG_MMU for my qemu_riscv64 board, but build fails giving some linker stage error related to undefine
z_mapped_start
&arch_mem_map
symbols.west build -p always -b qemu_riscv64 samples/hello_world
To Reproduce
Steps to reproduce the behavior:
CONFIG_MMU=y
in prj.confIs there no MMU Support for RISCV arch till now? Because I find out this article it doesn't mention about MMU (memory management Unit) related anything ?? https://docs.zephyrproject.org/latest/hardware/arch/risc-v.html
Please help me in this regard, like if its enabled is there anything else I've to configured. Best, Akif