cancel
Showing results for 
Search instead for 
Did you mean: 

System Workbench: Doxygen setting blew up compiler

Brother Theo
Associate II

My code was compiling fine, then I turned on the Doxygen setting in preferences. Now i get lots of errors and warnings. My function prototypes say used but never defined. My functions say invalid storage class. I can't find what is broken. I turned off doxygen setting and removed alll the comments it added, no luck. Help?

15 REPLIES 15
TDK
Guru

There's not going to be a magical solution here. Find the first error reported by the compiler, understand why it's giving you that error, and fix it. Repeat until all errors are done.

The compiler doesn't know or care if Doxygen is enabled. That's all handled within comments, which are stripped away by the preprocessor.

If you feel a post has answered your question, please click "Accept as Solution".
Brother Theo
Associate II

The problem is the error is obscure:

The line

static void MX_I2C1_Init(void) {...}

gives the error 'invalid storage class for function 'MX_I2C1_Init' but the line is generated by cube mx and looks fine. This seems like something higher up in the code is broken but I cannot find it.

Sounds like you're missing a bracket somewhere. Post the file.
If you feel a post has answered your question, please click "Accept as Solution".
Brother Theo
Associate II
/* USER CODE BEGIN Header */
 
/* USER CODE END Header */
/* Includes ------------------------------------------------------------------*/
#include "main.h"
 
/* Private includes ----------------------------------------------------------*/
/* USER CODE BEGIN Includes */
#include <stdio.h>
#include <stdlib.h>
//#include "PCA9956.h"
//#include "transport.h"
//#include "LedDriver.h"
//#include "mcp23s17.h"
//#include "switchhandler.h"
 
/* USER CODE END Includes */
 
/* Private typedef -----------------------------------------------------------*/
/* USER CODE BEGIN PTD */
 
/* USER CODE END PTD */
 
/* Private define ------------------------------------------------------------*/
/* USER CODE BEGIN PD */
/* USER CODE END PD */
 
/* Private macro -------------------------------------------------------------*/
/* USER CODE BEGIN PM */
 
/* USER CODE END PM */
 
/* Private variables ---------------------------------------------------------*/
 
I2C_HandleTypeDef hi2c1;
I2C_HandleTypeDef hi2c2;
I2C_HandleTypeDef hi2c4;
 
SPI_HandleTypeDef hspi1;
SPI_HandleTypeDef hspi2;
SPI_HandleTypeDef hspi3;
SPI_HandleTypeDef hspi4;
SPI_HandleTypeDef hspi5;
 
TIM_HandleTypeDef htim4;
 
UART_HandleTypeDef huart4;
UART_HandleTypeDef huart8;
UART_HandleTypeDef huart1;
UART_HandleTypeDef huart2;
UART_HandleTypeDef huart6;
 
/* USER CODE BEGIN PV */
/* Private variables ---------------------------------------------------------*/
extern int flgGridBtnChanged;
 
uint8_t init_array[] = {
//        AUTO_INCREMENT | REGISTER_START,  //  Command
//        0x80 | REGISTER_START,  //  Command
        0x00, 0x00,                                 //  MODE1, MODE2
        0xAA, 0xAA, 0xAA, 0xAA, 0xAA, 0xAA,         //  LEDOUT[5:0]
        0x80, 0x00,                                 //  GRPPWM, GRPFREQ
    };
 
/*
// canned Led colors
const	LEDCOLOR	LedColorRed = 0x00FF0000;
const	LEDCOLOR	LedColorGreen = 0x0000FF00;
const	LEDCOLOR	LedColorBlue = 0x000000FF;
const	LEDCOLOR	LedColorMagenta = 0x00FF00FF;
const	LEDCOLOR	LedColorCyan = 0x0000FFFF;
const	LEDCOLOR	LedColorYellow = 0x00FFFF00;
const	LEDCOLOR	LedColorWhite = 0x00ffffff;
const	LEDCOLOR	LedColorBlack = 0x00000000;
*/
 
/* USER CODE END PV */
 
/* Private function prototypes -----------------------------------------------*/
void SystemClock_Config(void);
static void MX_GPIO_Init(void);
static void MX_I2C2_Init(void);
static void MX_SPI1_Init(void);
static void MX_SPI2_Init(void);
static void MX_SPI4_Init(void);
static void MX_SPI5_Init(void);
static void MX_SPI3_Init(void);
static void MX_USART2_UART_Init(void);
static void MX_USART6_UART_Init(void);
static void MX_I2C1_Init(void);
static void MX_UART4_Init(void);
static void MX_UART8_Init(void);
static void MX_USART1_UART_Init(void);
static void MX_I2C4_Init(void);
static void MX_TIM4_Init(void);
/* USER CODE BEGIN PFP */
/* Private function prototypes -----------------------------------------------*/
 
/* USER CODE END PFP */
 
/* Private user code ---------------------------------------------------------*/
/* USER CODE BEGIN 0 */
void HAL_TIM_PeriodElapsedCallback(TIM_HandleTypeDef *htim)
{
	flgGridBtnChanged=1;
}
 
void HAL_GPIO_EXTI_IRQHandler(uint16_t GPIO_Pin)
{
  /* EXTI line interrupt detected */
  if (__HAL_GPIO_EXTI_GET_IT(GPIO_Pin) != 0x00u)
  {
    __HAL_GPIO_EXTI_CLEAR_IT(GPIO_Pin); // Clears The Interrupt Flag
    HAL_GPIO_EXTI_Callback(GPIO_Pin);   // Calls The ISR Handler CallBack Function
  }
 
  // EXTI Line8 External Interrupt ISR Handler CallBackFun
  void HAL_GPIO_EXTI_Callback(uint16_t GPIO_Pin)
  {
      if(GPIO_Pin == GPIO_PIN_8) // If The INT Source Is EXTI Line9 (A9 Pin)
      {
      HAL_GPIO_TogglePin(GPIOA, GPIO_PIN_8); // Toggle The Output (LED) Pin
      }
  }
 
 
/* USER CODE END 0 */
 
/**
  * @brief  The application entry point.
  * @retval int
  */
int main(void)
{
  /* USER CODE BEGIN 1 */
	//int	thisBlock;
	//int	thisLED;
 
  /* USER CODE END 1 */
 
  /* MCU Configuration--------------------------------------------------------*/
 
  /* Reset of all peripherals, Initializes the Flash interface and the Systick. */
  HAL_Init();
 
  /* USER CODE BEGIN Init */
 
  /* USER CODE END Init */
 
  /* Configure the system clock */
  SystemClock_Config();
 
  /* USER CODE BEGIN SysInit */
 
  /* USER CODE END SysInit */
 
  /* Initialize all configured peripherals */
  MX_GPIO_Init();
  MX_I2C2_Init();
  MX_SPI1_Init();
  MX_SPI2_Init();
  MX_SPI4_Init();
  MX_SPI5_Init();
  MX_SPI3_Init();
  MX_USART2_UART_Init();
  MX_USART6_UART_Init();
  MX_I2C1_Init();
  MX_UART4_Init();
  MX_UART8_Init();
  MX_USART1_UART_Init();
  MX_I2C4_Init();
  MX_TIM4_Init();
  /* USER CODE BEGIN 2 */
  //HAL_I2C_Master_Transmit(&hi2c2, MUX_ADDR, Mux1, sizeof(Mux1), 10000);
  HAL_GPIO_WritePin(GPIOD, MUX_RST_Pin, GPIO_PIN_SET);
 
  InitLedDrivers();
  SetLedCurrents(0x04);
  InitSwDrivers();
 
  //HAL_TIM_Base_Init(&htim4);
  //HAL_TIM_Base_Start_IT(&htim4);
  ClearGridLeds();
  /* USER CODE END 2 */
 
  /* Infinite loop */
  /* USER CODE BEGIN WHILE */
  while (1)
  {
    /* USER CODE END WHILE */
 
    /* USER CODE BEGIN 3 */
	  //uint8_t	thisTrackLed;
	  //uint8_t	thisBlock=rand()&0x07, thisLed=rand()&0x0f;
	  //uint32_t	thisColor=(rand()&0xff)<<16;
	  //thisColor += (rand()&0xff)<<8;
	  //thisColor += rand()&0xff;
/*
	  SetLedByBlock(thisBlock,thisLed,thisColor);
	  HAL_Delay(50);
	  SetLedByBlock(thisBlock,thisLed,LedColorBlack);
	  HAL_Delay(50);
 
	  SetTrackLEDs(thisTrackLed,LedColorBlack);
	  thisTrackLed+=1;
	  if(thisTrackLed>7)
		  thisTrackLed=0;
	  SetTrackLEDs(thisTrackLed,LedColorGreen);
	  HAL_Delay(50);
 
	  SetEncLEDs(thisTrackLed,LedColorBlack);
	  HAL_Delay(50);
 
	  thisTrackLed+=1;
	  if(thisTrackLed>15)
		  thisTrackLed=0;
	  SetEncLEDs(thisTrackLed,LedColorGreen);
	  HAL_Delay(50);
*/
	  //.if(flgGridBtnChanged>0)
	  //{
			ScanButtons();
			SwitchHandler();
		//	flgGridBtnChanged=0;
	 //}
 
	  HAL_Delay(6);
  }
  /* USER CODE END 3 */
}

Snipet was too big, so I posted the top part.

You can attach files with the paperclip icon.

If you feel a post has answered your question, please click "Accept as Solution".
Brother Theo
Associate II

Here is the full file

TDK
Guru

You're missing a closing brace on the HAL_GPIO_EXTI_IRQHandler function.

/* USER CODE BEGIN 0 */
void HAL_TIM_PeriodElapsedCallback(TIM_HandleTypeDef *htim) {
  flgGridBtnChanged = 1;
}
 
void HAL_GPIO_EXTI_IRQHandler(uint16_t GPIO_Pin) {
  /* EXTI line interrupt detected */
  if (__HAL_GPIO_EXTI_GET_IT(GPIO_Pin) != 0x00u) {
    __HAL_GPIO_EXTI_CLEAR_IT(GPIO_Pin); // Clears The Interrupt Flag
    HAL_GPIO_EXTI_Callback(GPIO_Pin); // Calls The ISR Handler CallBack Function
  }
 
  // EXTI Line8 External Interrupt ISR Handler CallBackFun
  void HAL_GPIO_EXTI_Callback(uint16_t GPIO_Pin) {
    if (GPIO_Pin == GPIO_PIN_8) // If The INT Source Is EXTI Line9 (A9 Pin)
    {
      HAL_GPIO_TogglePin(GPIOA, GPIO_PIN_8); // Toggle The Output (LED) Pin
    }
  }
 
  /* USER CODE END 0 */

If you feel a post has answered your question, please click "Accept as Solution".
Nikita91
Lead II

To spot this kind of error use the Allman style of coding and not the K&R style. Braces are aligned at the beginning of the block and clearly visible.

The K&R style was invented in 1970' when the screens displayed 24 lines of 80 characters, and it was necessary to put as many as possible on the screen. Nowadays with high definition screens we no longer need this style.

But habits are hard to change....

That did it! Thanks your your help!