zephyrproject-rtos / zephyr

Primary Git Repository for the Zephyr Project. Zephyr is a new generation, scalable, optimized, secure RTOS for multiple hardware architectures.
https://docs.zephyrproject.org
Apache License 2.0
10.86k stars 6.62k forks source link

After enabling CONFIG_SHELL=y And CONFIG_SHELL_BACKEND_RPMSG=y in prj.conf, I get the Flash overflow error #73287

Closed neuberfran closed 5 months ago

neuberfran commented 5 months ago

Hi,

I stay trying this: https://github.com/zephyrproject-rtos/zephyr/tree/main/samples/subsys/ipc/openamp_rsc_table in my imx7d-pico (m4 side, board in zephyr = pico_pi_m4)

https://github.com/zephyrproject-rtos/zephyr/issues/69433#issuecomment-2016598955 https://www.youtube.com/watch?v=V06RC2G_3M8

I'm migrating from Version 3.4 of Zephyr to 3.6.99 so I can access /dev/ttyRPMSG via Linux/Yocto through minicom -D /dev/ttyRPMSG0. Unsuccessful because I need to implement CONFIG_SHELL=y And CONFIG_SHELL_BACKEND_RPMSG=y (Note: Without these two options above, I have no errors, but of course, I don`t have shell)

When I enable these options in my prj.conf I get the following error:

neuberfran@neuberfran2204:~/zephyrproject/zephyr$ west build --sysbuild -b pico_pi_m4 samples/subsys/ipc/openamp_rsc_table
-- west build: generating a build system
Loading Zephyr module(s) (Zephyr base): extensions sysbuild_extensions python west root zephyr_module boards shields hwm_v2 sysbuild_kconfig native_simulator_sb_extensions
-- Found Python3: /usr/bin/python3 (found suitable version "3.10.12", minimum required is "3.8") found components: Interpreter 
-- Cache files will be written to: /home/neuberfran/.cache/zephyr
-- Found west (found suitable version "1.2.0", minimum required is "0.14.0")

-- Board: pico_pi, qualifiers: mcimx7d/m4
Parsing /home/neuberfran/zephyrproject/zephyr/share/sysbuild/Kconfig
Loaded configuration '/home/neuberfran/zephyrproject/zephyr/build/empty.conf'
Merged configuration '/home/neuberfran/zephyrproject/zephyr/build/empty.conf'
Merged configuration '/home/neuberfran/zephyrproject/zephyr/build/empty.conf'
Configuration saved to '/home/neuberfran/zephyrproject/zephyr/build/zephyr/.config'
Kconfig header saved to '/home/neuberfran/zephyrproject/zephyr/build/autoconf.h'
-- 
   ***************************************
   * Running CMake for openamp_rsc_table *
   ***************************************

Loading Zephyr default modules (Zephyr base).
-- Application: /home/neuberfran/zephyrproject/zephyr/samples/subsys/ipc/openamp_rsc_table
-- CMake version: 3.22.1
-- Found Python3: /usr/bin/python (found suitable version "3.10.12", minimum required is "3.8") found components: Interpreter 
-- Cache files will be written to: /home/neuberfran/.cache/zephyr
-- Zephyr version: 3.6.99 (/home/neuberfran/zephyrproject/zephyr)
-- Found west (found suitable version "1.2.0", minimum required is "0.14.0")
-- Board: pico_pi, qualifiers: mcimx7d/m4
-- ZEPHYR_TOOLCHAIN_VARIANT not set, trying to locate Zephyr SDK
-- Found host-tools: zephyr 0.16.5 (/home/neuberfran/zephyr-sdk-0.16.5-1)
-- Found toolchain: zephyr 0.16.5 (/home/neuberfran/zephyr-sdk-0.16.5-1)
-- Found Dtc: /home/neuberfran/zephyr-sdk-0.16.5-1/sysroots/x86_64-pokysdk-linux/usr/bin/dtc (found suitable version "1.6.0", minimum required is "1.4.6") 
-- Found BOARD.dts: /home/neuberfran/zephyrproject/zephyr/boards/technexion/pico_pi/pico_pi_mcimx7d_m4.dts
-- Found devicetree overlay: /home/neuberfran/zephyrproject/zephyr/samples/subsys/ipc/openamp_rsc_table/boards/pico_pi_m4.overlay
'label' is marked as deprecated in 'properties:' in /home/neuberfran/zephyrproject/zephyr/dts/bindings/ipm/nxp,imx-mu.yaml for node /soc/mu@30ab0000.
-- Generated zephyr.dts: /home/neuberfran/zephyrproject/zephyr/build/openamp_rsc_table/zephyr/zephyr.dts
-- Generated devicetree_generated.h: /home/neuberfran/zephyrproject/zephyr/build/openamp_rsc_table/zephyr/include/generated/devicetree_generated.h
-- Including generated dts.cmake file: /home/neuberfran/zephyrproject/zephyr/build/openamp_rsc_table/zephyr/dts.cmake

warning: OPENAMP_WITH_DCACHE (defined at modules/Kconfig.open-amp:35) was assigned the value 'y' but
got the value 'n'. Check these unsatisfied dependencies: CACHE_MANAGEMENT (=n). See
http://docs.zephyrproject.org/latest/kconfig.html#CONFIG_OPENAMP_WITH_DCACHE and/or look up
OPENAMP_WITH_DCACHE 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.

warning: PRINTK (defined at subsys/debug/Kconfig:204) was assigned the value 'n' but got the value
'y'. See http://docs.zephyrproject.org/latest/kconfig.html#CONFIG_PRINTK and/or look up PRINTK 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.

warning: LOG_PRINTK (defined at subsys/logging/Kconfig.processing:8) was assigned the value 'y' but
got the value 'n'. Check these unsatisfied dependencies: LOG (=n). See
http://docs.zephyrproject.org/latest/kconfig.html#CONFIG_LOG_PRINTK and/or look up LOG_PRINTK 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.

Parsing /home/neuberfran/zephyrproject/zephyr/Kconfig
Loaded configuration '/home/neuberfran/zephyrproject/zephyr/boards/technexion/pico_pi/pico_pi_mcimx7d_m4_defconfig'
Merged configuration '/home/neuberfran/zephyrproject/zephyr/samples/subsys/ipc/openamp_rsc_table/prj.conf'
Merged configuration '/home/neuberfran/zephyrproject/zephyr/samples/subsys/ipc/openamp_rsc_table/boards/pico_pi_m4.conf'
Merged configuration '/home/neuberfran/zephyrproject/zephyr/build/openamp_rsc_table/zephyr/.config.sysbuild'
Configuration saved to '/home/neuberfran/zephyrproject/zephyr/build/openamp_rsc_table/zephyr/.config'
Kconfig header saved to '/home/neuberfran/zephyrproject/zephyr/build/openamp_rsc_table/zephyr/include/generated/autoconf.h'
-- Found GnuLd: /home/neuberfran/zephyr-sdk-0.16.5-1/arm-zephyr-eabi/arm-zephyr-eabi/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/neuberfran/zephyr-sdk-0.16.5-1/arm-zephyr-eabi/bin/arm-zephyr-eabi-gcc
-- libmetal version: 1.5.0 (/home/neuberfran/zephyrproject/zephyr/samples/subsys/ipc/openamp_rsc_table)
-- Build type:  
-- Host:    Linux/x86_64
-- Target:  Generic/arm
-- Machine: arm
-- Looking for include file stdatomic.h
-- Looking for include file stdatomic.h - found
-- open-amp version: 1.5.0 (/home/neuberfran/zephyrproject/modules/lib/open-amp/open-amp)
-- Host:    Linux/x86_64
-- Target:  Generic/arm
-- Machine: arm
-- C_FLAGS :  -Wall -Wextra
-- Looking for include file fcntl.h
-- Looking for include file fcntl.h - found
-- Using ccache: /usr/bin/ccache
CMake Warning at /home/neuberfran/zephyrproject/zephyr/CMakeLists.txt:895 (message):
  No SOURCES given to Zephyr library: drivers__clock_control

  Excluding target from build.

-- Configuring done
-- Generating done
-- Build files have been written to: /home/neuberfran/zephyrproject/zephyr/build/openamp_rsc_table
-- Configuring done
-- Generating done
-- Build files have been written to: /home/neuberfran/zephyrproject/zephyr/build
-- west build: building application
[5/8] Performing build step for 'openamp_rsc_table'
[1/167] Preparing syscall dependency handling

[3/167] Generating include/generated/version.h
-- Zephyr version: 3.6.99 (/home/neuberfran/zephyrproject/zephyr), build: v3.6.0-4560-g11920e35a00e
[119/167] Building C object modules/open-amp/open-amp/lib/CMakeFiles/open_amp.dir/virtio/virtqueue.c.obj
In file included from /home/neuberfran/zephyrproject/zephyr/soc/nxp/imx/imx7d/./soc.h:18,
                 from /home/neuberfran/zephyrproject/zephyr/modules/cmsis/./cmsis_core_m.h:24,
                 from /home/neuberfran/zephyrproject/zephyr/modules/cmsis/./cmsis_core.h:10,
                 from /home/neuberfran/zephyrproject/zephyr/include/zephyr/arch/arm/asm_inline_gcc.h:24,
                 from /home/neuberfran/zephyrproject/zephyr/include/zephyr/arch/arm/asm_inline.h:18,
                 from /home/neuberfran/zephyrproject/zephyr/include/zephyr/arch/arm/arch.h:33,
                 from /home/neuberfran/zephyrproject/zephyr/include/zephyr/arch/cpu.h:19,
                 from /home/neuberfran/zephyrproject/zephyr/include/zephyr/kernel_includes.h:36,
                 from /home/neuberfran/zephyrproject/zephyr/include/zephyr/kernel.h:17,
                 from /home/neuberfran/zephyrproject/zephyr/build/openamp_rsc_table/modules/libmetal/libmetal/lib/include/metal/system/zephyr/alloc.h:19,
                 from /home/neuberfran/zephyrproject/zephyr/build/openamp_rsc_table/modules/libmetal/libmetal/lib/include/metal/alloc.h:15,
                 from /home/neuberfran/zephyrproject/modules/lib/open-amp/open-amp/lib/include/openamp/virtqueue.h:21,
                 from /home/neuberfran/zephyrproject/modules/lib/open-amp/open-amp/lib/include/openamp/virtio.h:10,
                 from /home/neuberfran/zephyrproject/modules/lib/open-amp/open-amp/lib/virtio/virtqueue.c:9:
/home/neuberfran/zephyrproject/modules/hal/nxp/imx/drivers/./ccm_imx7d.h: In function 'CCM_SetRootMux':

[162/167] Linking C executable zephyr/zephyr_pre0.elf
FAILED: zephyr/zephyr_pre0.elf zephyr/zephyr_pre0.map /home/neuberfran/zephyrproject/zephyr/build/openamp_rsc_table/zephyr/zephyr_pre0.map 
: && ccache /home/neuberfran/zephyr-sdk-0.16.5-1/arm-zephyr-eabi/bin/arm-zephyr-eabi-gcc  -gdwarf-4 zephyr/CMakeFiles/zephyr_pre0.dir/misc/empty_file.c.obj -o zephyr/zephyr_pre0.elf  zephyr/CMakeFiles/offsets.dir/./arch/arm/core/offsets/offsets.c.obj  -fuse-ld=bfd  -T  zephyr/linker_zephyr_pre0.cmd  -Wl,-Map=/home/neuberfran/zephyrproject/zephyr/build/openamp_rsc_table/zephyr/zephyr_pre0.map  -Wl,--whole-archive  app/libapp.a  zephyr/libzephyr.a  zephyr/arch/common/libarch__common.a  zephyr/arch/arch/arm/core/libarch__arm__core.a  zephyr/arch/arch/arm/core/cortex_m/libarch__arm__core__cortex_m.a  zephyr/lib/libc/picolibc/liblib__libc__picolibc.a  zephyr/lib/libc/common/liblib__libc__common.a  zephyr/lib/posix/options/liblib__posix__options.a  zephyr/drivers/console/libdrivers__console.a  zephyr/drivers/ipm/libdrivers__ipm.a  zephyr/drivers/pinctrl/libdrivers__pinctrl.a  zephyr/drivers/serial/libdrivers__serial.a  zephyr/drivers/timer/libdrivers__timer.a  modules/hal_nxp/hal_nxp/lib..__modules__hal__nxp.a  modules/libmetal/libmetal/lib/libmetal.a  modules/open-amp/open-amp/lib/libopen_amp.a  -Wl,--no-whole-archive  zephyr/kernel/libkernel.a  -L"/home/neuberfran/zephyr-sdk-0.16.5-1/arm-zephyr-eabi/bin/../lib/gcc/arm-zephyr-eabi/12.2.0/thumb/v7e-m/nofp"  -L/home/neuberfran/zephyrproject/zephyr/build/openamp_rsc_table/zephyr  -lgcc  zephyr/arch/common/libisr_tables.a  -mcpu=cortex-m4  -mthumb  -mabi=aapcs  -mfp16-format=ieee  -mtp=soft  -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/neuberfran/zephyrproject/zephyr/build/openamp_rsc_table/zephyr && /usr/bin/cmake -E true
/home/neuberfran/zephyr-sdk-0.16.5-1/arm-zephyr-eabi/bin/../lib/gcc/arm-zephyr-eabi/12.2.0/../../../../arm-zephyr-eabi/bin/ld.bfd: warning: orphan section `.resource_table' from `zephyr/libzephyr.a(resource_table.c.obj)' being placed in section `.resource_table'
/home/neuberfran/zephyr-sdk-0.16.5-1/arm-zephyr-eabi/bin/../lib/gcc/arm-zephyr-eabi/12.2.0/../../../../arm-zephyr-eabi/bin/ld.bfd: zephyr/zephyr_pre0.elf section `text' will not fit in region `FLASH'
/home/neuberfran/zephyr-sdk-0.16.5-1/arm-zephyr-eabi/bin/../lib/gcc/arm-zephyr-eabi/12.2.0/../../../../arm-zephyr-eabi/bin/ld.bfd: section datas VMA [0000000020000000,00000000200000fb] overlaps section text VMA [000000001fff8240,0000000020000e17]
/home/neuberfran/zephyr-sdk-0.16.5-1/arm-zephyr-eabi/bin/../lib/gcc/arm-zephyr-eabi/12.2.0/../../../../arm-zephyr-eabi/bin/ld.bfd: section .ARM.exidx VMA [0000000020000e18,0000000020000e1f] overlaps section bss VMA [0000000020000160,00000000200012ea]
/home/neuberfran/zephyr-sdk-0.16.5-1/arm-zephyr-eabi/bin/../lib/gcc/arm-zephyr-eabi/12.2.0/../../../../arm-zephyr-eabi/bin/ld.bfd: section noinit VMA [00000000200012f0,0000000020004a2f] overlaps section shell_root_cmds_area VMA [00000000200012e8,000000002000130f]
/home/neuberfran/zephyr-sdk-0.16.5-1/arm-zephyr-eabi/bin/../lib/gcc/arm-zephyr-eabi/12.2.0/../../../../arm-zephyr-eabi/bin/ld.bfd: section shell_subcmds_area VMA [0000000020001310,0000000020001323] overlaps section noinit VMA [00000000200012f0,0000000020004a2f]
/home/neuberfran/zephyr-sdk-0.16.5-1/arm-zephyr-eabi/bin/../lib/gcc/arm-zephyr-eabi/12.2.0/../../../../arm-zephyr-eabi/bin/ld.bfd: region `FLASH' overflowed by 11124 bytes
collect2: error: ld returned 1 exit status
ninja: build stopped: subcommand failed.
FAILED: images/openamp_rsc_table-prefix/src/openamp_rsc_table-stamp/openamp_rsc_table-build /home/neuberfran/zephyrproject/zephyr/build/images/openamp_rsc_table-prefix/src/openamp_rsc_table-stamp/openamp_rsc_table-build 
cd /home/neuberfran/zephyrproject/zephyr/build/openamp_rsc_table && /usr/bin/cmake --build .
ninja: build stopped: subcommand failed.
FATAL ERROR: command exited with status 1: /usr/bin/cmake --build /home/neuberfran/zephyrproject/zephyr/build

pico_pi_m4.overlay


CONFIG_LOG=y 
CONFIG_LOG_DEFAULT_LEVEL=0
CONFIG_LOG_MODE_MINIMAL=y
CONFIG_UART_CONSOLE=y
CONFIG_SERIAL=y
CONFIG_LOG_BACKEND_UART=y

CONFIG_UART_INTERRUPT_DRIVEN=y
CONFIG_CONSOLE=y
CONFIG_LOG_PRINTK=y
CONFIG_IPM_IMX_MAX_DATA_SIZE_16=n
CONFIG_IPM_IMX_MAX_DATA_SIZE_4=y

CONFIG_OPENAMP_WITH_DCACHE=y

prj.conf

CONFIG_KERNEL_BIN_NAME="zephyr_openamp_rsc_table"
CONFIG_PRINTK=n
CONFIG_IPM=y
CONFIG_MAIN_STACK_SIZE=1024
CONFIG_HEAP_MEM_POOL_SIZE=1024
CONFIG_OPENAMP=y
CONFIG_OPENAMP_RSC_TABLE_NUM_RPMSG_BUFF=32
CONFIG_OPENAMP_RSC_TABLE=y
CONFIG_OPENAMP_MASTER=n

CONFIG_SHELL=y
CONFIG_SHELL_BACKEND_RPMSG=y

How can I solve it (Pls)

pdgendt commented 5 months ago

Some questions:

CC @arnopo

neuberfran commented 5 months ago

@pdgendt https://discord.com/channels/720317445772017664/1243652018086613082

Why do you build for sysbuild? I still don't know, but I always used this tag

How do you load the firmware? https://www.youtube.com/watch?v=V06RC2G_3M8&t=35s

I load zephyr.bin in U-boot. After Linux starts I use the echo stop command (from remoteproc) to stop zephyr.bin and I use echo start to start zephyr.elf inside the Linux UserSpace

Where is your "flash" located?

part of the file pico_pi_m4.dts

chosen {
        zephyr,flash = &ocram_code;
               //zephyr,flash = &tcml_code;
            // &ocram_code; 
        // &tcml_code;
        zephyr,sram = &tcmu_sys;
        zephyr,console = &uart6;
        zephyr,shell-uart = &uart6;
    };
};
chosen {
        zephyr,flash = &ocram_code;
               //zephyr,flash = &tcml_code;
        // &ocram_code; 
        // &tcml_code;
        zephyr,sram = &ocram_sys;
//      zephyr,sram = &tcmu_sys;
        zephyr,console = &uart6;
        zephyr,shell-uart = &uart6;
    };
};

` part of the file nxp_imx7d_m4.dtsi

soc {

        ddr_code: code@10000000 {
            compatible = "nxp,imx-code-bus";
            reg = <0x10000000 0xfff0000>;
        };

        ddr_sys: memory@80000000 {
            device_type = "memory";
            compatible = "nxp,imx-sys-bus";
            reg = <0x80000000 0x60000000>;
        };

        tcml_code: code@1fff8000 {
            compatible = "nxp,imx-itcm";
            reg = <0x1fff8000 DT_SIZE_K(32)>;
        };

        tcmu_sys: memory@20000000 {
            compatible = "nxp,imx-dtcm";
            reg = <0x20000000 DT_SIZE_K(32)>;
        };

        ocram_code: code@900000 {
            compatible = "nxp,imx-code-bus";
            reg = <0x00900000 DT_SIZE_K(128)>;
        };

        ocram_sys: memory@20200000 {
            device_type = "memory";
            compatible = "nxp,imx-sys-bus";
            reg = <0x20200000 DT_SIZE_K(128)>;
        };

When I change zephyr,flash = &tcml_code; to zephyr,flash = &ocram_code; And zephyr,sram = &tcmu_sys; to zephyr,sram = &ocram_sys; And west build -b pico_pi_m4 samples/subsys/ipc/openamp_rsc_table (wwithout --sysbuild) I'm still getting the error: zephyr/zephyr_pre0.elf section text' will not fit in regionFLASH'

aescolar commented 5 months ago

Converting to a discussion as this is not a bug