Page MenuHomePhabricator

Build warnings
Open, Needs TriagePublic

Description

Building with just AN521, and no other options, I get the following warnings.

[ 37%] Building C object secure_fw/spm/CMakeFiles/tfm_spm.dir/__/__/interface/src/log/tfm_log_raw.o
trusted-firmware-m/secure_fw/spm/cmsis_func/spm_func.c: In function 'tfm_spm_seal_psp_stacks':
trusted-firmware-m/secure_fw/spm/cmsis_func/spm_func.c:93:5: warning: array subscript 1 is outside array bounds of 'uint32_t[1]' {aka 'long unsigned int[1]'} [-Warray-bounds]
   93 |     *(arm_lib_stck_seal_base + 1) = TFM_STACK_SEAL_VALUE;
      |     ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~
In file included from trusted-firmware-m/secure_fw/spm/cmsis_func/spm_func.c:25:
trusted-firmware-m/secure_fw/spm/cmsis_func/spm_func.c:58:18: note: while referencing 'Image$$ARM_LIB_STACK_SEAL$$ZI$$Base'
   58 | REGION_DECLARE_T(Image$$, ARM_LIB_STACK_SEAL, $$ZI$$Base, uint32_t);
      |                  ^~~~~~~
trusted-firmware-m/platform/include/region.h:12:25: note: in definition of macro 'REGION'
   12 | #define REGION(a, b, c) a##b##c
      |                         ^
trusted-firmware-m/platform/include/region.h:15:47: note: in expansion of macro 'REGION_NAME'
   15 | #define REGION_DECLARE_T(a, b, c, t) extern t REGION_NAME(a, b, c)
      |                                               ^~~~~~~~~~~
trusted-firmware-m/secure_fw/spm/cmsis_func/spm_func.c:58:1: note: in expansion of macro 'REGION_DECLARE_T'
   58 | REGION_DECLARE_T(Image$$, ARM_LIB_STACK_SEAL, $$ZI$$Base, uint32_t);
      | ^~~~~~~~~~~~~~~~
trusted-firmware-m/secure_fw/spm/cmsis_func/spm_func.c: In function 'tfm_spm_sfn_request_handler':
trusted-firmware-m/secure_fw/spm/cmsis_func/spm_func.c:452:31: warning: 'iovecs.orig_outvec' may be used uninitialized in this function [-Wmaybe-uninitialized]
  452 |     runtime_data->orig_outvec = iovec_ptr->orig_outvec;
      |     ~~~~~~~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~
trusted-firmware-m/secure_fw/spm/cmsis_func/spm_func.c:805:27: note: 'iovecs.orig_outvec' was declared here
  805 |     struct iovec_params_t iovecs;
      |                           ^~~~~~
trusted-firmware-m/secure_fw/spm/cmsis_func/spm_func.c:448:5: warning: 'iovecs.out_len' may be used uninitialized in this function [-Wmaybe-uninitialize]
  448 |     for (i = 0U; i < runtime_data->iovec_args.out_len; ++i) {
      |     ^~~
trusted-firmware-m/secure_fw/spm/cmsis_func/spm_func.c:805:27: note: 'iovecs.out_len' was declared here
  805 |     struct iovec_params_t iovecs;
      |                           ^~~~~~
trusted-firmware-m/secure_fw/spm/cmsis_func/spm_func.c:443:5: warning: 'iovecs.in_len' may be used uninitialized in this function [-Wmaybe-uninitialized]
  443 |     for (i = 0U; i < runtime_data->iovec_args.in_len; ++i) {
      |     ^~~
trusted-firmware-m/secure_fw/spm/cmsis_func/spm_func.c:805:27: note: 'iovecs.in_len' was declared here
  805 |     struct iovec_params_t iovecs;
      |                           ^~~~~~

Event Timeline

This comment was removed by davidhuziji.
davidhuziji added a comment.EditedTue, Mar 30, 3:27 AM

Can you share the Compiler information please?

It looks like your compiler is bit more stricter than mine :)
It won't take too much to effort to fix those warnings I guess.

Makes sense :)
Here is the GCC version output:

$arm-zephyr-eabi-gcc --version
arm-zephyr-eabi-gcc (crosstool-NG 1.24.0.212_d7da3a9) 10.2.0
Copyright (C) 2020 Free Software Foundation, Inc.
This is free software; see the source for copying conditions.  There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.

I will run the GCC version later to check if there are more warnings. Will collect all the warnings and fix them in one shot later.

davidwang reassigned this task from davidwang to KenLSoft.Tue, Apr 6, 3:01 AM
davidwang added a subscriber: davidwang.

Assigned to Ken for the warning fix.

Would fix after the release. Mark as a long term goal.

I will run the GCC version later to check if there are more warnings. Will collect all the warnings and fix them in one shot later.

Can you guys provide the gcc flags you are using? I am gona to reproduce it in my side.

I built with

cmake .. -DTFM_PLATFORM=mps2/an521
make -j8

I also now noticed a few more warnings:

[ 68%] Building C object secure_fw/partitions/audit_logging/CMakeFiles/tfm_psa_rot_partition_audit.dir/audit_core.o
In function 'audit_format_buffer',
    inlined from 'audit_core_add_record' at /home/oyro/git/ncs/modules/tee/tfm_dev/trusted-firmware-m/secure_fw/partitions/audit_logging/audit_core.c:690:14:
/home/oyro/git/ncs/modules/tee/tfm_dev/trusted-firmware-m/secure_fw/partitions/audit_logging/audit_core.c:333:19: warning: writing 1 byte into a region of size 0 [-Wstringop-overflow=]
  333 |         dest[idx] = src[idx];
      |         ~~~~~~~~~~^~~~~~~~~~
In file included from /home/oyro/git/ncs/modules/tee/tfm_dev/trusted-firmware-m/secure_fw/partitions/audit_logging/audit_core.c:11:
/home/oyro/git/ncs/modules/tee/tfm_dev/trusted-firmware-m/secure_fw/partitions/audit_logging/audit_core.c: In function 'audit_core_add_record':
/home/oyro/git/ncs/modules/tee/tfm_dev/trusted-firmware-m/secure_fw/partitions/audit_logging/audit_core.h:103:14: note: at offset 0 to object 'size' with size 4 declared here
  103 |     uint32_t size;
      |              ^~~~
In function 'audit_format_buffer',
    inlined from 'audit_core_add_record' at /home/oyro/git/ncs/modules/tee/tfm_dev/trusted-firmware-m/secure_fw/partitions/audit_logging/audit_core.c:690:14:
/home/oyro/git/ncs/modules/tee/tfm_dev/trusted-firmware-m/secure_fw/partitions/audit_logging/audit_core.c:333:19: warning: writing 1 byte into a region of size 0 [-Wstringop-overflow=]
  333 |         dest[idx] = src[idx];
      |         ~~~~~~~~~~^~~~~~~~~~
In file included from /home/oyro/git/ncs/modules/tee/tfm_dev/trusted-firmware-m/secure_fw/partitions/audit_logging/audit_core.c:11:
/home/oyro/git/ncs/modules/tee/tfm_dev/trusted-firmware-m/secure_fw/partitions/audit_logging/audit_core.c: In function 'audit_core_add_record':
/home/oyro/git/ncs/modules/tee/tfm_dev/trusted-firmware-m/secure_fw/partitions/audit_logging/audit_core.h:103:14: note: at offset 0 to object 'size' with size 4 declared here
  103 |     uint32_t size;
      |              ^~~~
In function 'audit_format_buffer',
    inlined from 'audit_core_add_record' at /home/oyro/git/ncs/modules/tee/tfm_dev/trusted-firmware-m/secure_fw/partitions/audit_logging/audit_core.c:690:14:
/home/oyro/git/ncs/modules/tee/tfm_dev/trusted-firmware-m/secure_fw/partitions/audit_logging/audit_core.c:333:19: warning: writing 1 byte into a region of size 0 [-Wstringop-overflow=]
  333 |         dest[idx] = src[idx];
      |         ~~~~~~~~~~^~~~~~~~~~
In file included from /home/oyro/git/ncs/modules/tee/tfm_dev/trusted-firmware-m/secure_fw/partitions/audit_logging/audit_core.c:11:
/home/oyro/git/ncs/modules/tee/tfm_dev/trusted-firmware-m/secure_fw/partitions/audit_logging/audit_core.c: In function 'audit_core_add_record':
/home/oyro/git/ncs/modules/tee/tfm_dev/trusted-firmware-m/secure_fw/partitions/audit_logging/audit_core.h:103:14: note: at offset 0 to object 'size' with size 4 declared here
  103 |     uint32_t size;
      |              ^~~~

This time I ran it with

$ arm-none-eabi-gcc --version
arm-none-eabi-gcc (GNU Arm Embedded Toolchain 10-2020-q4-major) 10.2.1 20201103 (release)
Copyright (C) 2020 Free Software Foundation, Inc.
This is free software; see the source for copying conditions.  There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.