cancel
Showing results for 
Search instead for 
Did you mean: 

OP-TEE version 3.19.0-stm32mp-r1.1 - enum/integer mismatch in core/mm/core_mmu.c

krotti42
Associate II

Hi!

 

I have tried to compile OP-TEE version 3.19.0-stm32mp-r1.1 for the STM32MP157F-DK2 board. With the official source on STMicroelectronics OP-TEE Github repo ,but I get the following error:

$ make CROSS_COMPILE=arm-none-eabi- PLATFORM=stm32mp1-157F_DK2 all
  GEN     out/arm-plat-stm32mp1/core/include/generated/arm32_sysreg.h
[...]
  CC      out/arm-plat-stm32mp1/core/mm/core_mmu.o
core/mm/core_mmu.c:1514:6: error: conflicting types for 'core_mmu_get_mem_by_type' due to enum/integer mismatch; have 'void(unsigned int,  vaddr_t *, vaddr_t *)' {aka 'void(unsigned int,  long unsigned int *, long unsigned int *)'} [-Werror=enum-int-mismatch]
 1514 | void core_mmu_get_mem_by_type(unsigned int type, vaddr_t *s, vaddr_t *e)
      |      ^~~~~~~~~~~~~~~~~~~~~~~~
In file included from core/include/mm/tee_pager.h:13,
                 from core/include/mm/fobj.h:11,
                 from core/include/mm/sp_mem.h:10,
                 from core/arch/arm/include/kernel/secure_partition.h:14,
                 from core/include/kernel/user_mode_ctx.h:11,
                 from core/mm/core_mmu.c:19:
core/include/mm/core_mmu.h:535:6: note: previous declaration of 'core_mmu_get_mem_by_type' with type 'void(enum teecore_memtypes,  vaddr_t *, vaddr_t *)' {aka 'void(enum teecore_memtypes,  long unsigned int *, long unsigned int *)'}
  535 | void core_mmu_get_mem_by_type(enum teecore_memtypes type, vaddr_t *s,
      |      ^~~~~~~~~~~~~~~~~~~~~~~~
cc1: note: unrecognized command-line option '-Wno-c2x-extensions' may have been intended to silence earlier diagnostics
cc1: all warnings being treated as errors
make: *** [mk/compile.mk:163: out/arm-plat-stm32mp1/core/mm/core_mmu.o] Error 1
$ 

I have modified core/mm/core_mmu.c successfully, but currently not tested on the real board.

Patch:

diff -ruN STMicroelectronics_3.19.0-stm32mp-r1.1/core/mm/core_mmu.c STMicroelectronics_3.19.0-stm32mp-r1.1_fixed/core/mm/core_mmu.c
--- STMicroelectronics_3.19.0-stm32mp-r1.1/core/mm/core_mmu.c	2024-04-05 12:18:40.298370873 +0200
+++ STMicroelectronics_3.19.0-stm32mp-r1.1_fixed/core/mm/core_mmu.c	2024-04-05 12:20:44.152661288 +0200
@@ -1511,7 +1511,7 @@
 /*
  * teecore gets some memory area definitions
  */
-void core_mmu_get_mem_by_type(unsigned int type, vaddr_t *s, vaddr_t *e)
+void core_mmu_get_mem_by_type(enum teecore_memtypes type, vaddr_t *s, vaddr_t *e)
 {
 	struct tee_mmap_region *map = find_map_by_type(type);
 

 

Kind regards

1 ACCEPTED SOLUTION

Accepted Solutions
krotti42
Associate II

Hi @PatrickF 

 

This error is when building the OP-TEE with GCC version >=13. For building I used this description mentioned in the ST Wiki.

Here you can find the corresponding commit in the official (vanilla) OP-TEE repo which fix this issue:

$ git-log core/mm/core_mmu.c
[...]
commit 359c54b79de65acb91a50acd20d28a166c448510
Author: Jose Quaresma <jose.quaresma@foundries.io>
Date:   Mon Jun 12 18:32:24 2023 +0100

    core: mm: Fix conflicting types due to enum/integer mismatch
    
    This is an error with gcc13 [-Werror=enum-int-mismatch]
    
    Reviewed-by: Jens Wiklander <jens.wiklander@linaro.org>
    Signed-off-by: Jose Quaresma <jose.quaresma@foundries.io>
[...]
$ 

 

View solution in original post

3 REPLIES 3
PatrickF
ST Employee

Hi @krotti42 

did you look at https://wiki.st.com/stm32mpu/wiki/How_to_configure_OP-TEE

Regards.

In order to give better visibility on the answered topics, please click on 'Accept as Solution' on the reply which solved your issue or answered your question.
krotti42
Associate II

Hi @PatrickF 

 

This error is when building the OP-TEE with GCC version >=13. For building I used this description mentioned in the ST Wiki.

Here you can find the corresponding commit in the official (vanilla) OP-TEE repo which fix this issue:

$ git-log core/mm/core_mmu.c
[...]
commit 359c54b79de65acb91a50acd20d28a166c448510
Author: Jose Quaresma <jose.quaresma@foundries.io>
Date:   Mon Jun 12 18:32:24 2023 +0100

    core: mm: Fix conflicting types due to enum/integer mismatch
    
    This is an error with gcc13 [-Werror=enum-int-mismatch]
    
    Reviewed-by: Jens Wiklander <jens.wiklander@linaro.org>
    Signed-off-by: Jose Quaresma <jose.quaresma@foundries.io>
[...]
$ 

 

PatrickF
ST Employee

Hi,

OpTee patch will be present in upcoming OpenSTLinux Ecosystem Rev.5.1

Regards

In order to give better visibility on the answered topics, please click on 'Accept as Solution' on the reply which solved your issue or answered your question.