Skip to main content
Associate II
February 20, 2024
Question

What is this C syntax?

  • February 20, 2024
  • 3 replies
  • 1042 views

The following is the code generated by X-CUBE-AI of STM32CubeIDE ,but I can't understand it.

 

/** Array declarations section **********************************************/
/* Array#0 */
AI_ARRAY_OBJ_DECLARE(
 input_1_output_array, AI_ARRAY_FORMAT_FLOAT|AI_FMT_FLAG_IS_IO,
 NULL, NULL, 4096, AI_STATIC)

/** Tensor declarations section *********************************************/
/* Tensor #0 */
AI_TENSOR_OBJ_DECLARE(
 input_1_output, AI_STATIC,
 0, 0x0,
 AI_SHAPE_INIT(4, 1, 1, 64, 64), AI_STRIDE_INIT(4, 4, 4, 4, 256),
 1, &input_1_output_array, NULL)

 

 

 

 

DER 

3 replies

Tesla DeLorean
Guru
February 20, 2024

Look up the definition of the Macro or Function. Use a static analysis tool or find-in-files.

Tips, Buy me a coffee, or three.. PayPal VenmoUp vote any posts that you find helpful, it shows what's working..
TDK
Super User
February 20, 2024

Right-click -> Open Declaration to see the macro definition of AI_ARRAY_OBJ_DECLARE. Or hit F3 when your cursor is on it.

"If you feel a post has answered your question, please click ""Accept as Solution""."
Andrew Neil
Super User
February 20, 2024

@xiewenliang wrote:

 I can't understand it.

 

 

 

DER 


What, exactly, don't you understand?

The syntax is simply using  Macros (#defines) with parameters.

See the section on the Preprocessor in any C reference.

Your IDE should be able to take you to the definitions of the Macros - then you can work out what it expands to.

 

A complex system that works is invariably found to have evolved from a simple system that worked.A complex system designed from scratch never works and cannot be patched up to make it work.