renesas / fsp

Flexible Software Package (FSP) for Renesas RA MCU Family
https://renesas.github.io/fsp/
Other
192 stars 82 forks source link

[CMake Build] Problem when linking: "cannot open linker script file script/fsp.ld: No such file or directory" #359

Open popsUlfr opened 3 months ago

popsUlfr commented 3 months ago

Hello again,

after applying the workaround described in #357 concerning the include paths, I get an issue on the linking phase:

[1/2  50% :: 0.008] Linking C executable VEBO_RA4T1.elf
FAILED: VEBO_RA4T1.elf 
: && /home/popsulfr/renesas/ra/e2studio_v2024-04_fsp_v5.3.0/toolchains/gcc_arm/arm-gnu-toolchain-13.2.Rel1-x86_64-arm-none-eabi/bin/arm-none-eabi-gcc -g -mfloat-abi=hard -mcpu=cortex-m33 -mfpu=fpv5-sp-d16 -Wunused -Wuninitialized -Wall -Wextra -Wmissing-declarations -Wconversion -Wpointer-arith -Wshadow -Wlogical-op -Waggregate-return -Wfloat-equal -fmessage-length=0 -fsigned-char -ffunction-sections -fdata-sections -mthumb -T script/fsp.ld -Wl,--gc-sections -Wl,-Map,VEBO_RA4T1.map --specs=nano.specs -o /home/popsulfr/work/vebo/ra4t1-firmware/build/Debug/VEBO_RA4T1.elf CMakeFiles/VEBO_RA4T1.elf.dir/ra/fsp/src/bsp/cmsis/Device/RENESAS/Source/startup.c.obj CMakeFiles/VEBO_RA4T1.elf.dir/ra/fsp/src/bsp/cmsis/Device/RENESAS/Source/system.c.obj CMakeFiles/VEBO_RA4T1.elf.dir/ra/fsp/src/bsp/mcu/all/bsp_clocks.c.obj CMakeFiles/VEBO_RA4T1.elf.dir/ra/fsp/src/bsp/mcu/all/bsp_common.c.obj CMakeFiles/VEBO_RA4T1.elf.dir/ra/fsp/src/bsp/mcu/all/bsp_delay.c.obj CMakeFiles/VEBO_RA4T1.elf.dir/ra/fsp/src/bsp/mcu/all/bsp_group_irq.c.obj CMakeFiles/VEBO_RA4T1.elf.dir/ra/fsp/src/bsp/mcu/all/bsp_guard.c.obj CMakeFiles/VEBO_RA4T1.elf.dir/ra/fsp/src/bsp/mcu/all/bsp_io.c.obj CMakeFiles/VEBO_RA4T1.elf.dir/ra/fsp/src/bsp/mcu/all/bsp_irq.c.obj CMakeFiles/VEBO_RA4T1.elf.dir/ra/fsp/src/bsp/mcu/all/bsp_macl.c.obj CMakeFiles/VEBO_RA4T1.elf.dir/ra/fsp/src/bsp/mcu/all/bsp_register_protection.c.obj CMakeFiles/VEBO_RA4T1.elf.dir/ra/fsp/src/bsp/mcu/all/bsp_rom_registers.c.obj CMakeFiles/VEBO_RA4T1.elf.dir/ra/fsp/src/bsp/mcu/all/bsp_sbrk.c.obj CMakeFiles/VEBO_RA4T1.elf.dir/ra/fsp/src/bsp/mcu/all/bsp_security.c.obj CMakeFiles/VEBO_RA4T1.elf.dir/ra/fsp/src/r_adc/r_adc.c.obj CMakeFiles/VEBO_RA4T1.elf.dir/ra/fsp/src/r_agt/r_agt.c.obj CMakeFiles/VEBO_RA4T1.elf.dir/ra/fsp/src/r_elc/r_elc.c.obj CMakeFiles/VEBO_RA4T1.elf.dir/ra/fsp/src/r_gpt/r_gpt.c.obj CMakeFiles/VEBO_RA4T1.elf.dir/ra/fsp/src/r_gpt_three_phase/r_gpt_three_phase.c.obj CMakeFiles/VEBO_RA4T1.elf.dir/ra/fsp/src/r_ioport/r_ioport.c.obj CMakeFiles/VEBO_RA4T1.elf.dir/ra/fsp/src/r_poeg/r_poeg.c.obj CMakeFiles/VEBO_RA4T1.elf.dir/ra/fsp/src/r_sci_uart/r_sci_uart.c.obj CMakeFiles/VEBO_RA4T1.elf.dir/ra/fsp/src/rm_motor_current/rm_motor_current.c.obj CMakeFiles/VEBO_RA4T1.elf.dir/ra/fsp/src/rm_motor_driver/rm_motor_driver.c.obj CMakeFiles/VEBO_RA4T1.elf.dir/ra/fsp/src/rm_motor_hall/rm_motor_hall.c.obj CMakeFiles/VEBO_RA4T1.elf.dir/ra/fsp/src/rm_motor_sense_hall/rm_motor_sense_hall.c.obj CMakeFiles/VEBO_RA4T1.elf.dir/ra/fsp/src/rm_motor_speed/rm_motor_speed.c.obj CMakeFiles/VEBO_RA4T1.elf.dir/ra_gen/common_data.c.obj CMakeFiles/VEBO_RA4T1.elf.dir/ra_gen/elc_data.c.obj CMakeFiles/VEBO_RA4T1.elf.dir/ra_gen/hal_data.c.obj CMakeFiles/VEBO_RA4T1.elf.dir/ra_gen/main.c.obj CMakeFiles/VEBO_RA4T1.elf.dir/ra_gen/pin_data.c.obj CMakeFiles/VEBO_RA4T1.elf.dir/ra_gen/vector_data.c.obj CMakeFiles/VEBO_RA4T1.elf.dir/src/driver/timer.c.obj CMakeFiles/VEBO_RA4T1.elf.dir/src/hal_entry.c.obj CMakeFiles/VEBO_RA4T1.elf.dir/src/hci/hci.c.obj CMakeFiles/VEBO_RA4T1.elf.dir/src/motor/motor.c.obj -o VEBO_RA4T1.elf -L/home/popsulfr/work/vebo/ra4t1-firmware/ra/fsp/lib/rm_motor_current/cm33_gcc   -L/home/popsulfr/work/vebo/ra4t1-firmware/ra/fsp/lib/rm_motor_speed/cm33_gcc -lrm_motor_current  -lrm_motor_speed && cd /home/popsulfr/work/vebo/ra4t1-firmware/build/Debug && echo Running RASC post-build to generate Smart Bundle "(" .sbd ")" file && /home/popsulfr/renesas/ra/sc_v2024-04_fsp_v5.3.0/eclipse/rasc -nosplash --launcher.suppressErrors --gensmartbundle --devicefamily ra --compiler GCC /home/popsulfr/work/vebo/ra4t1-firmware/configuration.xml /home/popsulfr/work/vebo/ra4t1-firmware/build/Debug/VEBO_RA4T1.elf
/home/popsulfr/renesas/ra/e2studio_v2024-04_fsp_v5.3.0/toolchains/gcc_arm/arm-gnu-toolchain-13.2.Rel1-x86_64-arm-none-eabi/bin/../lib/gcc/arm-none-eabi/13.2.1/../../../../arm-none-eabi/bin/ld: cannot open linker script file script/fsp.ld: No such file or directory
collect2: error: ld returned 1 exit status
ninja: build stopped: subcommand failed.
build finished with error(s).

It has trouble finding fsp.ld, maybe an issue with the relative path.

In the root of the directory the *.ld files are located here:

./script/fsp.ld
./memory_regions.ld

If I modify cmake/GeneratedCfg.cmake like this to force an absolute path for fsp.ld:

diff -durN a/cmake/GeneratedCfg.cmake b/cmake/GeneratedCfg.cmake
--- a/cmake/GeneratedCfg.cmake  2024-06-13 17:23:52.349005825 +0200
+++ b/cmake/GeneratedCfg.cmake  2024-06-13 17:42:53.748874752 +0200
@@ -8,7 +8,7 @@
 SET(RASC_CMAKE_ASM_FLAGS "-mfloat-abi=hard;-mcpu=cortex-m33;-mfpu=fpv5-sp-d16;-Wunused;-Wuninitialized;-Wall;-Wextra;-Wmissing-declarations;-Wconversion;-Wpointer-arith;-Wshadow;-Wlogical-op;-Waggregate-return;-Wfloat-equal;-fmessage-length=0;-fsigned-char;-ffunction-sections;-fdata-sections;-mthumb;-x;assembler-with-cpp;-MMD;-MP")
 SET(RASC_CMAKE_C_FLAGS "-mfloat-abi=hard;-mcpu=cortex-m33;-mfpu=fpv5-sp-d16;-Wunused;-Wuninitialized;-Wall;-Wextra;-Wmissing-declarations;-Wconversion;-Wpointer-arith;-Wshadow;-Wlogical-op;-Waggregate-return;-Wfloat-equal;-fmessage-length=0;-fsigned-char;-ffunction-sections;-fdata-sections;-mthumb;-std=c99;-MMD;-MP")
 SET(RASC_CMAKE_CXX_FLAGS "-mfloat-abi=hard;-mcpu=cortex-m33;-mfpu=fpv5-sp-d16;-Wunused;-Wuninitialized;-Wall;-Wextra;-Wmissing-declarations;-Wconversion;-Wpointer-arith;-Wshadow;-Wlogical-op;-Waggregate-return;-Wfloat-equal;-fmessage-length=0;-fsigned-char;-ffunction-sections;-fdata-sections;-mthumb;-std=c++11;-MMD;-MP")
-SET(RASC_CMAKE_EXE_LINKER_FLAGS "-mfloat-abi=hard;-mcpu=cortex-m33;-mfpu=fpv5-sp-d16;-Wunused;-Wuninitialized;-Wall;-Wextra;-Wmissing-declarations;-Wconversion;-Wpointer-arith;-Wshadow;-Wlogical-op;-Waggregate-return;-Wfloat-equal;-fmessage-length=0;-fsigned-char;-ffunction-sections;-fdata-sections;-mthumb;-T;script/fsp.ld;-Wl,--gc-sections;-Wl,-Map,${PROJECT_NAME}.map;--specs=nano.specs;-o;${CMAKE_BINARY_DIR}/${PROJECT_NAME}.elf")
+SET(RASC_CMAKE_EXE_LINKER_FLAGS "-mfloat-abi=hard;-mcpu=cortex-m33;-mfpu=fpv5-sp-d16;-Wunused;-Wuninitialized;-Wall;-Wextra;-Wmissing-declarations;-Wconversion;-Wpointer-arith;-Wshadow;-Wlogical-op;-Waggregate-return;-Wfloat-equal;-fmessage-length=0;-fsigned-char;-ffunction-sections;-fdata-sections;-mthumb;-T;/home/popsulfr/work/vebo/ra4t1-firmware/script/fsp.ld;-Wl,--gc-sections;-Wl,-Map,${PROJECT_NAME}.map;--specs=nano.specs;-o;${CMAKE_BINARY_DIR}/${PROJECT_NAME}.elf")
 SET(RASC_CMAKE_DEFINITIONS "_RA_CORE=CM33;_RA_ORDINAL=1;_RENESAS_RA_")
 SET(RASC_ASM_FILES "${CMAKE_CURRENT_SOURCE_DIR}/ra_gen/*.asm")

I get:

[36/37  97% :: 0.316] Linking C executable VEBO_RA4T1.elf
FAILED: VEBO_RA4T1.elf 
: && /home/popsulfr/renesas/ra/e2studio_v2024-04_fsp_v5.3.0/toolchains/gcc_arm/arm-gnu-toolchain-13.2.Rel1-x86_64-arm-none-eabi/bin/arm-none-eabi-gcc -g -mfloat-abi=hard -mcpu=cortex-m33 -mfpu=fpv5-sp-d16 -Wunused -Wuninitialized -Wall -Wextra -Wmissing-declarations -Wconversion -Wpointer-arith -Wshadow -Wlogical-op -Waggregate-return -Wfloat-equal -fmessage-length=0 -fsigned-char -ffunction-sections -fdata-sections -mthumb -T /home/popsulfr/work/vebo/ra4t1-firmware/script/fsp.ld -Wl,--gc-sections -Wl,-Map,VEBO_RA4T1.map --specs=nano.specs -o /home/popsulfr/work/vebo/ra4t1-firmware/build/Debug/VEBO_RA4T1.elf CMakeFiles/VEBO_RA4T1.elf.dir/ra/fsp/src/bsp/cmsis/Device/RENESAS/Source/startup.c.obj CMakeFiles/VEBO_RA4T1.elf.dir/ra/fsp/src/bsp/cmsis/Device/RENESAS/Source/system.c.obj CMakeFiles/VEBO_RA4T1.elf.dir/ra/fsp/src/bsp/mcu/all/bsp_clocks.c.obj CMakeFiles/VEBO_RA4T1.elf.dir/ra/fsp/src/bsp/mcu/all/bsp_common.c.obj CMakeFiles/VEBO_RA4T1.elf.dir/ra/fsp/src/bsp/mcu/all/bsp_delay.c.obj CMakeFiles/VEBO_RA4T1.elf.dir/ra/fsp/src/bsp/mcu/all/bsp_group_irq.c.obj CMakeFiles/VEBO_RA4T1.elf.dir/ra/fsp/src/bsp/mcu/all/bsp_guard.c.obj CMakeFiles/VEBO_RA4T1.elf.dir/ra/fsp/src/bsp/mcu/all/bsp_io.c.obj CMakeFiles/VEBO_RA4T1.elf.dir/ra/fsp/src/bsp/mcu/all/bsp_irq.c.obj CMakeFiles/VEBO_RA4T1.elf.dir/ra/fsp/src/bsp/mcu/all/bsp_macl.c.obj CMakeFiles/VEBO_RA4T1.elf.dir/ra/fsp/src/bsp/mcu/all/bsp_register_protection.c.obj CMakeFiles/VEBO_RA4T1.elf.dir/ra/fsp/src/bsp/mcu/all/bsp_rom_registers.c.obj CMakeFiles/VEBO_RA4T1.elf.dir/ra/fsp/src/bsp/mcu/all/bsp_sbrk.c.obj CMakeFiles/VEBO_RA4T1.elf.dir/ra/fsp/src/bsp/mcu/all/bsp_security.c.obj CMakeFiles/VEBO_RA4T1.elf.dir/ra/fsp/src/r_adc/r_adc.c.obj CMakeFiles/VEBO_RA4T1.elf.dir/ra/fsp/src/r_agt/r_agt.c.obj CMakeFiles/VEBO_RA4T1.elf.dir/ra/fsp/src/r_elc/r_elc.c.obj CMakeFiles/VEBO_RA4T1.elf.dir/ra/fsp/src/r_gpt/r_gpt.c.obj CMakeFiles/VEBO_RA4T1.elf.dir/ra/fsp/src/r_gpt_three_phase/r_gpt_three_phase.c.obj CMakeFiles/VEBO_RA4T1.elf.dir/ra/fsp/src/r_ioport/r_ioport.c.obj CMakeFiles/VEBO_RA4T1.elf.dir/ra/fsp/src/r_poeg/r_poeg.c.obj CMakeFiles/VEBO_RA4T1.elf.dir/ra/fsp/src/r_sci_uart/r_sci_uart.c.obj CMakeFiles/VEBO_RA4T1.elf.dir/ra/fsp/src/rm_motor_current/rm_motor_current.c.obj CMakeFiles/VEBO_RA4T1.elf.dir/ra/fsp/src/rm_motor_driver/rm_motor_driver.c.obj CMakeFiles/VEBO_RA4T1.elf.dir/ra/fsp/src/rm_motor_hall/rm_motor_hall.c.obj CMakeFiles/VEBO_RA4T1.elf.dir/ra/fsp/src/rm_motor_sense_hall/rm_motor_sense_hall.c.obj CMakeFiles/VEBO_RA4T1.elf.dir/ra/fsp/src/rm_motor_speed/rm_motor_speed.c.obj CMakeFiles/VEBO_RA4T1.elf.dir/ra_gen/common_data.c.obj CMakeFiles/VEBO_RA4T1.elf.dir/ra_gen/elc_data.c.obj CMakeFiles/VEBO_RA4T1.elf.dir/ra_gen/hal_data.c.obj CMakeFiles/VEBO_RA4T1.elf.dir/ra_gen/main.c.obj CMakeFiles/VEBO_RA4T1.elf.dir/ra_gen/pin_data.c.obj CMakeFiles/VEBO_RA4T1.elf.dir/ra_gen/vector_data.c.obj CMakeFiles/VEBO_RA4T1.elf.dir/src/driver/timer.c.obj CMakeFiles/VEBO_RA4T1.elf.dir/src/hal_entry.c.obj CMakeFiles/VEBO_RA4T1.elf.dir/src/hci/hci.c.obj CMakeFiles/VEBO_RA4T1.elf.dir/src/motor/motor.c.obj -o VEBO_RA4T1.elf -L/home/popsulfr/work/vebo/ra4t1-firmware/ra/fsp/lib/rm_motor_current/cm33_gcc   -L/home/popsulfr/work/vebo/ra4t1-firmware/ra/fsp/lib/rm_motor_speed/cm33_gcc -lrm_motor_current  -lrm_motor_speed && cd /home/popsulfr/work/vebo/ra4t1-firmware/build/Debug && echo Running RASC post-build to generate Smart Bundle "(" .sbd ")" file && /home/popsulfr/renesas/ra/sc_v2024-04_fsp_v5.3.0/eclipse/rasc -nosplash --launcher.suppressErrors --gensmartbundle --devicefamily ra --compiler GCC /home/popsulfr/work/vebo/ra4t1-firmware/configuration.xml /home/popsulfr/work/vebo/ra4t1-firmware/build/Debug/VEBO_RA4T1.elf
/home/popsulfr/renesas/ra/e2studio_v2024-04_fsp_v5.3.0/toolchains/gcc_arm/arm-gnu-toolchain-13.2.Rel1-x86_64-arm-none-eabi/bin/../lib/gcc/arm-none-eabi/13.2.1/../../../../arm-none-eabi/bin/ld: cannot open linker script file memory_regions.ld: No such file or directory
collect2: error: ld returned 1 exit status
ninja: build stopped: subcommand failed.
build finished with error(s).

Can't find memory_regions.ld. Same thing here, if I force an absolute path for memory_regions.ld in script/fsp.ld:

--- a/script/fsp.ld     2024-04-22 23:31:14.000000000 +0200
+++ b/script/fsp.ld     2024-06-13 17:46:57.322024495 +0200
@@ -2,7 +2,7 @@
                   Linker File for Renesas FSP
 */

-INCLUDE memory_regions.ld
+INCLUDE /home/popsulfr/work/vebo/ra4t1-firmware/memory_regions.ld

 /* Uncomment and set XIP_SECONDARY_SLOT_IMAGE to 1 below for the secondary XIP application image.*/
 /*

Then the linking finally works.

renesas-brandon-hussey commented 3 months ago

This is being internally tracked using FSPRA-3312.