Adding Visionfive2 memory address for ROM_BASE in zephyr RTOS (Porting to ZephyrRTOS)

Hello!

I and pfarwsi are working on adding support for VisionFive 2 in Zephyr RTOS. I have created a device tree by referencing the StarFive Linux, patches of hifive_unmatched based on FU740 SoC in ZephyrRTOS and patches of BeagleV Starlight.

The porting work is done in this repo: GitHub - pfarwsi/zephyr-visionfive2 at visionfive2

I have created a devicetree for dts/riscv/starfive/jh7110-visionfive-v2.dtsi

The build errors out at Linking C executable step while building for samples/hello_world.

Build Instructions:

    $ git clone https://github.com/pfarwsi/zephyr-visionfive2.git -b visionfive2
    $ west build -p always -b visionfive2_jh7110 samples/hello_world/

Error log:

    [91/96] Linking C executable zephyr/zephyr_pre0.elf
    FAILED: zephyr/zephyr_pre0.elf zephyr/zephyr_pre0.map /home/kanak/zephyrproject/zephyr/build/zephyr/zephyr_pre0.map
    : && ccache /home/kanak/zephyr-sdk-0.16.3/riscv64-zephyr-elf/bin/riscv64-zephyr-elf-gcc  -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  -fuse-ld=bfd  -T  zephyr/linker_zephyr_pre0.cmd  -Wl,-Map=/home/kanak/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/serial/libdrivers__serial.a  zephyr/drivers/timer/libdrivers__timer.a  -Wl,--no-whole-archive  zephyr/kernel/libkernel.a  -L"/home/kanak/zephyr-sdk-0.16.3/riscv64-zephyr-elf/bin/../lib/gcc/riscv64-zephyr-elf/12.2.0/rv64imac_zicsr_zifencei/lp64/medany"  -L/home/kanak/zephyrproject/zephyr/build/zephyr  -lgcc  zephyr/arch/common/libisr_tables.a  -mcmodel=medany  -mabi=lp64  -march=rv64imac_zicsr_zifencei  -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  -DPICOLIBC_LONG_LONG_PRINTF_SCANF  --specs=picolibc.specs  -lc  -lgcc && cd /home/kanak/zephyrproject/zephyr/build/zephyr && /usr/bin/cmake -E true
    /home/kanak/zephyr-sdk-0.16.3/riscv64-zephyr-elf/bin/../lib/gcc/riscv64-zephyr-elf/12.2.0/../../../../riscv64-zephyr-elf/bin/ld.bfd: invalid origin for memory region ROM
    /home/kanak/zephyr-sdk-0.16.3/riscv64-zephyr-elf/bin/../lib/gcc/riscv64-zephyr-elf/12.2.0/../../../../riscv64-zephyr-elf/bin/ld.bfd: invalid length for memory region ROM
    /home/kanak/zephyr-sdk-0.16.3/riscv64-zephyr-elf/bin/../lib/gcc/riscv64-zephyr-elf/12.2.0/../../../../riscv64-zephyr-elf/bin/ld.bfd:zephyr/linker_zephyr_pre0.cmd:44: undefined symbol 'ROM_BASE' referenced in expression
    collect2: error: ld returned 1 exit status
    ninja: build stopped: subcommand failed.
    FATAL ERROR: command exited with status 1: /usr/bin/cmake --build /home/kanak/zephyrproject/zephyr/build

It gives error of undefined symbol for ROM_BASE.
Full build log: https://pastebin.com/JHLZrx66

Where is the memory addresses for the boards defined in Zephyr RTOS? How can I solve the ROM_BASE issue?

Thanks!