cancel
Showing results for 
Search instead for 
Did you mean: 

error in generate code for stm32WBA54 with MX tools

Romaszewski
Associate II

For your information

Sizeof is used in place of strlen and my coordinator receive a \0x00 at the end of the string !!

when i generate code with MX generation tools, in function : in red old code in green new code

 

void APP_ZIGBEE_ConfigBasicServer(void)

{

static struct ZbZclBasicServerDefaults stBasicServerDefaults;

/* Initialize Basic Server Cluster 'defaults' information */

memset( &stBasicServerDefaults, 0x00, sizeof(stBasicServerDefaults) );

stBasicServerDefaults.mfr_name[0] = sizeof strlen( APP_ZIGBEE_MFR_NAME );

memcpy( &stBasicServerDefaults.mfr_name[1], APP_ZIGBEE_MFR_NAME, sizeof( APP_ZIGBEE_MFR_NAME ) );

stBasicServerDefaults.model_name[0] = sizeof strlen( APP_ZIGBEE_CHIP_NAME );

memcpy( &stBasicServerDefaults.model_name[1], APP_ZIGBEE_CHIP_NAME, sizeof( APP_ZIGBEE_CHIP_NAME ) );

stBasicServerDefaults.date_code[0] = sizeof strlen( APP_ZIGBEE_APP_DATE_CODE );

memcpy( &stBasicServerDefaults.date_code[1], APP_ZIGBEE_APP_DATE_CODE, sizeof( APP_ZIGBEE_APP_DATE_CODE ) );

stBasicServerDefaults.sw_build_id[0] = sizeof strlen( APP_ZIGBEE_APP_BUILD_ID );

memcpy( &stBasicServerDefaults.sw_build_id[1], APP_ZIGBEE_APP_BUILD_ID, sizeof( APP_ZIGBEE_APP_BUILD_ID ) );

6 REPLIES 6
STTwo-32
ST Employee

Hello @Romaszewski 

Can you share your .ioc file so we can reproduce this behavior.

Best Regards.

STTwo-32

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.

voici

I'm not able to reproduce that issue. Could you give more details and the steps to reproduce this issue. 

Merci Beaucoup d'avance.

STTwo-32

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.

I explain better

when i generate the project with .ioc file.

in app-zigbee.c i have :

problem sizeof - original file.png

but sizeof is not good because it is the size of string with \0 terminator, in mfr_name[0] i must have 18 and not 19 for "stmicroelectronics" the good function is strlen.

After my correction next, my coordinator (zigbee2mqtt) run :

problem sizeof - corrected file.png

thank  for correcting

Romaszewski
Associate II

Do you have a procedure to inform the team of development of MX tools for this error ?

Hello @Romaszewski 

I've raised this internally for more investigation (under internal ticket number 184049).

Best Regards.

STTwo-32

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.