macgeorge/SCAN2000STM32

Missing main.h file

Closed this issue · 3 comments

Can't compile due to missing "main.h" header in "SCAN2000.c".

fssup commented

Haven't tried compiling yet, but it looks to my eye that everything is included in the c file, hence not needing a head (.h) file. Probably you need to fix your makefile? Can you post your makefile you're trying to get working?

I'm using the Arduino IDE to compile this source right now. (I typically develop on TI Devices).

The updates are a major improvement. The issue I'm currently facing is around the USART4 definition:

C:\Users\Work\OneDrive\Documents\Arduino\sketch_nov26a\sketch_nov26a.ino: In function 'int fputc(int, FILE*)':
sketch_nov26a:199:34: error: 'USART4' was not declared in this scope; did you mean 'USART1'?
  199 |   while(LL_USART_IsActiveFlag_TC(USART4) != 1);
      |                                  ^~~~~~
      |                                  USART1
sketch_nov26a:200:27: error: 'USART4' was not declared in this scope; did you mean 'USART1'?
  200 |   LL_USART_TransmitData8 (USART4, charac);
      |                           ^~~~~~
      |                           USART1
C:\Users\Work\OneDrive\Documents\Arduino\sketch_nov26a\sketch_nov26a.ino: In function 'void USART4_Init()':
sketch_nov26a:251:28: error: 'LL_APB1_GRP1_PERIPH_USART4' was not declared in this scope; did you mean 'LL_APB1_GRP1_PERIPH_USART2'?
  251 |   LL_APB1_GRP1_EnableClock(LL_APB1_GRP1_PERIPH_USART4);
      |                            ^~~~~~~~~~~~~~~~~~~~~~~~~~
      |                            LL_APB1_GRP1_PERIPH_USART2
sketch_nov26a:273:17: error: 'USART4' was not declared in this scope; did you mean 'USART1'?
  273 |   LL_USART_Init(USART4, &USART_InitStruct);
      |                 ^~~~~~
      |                 USART1
sketch_nov26a:286:34: error: 'LL_DMAMUX_REQ_USART4_TX' was not declared in this scope; did you mean 'LL_DMAMUX_REQ_USART2_TX'?
  286 |   DMA_InitStruct.PeriphRequest = LL_DMAMUX_REQ_USART4_TX;
      |                                  ^~~~~~~~~~~~~~~~~~~~~~~
      |                                  LL_DMAMUX_REQ_USART2_TX
C:\Users\Work\OneDrive\Documents\Arduino\sketch_nov26a\sketch_nov26a.ino: In function 'void UARTSendDMA()':
sketch_nov26a:299:34: error: 'USART4' was not declared in this scope; did you mean 'USART1'?
  299 |   while(LL_USART_IsActiveFlag_TC(USART4) != 1); // wait for previous transfer to finish
      |                                  ^~~~~~
      |                                  USART1
In file included from C:\Users\Work\AppData\Local\Arduino15\packages\STMicroelectronics\hardware\stm32\2.1.0\cores\arduino/stm32/clock.h:19,
                 from C:\Users\Work\AppData\Local\Arduino15\packages\STMicroelectronics\hardware\stm32\2.1.0\cores\arduino/wiring_time.h:23,
                 from C:\Users\Work\AppData\Local\Arduino15\packages\STMicroelectronics\hardware\stm32\2.1.0\cores\arduino/wiring.h:38,
                 from C:\Users\Work\AppData\Local\Arduino15\packages\STMicroelectronics\hardware\stm32\2.1.0\cores\arduino/Arduino.h:36,
                 from sketch\sketch_nov26a.ino.cpp:1:
C:\Users\Work\OneDrive\Documents\Arduino\sketch_nov26a\sketch_nov26a.ino: At global scope:
C:\Users\Work\AppData\Local\Arduino15\packages\STMicroelectronics\hardware\stm32\2.1.0\cores\arduino/stm32/stm32_def.h:109:25: error: variable or field '_Error_Handler' declared void
  109 | #define Error_Handler() _Error_Handler(__FILE__, __LINE__)
      |                         ^~~~~~~~~~~~~~
C:\Users\Work\OneDrive\Documents\Arduino\sketch_nov26a\sketch_nov26a.ino:558:6: note: in expansion of macro 'Error_Handler'
  558 | void Error_Handler()
      |      ^~~~~~~~~~~~~
exit status 1
'USART4' was not declared in this scope; did you mean 'USART1'?

This should be closed. I had the wrong board selected. Your updates did resolve a number of issues I originally had with the code base.

Really appreciate the update!