Broadcom / AFBR-S50-API

API for the AFBR-S50 Time-Of-Flight Sensor Family.
https://www.broadcom.com/products/optical-sensors/time-of-flight-3d-sensors
BSD 3-Clause "New" or "Revised" License
22 stars 6 forks source link

Troubles building e2Studio/AFBR_S50_ExplorerApp_RA4M2 #35

Open essej opened 1 week ago

essej commented 1 week ago

Following the instructions here: https://broadcom.github.io/AFBR-S50-API/e2studio.html I installed the latest version v5.4.0 of FSP with e2Studio 2024-04 from here: https://github.com/renesas/fsp/releases and imported the e2Studio/AFBR_S50_ExplorerApp_RA4M2 project without copying. I did this on both Windows 11 and macOS 14.3 but the same issues described below occur.

The first issue, strangely enough is that the build process overwrites the ra_gen/bsp_clock_cfg.h file with an incomplete version which then causes the build to fail. So I restored the correct contents from git, then set that file to be read-only. The build then goes almost to completion, but fails with the following linker error:

Building target: AFBR_S50_ExplorerApp_RA4M2.elf
c:/program files (x86)/gnu arm embedded toolchain/10 2021.10/bin/../lib/gcc/arm-none-eabi/10.3.1/../../../../arm-none-eabi/bin/ld.exe: cannot open linker script file memory_regions.ld: No such file or directory
collect2.exe: error: ld returned 1 exit status
make: *** [makefile:116: AFBR_S50_ExplorerApp_RA4M2.elf] Error 1
"make -r -j20 all" terminated with exit code 2. Build might be incomplete.

(The same error occurs on mac, only the toolchain paths are different, of course)

Supposedly the memory_regions.ld is supposed to be generated by the build and placed in the target build dir before the link step, but that doesn't appear to be happening here. Has anyone else seen this, or reproduced this problem on their systems? Is there a known version of BSP with e2studio that works correctly? Thanks in advance!

Here is the complete build log for reference:

Extracting support files...
18:11:44 **** Build of configuration DebugUART for project AFBR_S50_ExplorerApp_RA4M2 ****
make -r -j20 all 
Building file: ../src/hal_entry.c
Building file: ../src/r_usb_pcdc_descriptor.c
Building file: ../ra_gen/common_data.c
Building file: ../ra_gen/hal_data.c
Building file: ../ra_gen/pin_data.c
Building file: ../ra_gen/vector_data.c
Building file: ../ra/fsp/src/rm_vee_flash/rm_vee_flash.c
Building file: ../ra/fsp/src/r_usb_basic/src/hw/r_usb_creg_abs.c
Building file: ../ra/fsp/src/r_usb_basic/src/hw/r_usb_creg_access.c
Building file: ../ra/fsp/src/r_usb_basic/src/hw/r_usb_dma.c
Building file: ../ra/fsp/src/r_usb_basic/src/hw/r_usb_hostelectrical.c
Building file: ../ra/fsp/src/r_usb_basic/src/hw/r_usb_hreg_abs.c
Building file: ../ra/fsp/src/r_usb_basic/src/hw/r_usb_hreg_access.c
Building file: ../ra/fsp/src/r_usb_basic/src/hw/r_usb_mcu.c
Building file: ../ra/fsp/src/r_usb_basic/src/hw/r_usb_preg_abs.c
Building file: ../ra/fsp/src/r_usb_basic/src/hw/r_usb_preg_access.c
Building file: ../ra/fsp/src/r_usb_basic/src/driver/r_usb_cdataio.c
Building file: ../ra/fsp/src/r_usb_basic/src/driver/r_usb_clibusbip.c
Building file: ../ra/fsp/src/r_usb_basic/src/driver/r_usb_cstd_rtos.c
Building file: ../ra/fsp/src/r_usb_basic/src/driver/r_usb_hbc.c
Building file: ../ra/fsp/src/r_usb_basic/src/driver/r_usb_hdriver.c
Building file: ../ra/fsp/src/r_usb_basic/src/driver/r_usb_hcontrolrw.c
Building file: ../ra/fsp/src/r_usb_basic/src/driver/r_usb_hhubsys.c
Building file: ../ra/fsp/src/r_usb_basic/src/driver/r_usb_hintfifo.c
Building file: ../ra/fsp/src/r_usb_basic/src/driver/r_usb_hinthandler_usbip0.c
Building file: ../ra/fsp/src/r_usb_basic/src/driver/r_usb_hinthandler_usbip1.c
Building file: ../ra/fsp/src/r_usb_basic/src/driver/r_usb_hlibusbip.c
Building file: ../ra/fsp/src/r_usb_basic/src/driver/r_usb_hmanager.c
Building file: ../ra/fsp/src/r_usb_basic/src/driver/r_usb_hscheduler.c
Building file: ../ra/fsp/src/r_usb_basic/src/driver/r_usb_hsignal.c
Building file: ../ra/fsp/src/r_usb_basic/src/driver/r_usb_hstdfunction.c
Building file: ../ra/fsp/src/r_usb_basic/src/driver/r_usb_pbc.c
Building file: ../ra/fsp/src/r_usb_basic/src/driver/r_usb_pcontrolrw.c
Building file: ../ra/fsp/src/r_usb_basic/src/driver/r_usb_pdriver.c
Building file: ../ra/fsp/src/r_usb_basic/src/driver/r_usb_pintfifo.c
Building file: ../ra/fsp/src/r_usb_basic/src/driver/r_usb_pinthandler_usbip0.c
Building file: ../ra/fsp/src/r_usb_basic/src/driver/r_usb_plibusbip.c
Building file: ../ra/fsp/src/r_usb_basic/src/driver/r_usb_psignal.c
Building file: ../ra/fsp/src/r_usb_basic/src/driver/r_usb_pstdfunction.c
Building file: ../ra/fsp/src/r_usb_basic/src/driver/r_usb_pstdrequest.c
Building file: ../ra/fsp/src/r_usb_basic/r_usb_basic.c
Building file: ../ra/fsp/src/r_spi/r_spi.c
Building file: ../ra/fsp/src/r_icu/r_icu.c
Building file: ../ra/fsp/src/r_gpt/r_gpt.c
Building file: ../ra/fsp/src/r_sci_uart/r_sci_uart.c
Building file: ../ra/fsp/src/r_ioport/r_ioport.c
Building file: ../ra/fsp/src/r_flash_hp/r_flash_hp.c
Building file: ../ra/fsp/src/r_dtc/r_dtc.c
Building file: ../ra/fsp/src/r_can/r_can.c
Building file: ../ra/fsp/src/bsp/mcu/all/bsp_clocks.c
Building file: ../ra/fsp/src/bsp/mcu/all/bsp_common.c
Building file: ../ra/fsp/src/bsp/mcu/all/bsp_delay.c
Building file: ../ra/fsp/src/bsp/mcu/all/bsp_group_irq.c
Building file: ../ra/fsp/src/bsp/mcu/all/bsp_guard.c
Building file: ../ra/fsp/src/bsp/mcu/all/bsp_io.c
Building file: ../ra/fsp/src/bsp/mcu/all/bsp_irq.c
Building file: ../ra/fsp/src/bsp/mcu/all/bsp_register_protection.c
Building file: ../ra/fsp/src/bsp/mcu/all/bsp_rom_registers.c
Building file: ../ra/fsp/src/bsp/mcu/all/bsp_sbrk.c
Building file: ../ra/fsp/src/bsp/mcu/all/bsp_security.c
Building file: ../ra/fsp/src/bsp/cmsis/Device/RENESAS/Source/startup.c
Building file: ../ra/fsp/src/bsp/cmsis/Device/RENESAS/Source/system.c
Building file: C:/Users/jesse/src/AFBR-S50-API/Sources/Utility/printf/printf.c
Building file: C:/Users/jesse/src/AFBR-S50-API/Sources/Utility/debug.c
Building file: C:/Users/jesse/src/AFBR-S50-API/Sources/Platform/Renesas_RA4M2/usb/usb_sci.c
Building file: C:/Users/jesse/src/AFBR-S50-API/Sources/Platform/Renesas_RA4M2/driver/bsp.c
Building file: C:/Users/jesse/src/AFBR-S50-API/Sources/Platform/Renesas_RA4M2/driver/flash.c
Building file: C:/Users/jesse/src/AFBR-S50-API/Sources/Platform/Renesas_RA4M2/driver/irq.c
C:/Users/jesse/src/AFBR-S50-API/Sources/Utility/printf/printf.c: In function 'get_sign':
C:/Users/jesse/src/AFBR-S50-API/Sources/Utility/printf/printf.c:178:30: warning: conversion from 'double_uint_t' {aka 'long long unsigned int'} to 'int' may change value [-Wconversion]
  178 |   return get_bit_access(x).U >> (DOUBLE_SIZE_IN_BITS - 1);
      |          ~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~
C:/Users/jesse/src/AFBR-S50-API/Sources/Utility/printf/printf.c: In function 'get_components':
C:/Users/jesse/src/AFBR-S50-API/Sources/Utility/printf/printf.c:431:34: warning: conversion from 'int_fast64_t' {aka 'long long int'} to 'double' may change value [-Wconversion]
  431 |   double remainder = (abs_number - number_.integral) * powers_of_10[precision];
      |                                  ^
C:/Users/jesse/src/AFBR-S50-API/Sources/Utility/printf/printf.c:444:22: warning: comparing floating-point with '==' or '!=' is unsafe [-Wfloat-equal]
  444 |   else if (remainder == 0.5) {
      |                      ^~
C:/Users/jesse/src/AFBR-S50-API/Sources/Utility/printf/printf.c: At top level:
C:/Users/jesse/src/AFBR-S50-API/Sources/Utility/printf/printf.c:467:8: warning: no previous declaration for 'apply_scaling' [-Wmissing-declarations]
  467 | double apply_scaling(double num, struct scaling_factor normalization)
      |        ^~~~~~~~~~~~~
C:/Users/jesse/src/AFBR-S50-API/Sources/Utility/printf/printf.c:472:8: warning: no previous declaration for 'unapply_scaling' [-Wmissing-declarations]
  472 | double unapply_scaling(double normalized, struct scaling_factor normalization)
      |        ^~~~~~~~~~~~~~~
C:/Users/jesse/src/AFBR-S50-API/Sources/Utility/printf/printf.c:477:23: warning: no previous declaration for 'update_normalization' [-Wmissing-declarations]
  477 | struct scaling_factor update_normalization(struct scaling_factor sf, double extra_multiplicative_factor)
      |                       ^~~~~~~~~~~~~~~~~~~~
C:/Users/jesse/src/AFBR-S50-API/Sources/Utility/printf/printf.c: In function 'sprint_floating_point':
C:/Users/jesse/src/AFBR-S50-API/Sources/Utility/printf/printf.c:768:13: warning: comparing floating-point with '==' or '!=' is unsafe [-Wfloat-equal]
  768 |   if (value != value)
      |             ^~
Building file: C:/Users/jesse/src/AFBR-S50-API/Sources/Platform/Renesas_RA4M2/driver/nvm.c
C:/Users/jesse/src/AFBR-S50-API/Sources/Utility/printf/printf.c: In function 'get_bit_access':
C:/Users/jesse/src/AFBR-S50-API/Sources/Utility/printf/printf.c:168:38: warning: function returns an aggregate [-Waggregate-return]
  168 | static inline double_with_bit_access get_bit_access(double x)
      |                                      ^~~~~~~~~~~~~~
C:/Users/jesse/src/AFBR-S50-API/Sources/Utility/printf/printf.c: In function 'get_sign':
C:/Users/jesse/src/AFBR-S50-API/Sources/Utility/printf/printf.c:178:10: warning: function call has aggregate value [-Waggregate-return]
  178 |   return get_bit_access(x).U >> (DOUBLE_SIZE_IN_BITS - 1);
      |          ^~~~~~~~~~~~~~~~~
Building file: C:/Users/jesse/src/AFBR-S50-API/Sources/Platform/Renesas_RA4M2/driver/s2pi.c
C:/Users/jesse/src/AFBR-S50-API/Sources/Utility/printf/printf.c: In function 'get_components':
C:/Users/jesse/src/AFBR-S50-API/Sources/Utility/printf/printf.c:425:33: warning: function returns an aggregate [-Waggregate-return]
  425 | static struct double_components get_components(double number, unsigned int precision)
      |                                 ^~~~~~~~~~~~~~
C:/Users/jesse/src/AFBR-S50-API/Sources/Utility/printf/printf.c: In function 'update_normalization':
C:/Users/jesse/src/AFBR-S50-API/Sources/Utility/printf/printf.c:477:23: warning: function returns an aggregate [-Waggregate-return]
  477 | struct scaling_factor update_normalization(struct scaling_factor sf, double extra_multiplicative_factor)
      |                       ^~~~~~~~~~~~~~~~~~~~
C:/Users/jesse/src/AFBR-S50-API/Sources/Utility/printf/printf.c:485:23: warning: function call has aggregate value [-Waggregate-return]
  485 |     int factor_exp2 = get_exp2(get_bit_access(sf.raw_factor));
      |                       ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
C:/Users/jesse/src/AFBR-S50-API/Sources/Utility/printf/printf.c:486:29: warning: function call has aggregate value [-Waggregate-return]
  486 |     int extra_factor_exp2 = get_exp2(get_bit_access(extra_multiplicative_factor));
      |                             ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
C:/Users/jesse/src/AFBR-S50-API/Sources/Utility/printf/printf.c: In function 'sprint_decimal_number':
C:/Users/jesse/src/AFBR-S50-API/Sources/Utility/printf/printf.c:629:37: warning: function call has aggregate value [-Waggregate-return]
  629 |   struct double_components value_ = get_components(number, precision);
      |                                     ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Building file: C:/Users/jesse/src/AFBR-S50-API/Sources/Platform/Renesas_RA4M2/driver/timer.c
Building file: C:/Users/jesse/src/AFBR-S50-API/Sources/Platform/Renesas_RA4M2/driver/uart.c
Building file: C:/Users/jesse/src/AFBR-S50-API/Sources/Platform/Renesas_RA4M2/board/board.c
Building file: C:/Users/jesse/src/AFBR-S50-API/Sources/ExplorerApp/tasks/task_profiler.c
Building file: C:/Users/jesse/src/AFBR-S50-API/Sources/ExplorerApp/tasks/task_scheduler.c
Building file: C:/Users/jesse/src/AFBR-S50-API/Sources/ExplorerApp/sci/sci.c
Building file: C:/Users/jesse/src/AFBR-S50-API/Sources/ExplorerApp/sci/sci_cmd.c
Building file: C:/Users/jesse/src/AFBR-S50-API/Sources/ExplorerApp/sci/sci_crc8.c
Building file: C:/Users/jesse/src/AFBR-S50-API/Sources/ExplorerApp/sci/sci_datalink.c
Building file: C:/Users/jesse/src/AFBR-S50-API/Sources/ExplorerApp/sci/sci_frame.c
Building file: C:/Users/jesse/src/AFBR-S50-API/Sources/ExplorerApp/sci/sci_handshaking.c
Building file: C:/Users/jesse/src/AFBR-S50-API/Sources/ExplorerApp/sci/sci_log.c
Building file: C:/Users/jesse/src/AFBR-S50-API/Sources/ExplorerApp/core/core_cal.c
Building file: C:/Users/jesse/src/AFBR-S50-API/Sources/ExplorerApp/core/core_cfg.c
Building file: C:/Users/jesse/src/AFBR-S50-API/Sources/ExplorerApp/core/core_device.c
Building file: C:/Users/jesse/src/AFBR-S50-API/Sources/ExplorerApp/core/core_flash.c
Building file: C:/Users/jesse/src/AFBR-S50-API/Sources/ExplorerApp/core/core_utils.c
Building file: C:/Users/jesse/src/AFBR-S50-API/Sources/ExplorerApp/api/explorer_api.c
Building file: C:/Users/jesse/src/AFBR-S50-API/Sources/ExplorerApp/api/explorer_api_cal.c
Building file: C:/Users/jesse/src/AFBR-S50-API/Sources/ExplorerApp/api/explorer_api_cfg.c
C:/Users/jesse/src/AFBR-S50-API/Sources/ExplorerApp/sci/sci_log.c:106:10: warning: no previous declaration for 'print' [-Wmissing-declarations]
  106 | status_t print(const char  *fmt_s, ...)
      |          ^~~~~
Building file: C:/Users/jesse/src/AFBR-S50-API/Sources/ExplorerApp/api/explorer_api_data.c
Building file: C:/Users/jesse/src/AFBR-S50-API/Sources/ExplorerApp/explorer_app.c
Building file: C:/Users/jesse/src/AFBR-S50-API/Sources/ExplorerApp/explorer_tasks.c
Building file: C:/Users/jesse/src/AFBR-S50-API/Sources/ExplorerApp/main.c
C:/Users/jesse/src/AFBR-S50-API/Sources/ExplorerApp/core/core_device.c: In function 'ExplorerApp_InitDevice':
C:/Users/jesse/src/AFBR-S50-API/Sources/ExplorerApp/core/core_device.c:222:19: warning: function call has aggregate value [-Waggregate-return]
  222 |     ltc_t start = Time_Now();
      |                   ^~~~~~~~~~
Building target: AFBR_S50_ExplorerApp_RA4M2.elf
c:/program files (x86)/gnu arm embedded toolchain/10 2021.10/bin/../lib/gcc/arm-none-eabi/10.3.1/../../../../arm-none-eabi/bin/ld.exe: cannot open linker script file memory_regions.ld: No such file or directory
collect2.exe: error: ld returned 1 exit status
make: *** [makefile:116: AFBR_S50_ExplorerApp_RA4M2.elf] Error 1
"make -r -j20 all" terminated with exit code 2. Build might be incomplete.
c-berger commented 1 week ago

Hi, the e2Studio seems to regenerate some of its files while building which seems to cause your issue. We have tested and build the current version with FSP v4.4.0. Since your version is already v5.4.0, it might not be compatible any more with the previous version. So I would recommend to try this version.

I double checked the memory_regions.ld: youre right as this is generated upon build and appears in the output (Release/Debug`) folder. Not sure why this does not happen at your side, but maybe this behavior has changed in the newer version.

Here is the generated file, so you can append it to the project and retry (rename it to memory_regions.ld and place into the scripts folder): memory_regions.ld.txt