Code generated with errors
I use STM32 Nucleo f429zi. I tried to replicate the application on the following link, and followed all the steps. I use USART3 with pins PD8 and PD9 (the manual says these pins are connected to ST-Link)
https://www.youtube.com/watch?v=grgNXdkmzzQ
I use STM Cube IDE. On STM Cude IDE -> there is Debug option to flash the code on Board. However, when I try to Debug - there are errors generated in the app_x-cube-ai.c file.
void MX_X_CUBE_AI_Process(void)
{
aiValidationProcess();
/* USER CODE BEGIN 1 */
int nb_run = 20;
int res;
/* Example of definition of the buffers to store the tensor input/output */
/* type is dependent of the expected format */
AI_ALIGNED(4)
static ai_i8 in_data[AI_IMAGECLASSIFICATION_IN_1_SIZE_BYTES];
AI_ALIGNED(4)
static ai_i8 out_data[AI_IMAGECLASSIFICATION_OUT_1_SIZE_BYTES];
/* Retrieve format/type of the first input tensor - index 0 */
const ai_buffer_format fmt_ = AI_BUFFER_FORMAT(&ai_input[0]); // ai_input undeclared
const uint32_t type_ = AI_BUFFER_FMT_GET_TYPE(fmt_);
/* Prepare parameters for float to Qmn conversion */
const ai_i16 N_ = AI_BUFFER_FMT_GET_FBITS(fmt_);
const ai_float scale_ = (0x1U << N_);
const ai_i16 M_ = AI_BUFFER_FMT_GET_BITS(fmt_)
- AI_BUFFER_FMT_GET_SIGN(fmt_) - N_;
const ai_float max_ = (ai_float)(0x1U << M_);
/* Perform nb_rub inferences (batch = 1) */
while (--nb_run) {
/* ---------------------------------------- */
/* Data generation and Pre-Process */
/* ---------------------------------------- */
/* - fill the input buffer with random data */
for (ai_size i=0; i < AI_IMAGECLASSIFICATION_IN_1_SIZE; i++ ) {
/* Generate random data in the range [-1, 1] */
ai_float val = 2.0f * (ai_float)rand() / (ai_float)RAND_MAX - 1.0f; // RAND_MAX undeclared
/* Convert the data if necessary */
if (type_ == AI_BUFFER_FMT_TYPE_FLOAT) {
((ai_float *)in_data)[i] = val;
} else { /* AI_BUFFER_FMT_TYPE_Q */
/* Scale the values in the range [-2^M, 2^M] */
val *= max_;
/* Convert float to Qmn format */
const ai_i32 tmp_ = AI_ROUND(val * scale_, ai_i32); // expected expression before ai_132
in_data[i] = AI_CLAMP(tmp_, -128, 127, ai_i8); // expected expression before ai_i8
}
}
/* Perform the inference */
res = aiRun(in_data, out_data);
if (res) {
// ...
return;
}
/* Post-Process - process the output buffer */
// ...
}
/* USER CODE END 1 */
}Eventhough I got these error. I tried to validate on target, just to see what happens. I selected COM PORT 3 (COM 3 and COM 4 were the available options) with baud rate 115200. I got error "No board connected or invalid firware or restart board". I tried with COM port 4, but got the same error.
Could someone please help me out and let me know as to what is going wrong here.
Thanks in advance
