Core: Fix compile error on casting pointer type
Open, NormalPublic

Description

Explicitly cast void * to sfn_t to avoid compile error in tfm_core_partition_request()

wmnt created this task.Thu, May 30, 9:31 AM
wmnt triaged this task as Normal priority.
wmnt added a comment.Thu, May 30, 9:36 AM

Hi @ccli8,

Could you provide details of the compiler configuration where you received this error?
We may need to update the configurations in CI to capture similar shortcomings.
I will execute some rudimentary tests in the meantime.

Thanks
Miklos

Hi @wmnt

Toolchain: Arm Compiler 6.10
Platform: Nuvoton M2351 (M23-based)
mbed-os/tf-m

Compile [ 78.5%]: target_cfg.cpp
Compile: C:/Keil_v5/ARM/ARMCLANG_V6.10/bin\armclang -c --target=arm-arm-none-eabi -mthumb -Os -Wno-armcc-pragma-push-pop -Wno-armcc-pragma-anon-unions -DMULADDC_CANNOT_USE_R7 -fdata-sections -fno-exceptions -MMD -D_LIBCPP_EXTERN_TEMPLATE(...)= -fshort-enums -fshort-wchar -DMBED_TRAP_ERRORS_ENABLED=1 -mcpu=cortex-m23 -fno-rtti -std=gnu++98 -mcmse -DMBED_ROM_START=0x0 -DMBED_ROM_SIZE=0x40000 -DMBED_ROM1_START=0x10040000 -DMBED_ROM1_SIZE=0x40000 -DMBED_RAM_START=0x20000000 -DMBED_RAM_SIZE=0x10000 -DMBED_RAM1_START=0x30008000 -DMBED_RAM1_SIZE=0x10000 -DTARGET_M23_S -DTARGET_M2351KIAAEES -DDAUTH_CHIP_DEFAULT -DTARGET_PSA -DMBEDTLS_PSA_CRYPTO_SPM -DTARGET_NUMAKER_PFM_M2351_CM -DTARGET_PSA_Target -D__MBED__=1 -DDEVICE_I2CSLAVE=1 -DTARGET_LIKE_MBED -DDEVICE_PORTINOUT=1 -D__MBED_CMSIS_RTOS_CM -DDEVICE_MPU=1 -D__CMSIS_RTOS -DTOOLCHAIN_ARMC6 -DTARGET_SPE_Target -DTARGET_FLASH_CMSIS_ALGO -D__CORTEX_M23 -DMBED_BUILD_TIMESTAMP=1559209833.15 -DDEVICE_I2C_ASYNCH=1 -DTARGET_CORTEX_M -DTARGET_TFM -DDEVICE_ANALOGOUT=1 -DMBEDTLS_ENTROPY_NV_SEED -DDEVICE_LPTICKER=1 -DTARGET_NUVOTON -DCOMPONENT_FLASHIAP=1 -DCOMPONENT_SPE=1 -DTARGET_NAME=NUMAKER_PFM_M2351_S -DCOMPONENT_PSA_SRV_IMPL=1 -DTARGET_CORTEX -DDEVICE_I2C=1 -DDEVICE_PORTOUT=1 -DTARGET_M23 -DDEVICE_SPI_ASYNCH=1 -DBYPASS_NVSTORE_CHECK -DTARGET_RELEASE -DTARGET_LIKE_CORTEX_M23 -DDEVICE_USTICKER=1 -DMBEDTLS_PSA_CRYPTO_C -DTARGET_M2351 -DDEVICE_PORTIN=1 -DDEVICE_SLEEP=1 -DCOMPONENT_PSA_SRV_IPC=1 -DMBED_FAULT_HANDLER_DISABLED -DDEVICE_SPI=1 -DDEVICE_INTERRUPTIN=1 -DARM_MATH_ARMV8MBL -DDEVICE_SPISLAVE=1 -DDEVICE_ANALOGIN=1 -DDEVICE_PWMOUT=1 -DLPTICKER_DELAY_TICKS=3 -DDEVICE_FLASH=1 -DTARGET_NUMAKER_PFM_M2351_S -DTOOLCHAIN_ARM -DTOOLCHAIN_ARM_STD @.\BUILD\NUMAKER_PFM_M2351_S\ARMC6-DEVELOP\.includes_7e55adf4c985f812c77def813283da79.txt -include .\BUILD\NUMAKER_PFM_M2351_S\ARMC6-DEVELOP\mbed_config.h -o BUILD\NUMAKER_PFM_M2351_S\ARMC6-DEVELOP\mbed-os\targets\TARGET_NUVOTON\TARGET_M2351\TARGET_M23_S\TARGET_TFM\target_cfg.o .\mbed-os\targets\TARGET_NUVOTON\TARGET_M2351\TARGET_M23_S\TARGET_TFM\target_cfg.cpp
[Warning] mbed_config.h@78,9: 'MBED_FAULT_HANDLER_DISABLED' macro redefined [-Wmacro-redefined]
[Error] tfm_secure_api.h@139,16: assigning to 'sfn_t' (aka 'int (*)(int, int, int, int)') from incompatible type 'void *'
wmnt added a comment.Thu, May 30, 12:40 PM

Thanks, the change is approved.

Further investigation indicated that
secure_fw/ns_callable/tfm_psa_api_veneers.c : tfm_core_ns_ipc_request() function would emit the same error message in a different build configuration

Will keep this ticket open to follow that file up, will push review for that imminently