Build problems after changing to Linux: zephyr/zephyr_pre0.elf section `text' will not fit in region `FLASH'

Hello,

I have recently changed my development platform from a Windows 10 PC to another PC running Ubuntu. I am using the v2.5.0 SDK version on both platforms and the nrf52840dk as build target.

I try to compile my project based on the Matter Light Bulb sample, to which I have added some SPI functionality, however I receive the following error and the build fails.

Since I was able to compile and flash on the Windows PC I don't believe it is actually a size conflict, but maybe has something to do with file locations?
The way I transferred my project was by compiling the unmodified sample on the Ubuntu device and then replacing all the Files I have modified.

I am not sure how to go about fixing this, any help is appreciated.

[145/340] Linking C static library modules/nrf/subsys/nfc/ndef/lib..__nrf__subsys__nfc__ndef.a
[146/340] Building C object modules/nrf/subsys/nfc/lib/CMakeFiles/..__nrf__subsys__nfc__lib.dir/platform_internal_irq.c.obj
[147/340] Linking C static library modules/nrf/drivers/mpsl/clock_control/lib..__nrf__drivers__mpsl__clock_control.a
[147/340] Performing build step for 'mcuboot_subimage'
[1/6] Linking C executable zephyr/zephyr_pre0.elf
FAILED: zephyr/zephyr_pre0.elf zephyr/zephyr_pre0.map 
: && ccache /home/install/ncs/toolchains/1f9b40e71a/opt/zephyr-sdk/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  -fuse-ld=bfd  -T  zephyr/linker_zephyr_pre0.cmd  -Wl,-Map=/home/install/nrf_apps/spi_light_bulb/build/mcuboot/zephyr/zephyr_pre0.map  -Wl,--whole-archive  app/libapp.a  zephyr/libzephyr.a  zephyr/arch/common/libarch__common.a  zephyr/arch/arch/arm/core/aarch32/libarch__arm__core__aarch32.a  zephyr/arch/arch/arm/core/aarch32/cortex_m/libarch__arm__core__aarch32__cortex_m.a  zephyr/arch/arch/arm/core/aarch32/mpu/libarch__arm__core__aarch32__mpu.a  zephyr/lib/libc/picolibc/liblib__libc__picolibc.a  zephyr/lib/libc/common/liblib__libc__common.a  zephyr/soc/soc/arm/common/cortex_m/libsoc__arm__common__cortex_m.a  zephyr/soc/soc/arm/nordic_nrf/nrf52/libsoc__arm__nordic_nrf__nrf52.a  zephyr/drivers/clock_control/libdrivers__clock_control.a  zephyr/drivers/flash/libdrivers__flash.a  zephyr/drivers/pinctrl/libdrivers__pinctrl.a  zephyr/drivers/timer/libdrivers__timer.a  modules/nrf/lib/fprotect/lib..__nrf__lib__fprotect.a  modules/nrf/drivers/hw_cc310/lib..__nrf__drivers__hw_cc310.a  modules/mcuboot/boot/bootutil/zephyr/libmcuboot_util.a  modules/hal_nordic/nrfx/libmodules__hal_nordic__nrfx.a  -Wl,--no-whole-archive  zephyr/kernel/libkernel.a  zephyr/CMakeFiles/offsets.dir/./arch/arm/core/offsets/offsets.c.obj  -L"/home/install/ncs/toolchains/1f9b40e71a/opt/zephyr-sdk/arm-zephyr-eabi/bin/../lib/gcc/arm-zephyr-eabi/12.2.0/thumb/v7e-m+fp/hard"  -L/home/install/nrf_apps/spi_light_bulb/build/mcuboot/zephyr  -lgcc  zephyr/arch/common/libisr_tables.a  -mcpu=cortex-m4  -mthumb  -mabi=aapcs  -mfpu=fpv4-sp-d16  -mfloat-abi=hard  -mfp16-format=ieee  -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_DOUBLE_PRINTF_SCANF  /home/install/ncs/v2.5.0/nrfxlib/crypto/nrf_cc310_platform/lib/cortex-m4/hard-float/no-interrupts/libnrf_cc310_platform_0.9.18.a  --specs=picolibc.specs  -lc  -lgcc  /home/install/ncs/v2.5.0/nrfxlib/crypto/nrf_cc310_bl/lib/cortex-m4/hard-float/no-interrupts/libnrf_cc310_bl_0.9.12.a && cd /home/install/nrf_apps/spi_light_bulb/build/mcuboot/zephyr && /home/install/ncs/toolchains/1f9b40e71a/usr/local/bin/cmake -E true
/home/install/ncs/toolchains/1f9b40e71a/opt/zephyr-sdk/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/install/ncs/toolchains/1f9b40e71a/opt/zephyr-sdk/arm-zephyr-eabi/bin/../lib/gcc/arm-zephyr-eabi/12.2.0/../../../../arm-zephyr-eabi/bin/ld.bfd: region `FLASH' overflowed by 7102 bytes
collect2: error: ld returned 1 exit status
ninja: build stopped: subcommand failed.
[198/340] Building C object modules/nrfxlib/nrf_802154/nrf_802154/driver/CMakeFiles/nrf-802154-driver.dir/src/nrf_802154_debug.c.obj
FAILED: modules/mcuboot/mcuboot_subimage-prefix/src/mcuboot_subimage-stamp/mcuboot_subimage-build mcuboot/zephyr/zephyr.hex mcuboot/zephyr/zephyr.elf 
cd /home/install/nrf_apps/spi_light_bulb/build/mcuboot && /home/install/ncs/toolchains/1f9b40e71a/usr/local/bin/cmake --build . --
[200/340] Building C object modules/nrfxlib/nrf_802154/nrf_802154/driver/CMakeFiles/nrf-802154-driver.dir/src/nrf_802154_debug_assert.c.obj
[201/340] Building C object modules/nrfxlib/nrf_802154/nrf_802154/driver/CMakeFiles/nrf-802154-driver.dir/src/nrf_802154_peripherals_alloc.c.obj
[202/340] Building C object modules/nrfxlib/nrf_802154/nrf_802154/driver/CMakeFiles/nrf-802154-driver.dir/src/nrf_802154_encrypt.c.obj
[203/340] Building C object modules/nrfxlib/nrf_802154/nrf_802154/driver/CMakeFiles/nrf-802154-driver.dir/src/nrf_802154_pib.c.obj
[204/340] Building C object modules/nrfxlib/nrf_802154/nrf_802154/driver/CMakeFiles/nrf-802154-driver.dir/src/nrf_802154_tx_work_buffer.c.obj
ninja: build stopped: subcommand failed.
FATAL ERROR: command exited with status 1: /home/install/ncs/toolchains/1f9b40e71a/usr/local/bin/cmake --build /home/install/nrf_apps/spi_light_bulb/build

 *  The terminal process terminated with exit code: 1. 
 *  Terminal will be reused by tasks, press any key to close it. 

Related