cancel
Showing results for 
Search instead for 
Did you mean: 

Should I set gcc in CubdIDE ?

MQi.1
Senior II

I want to bink a led on NUCLEO-G474RE, I used CubeMX and CudeIDE.

Since I don' t want to use IAR or Keil, so I select CubeIDE toolchain in CudeMX.

The code generated and has been opened as project in CubeDE, and the two lines has been added in main():

    HAL_GPIO_TogglePin (GPIOB, GPIO_PIN_11);

    HAL_Delay (100);

While, when I start to build, this info prompted:

Building in: E:\Blink_G474RE\build\default

make -f ..\..\Makefile

Error: build command 'make' not foundError:

What's wrong with it ?

Should I set the gcc environment variable manually?

I have heard gcc is the default build tool for CubeIDE, is there something I misunderstand ?

18 REPLIES 18

This solution works.0690X00000DBqSVQA1.png0690X00000DBqSLQA1.png

MQi.1
Senior II

While, now the project met 5 errors:

../Core/Src/main.c: In function 'main':

../Core/Src/main.c:107:3: warning: "/*" within comment [-Wcomment]

  /* USER CODE END 3 */

../Core/Src/main.c:167:13: error: invalid storage class for function 'MX_LPUART1_UART_Init'

 static void MX_LPUART1_UART_Init(void)

            ^~~~~~~~~~~~~~~~~~~~

../Core/Src/main.c:213:13: error: invalid storage class for function 'MX_GPIO_Init'

 static void MX_GPIO_Init(void)

            ^~~~~~~~~~~~

../Core/Src/main.c:269:1: error: expected declaration or statement at end of input

 }

 ^

../Core/Src/main.c: At top level:

../Core/Src/main.c:52:13: warning: 'MX_GPIO_Init' used but never defined

 static void MX_GPIO_Init(void);

            ^~~~~~~~~~~~

../Core/Src/main.c:53:13: warning: 'MX_LPUART1_UART_Init' used but never defined

 static void MX_LPUART1_UART_Init(void);

            ^~~~~~~~~~~~~~~~~~~~

../Core/Src/main.c:263:6: warning: 'Error_Handler' defined but not used [-Wunused-function]

 void Error_Handler(void)

     ^~~~~~~~~~~~~

../Core/Src/main.c:213:13: warning: 'MX_GPIO_Init' defined but not used [-Wunused-function]

 static void MX_GPIO_Init(void)

            ^~~~~~~~~~~~

../Core/Src/main.c:167:13: warning: 'MX_LPUART1_UART_Init' defined but not used [-Wunused-function]

 static void MX_LPUART1_UART_Init(void)

            ^~~~~~~~~~~~~~~~~~~~

../Core/Src/main.c:114:6: warning: 'SystemClock_Config' defined but not used [-Wunused-function]

 void SystemClock_Config(void)

     ^~~~~~~~~~~~~~~~~~

arm-none-eabi-gcc "../Core/Src/system_stm32g4xx.c" -mcpu=cortex-m4 -std=gnu11 -g3 -DUSE_HAL_DRIVER -DSTM32G474xx -DDEBUG -c -I../Drivers/STM32G4xx_HAL_Driver/Inc/Legacy -I../Drivers/CMSIS/Include -I../Drivers/CMSIS/Device/ST/STM32G4xx/Include -I../Core/Inc -I../Drivers/STM32G4xx_HAL_Driver/Inc -O0 -ffunction-sections -fdata-sections -Wall -fstack-usage -MMD -MP -MF"Core/Src/system_stm32g4xx.d" -MT"Core/Src/system_stm32g4xx.o" --specs=nano.specs -mfpu=fpv4-sp-d16 -mfloat-abi=hard -mthumb -o "Core/Src/system_stm32g4xx.o"

make: *** [Core/Src/subdir.mk:33: Core/Src/main.o] Error 1

make: *** Waiting for unfinished jobs....

"make -j8 all" terminated with exit code 2. Build might be incomplete.

10:16:26 Build Failed. 5 errors, 7 warnings. (took 4s.110ms)

after I added 2 lines here:

   /* USER CODE BEGIN 3 */

    HAL_GPIO_TogglePin (GPIOB, GPIO_PIN_11);

    HAL_Delay (100);  /* Insert delay 100 ms *

 }

 /* USER CODE END 3 */

MQi.1
Senior II

0690X00000DBqSzQAL.pngThose errors happened when I click the left button, when I click the right button, no errors and warnings.

and, when I commented these 2 lines:

    HAL_GPIO_TogglePin (GPIOB, GPIO_PIN_11);

    HAL_Delay (100);  /* Insert delay 100 ms *

everything was OK.

MQi.1
Senior II

Thanks, I found the reason:

There was lack of "/" at the end of the second line.

Now alas ist OK.

MQi.1
Senior II

The new question is: could I upload the program inside IDE, or I must use CubeProg ?

MQi.1
Senior II

How to download the code from PC to board, should I use CubeProg ?

KnarfB
Principal III

Many options.

STM32CubeIDE can do it, follow

  1. Video "How to use STM32CubeIDE" and STM32 youtube channel
  2. Read the docs, especially

STM32CubeProg can do it: use the STM32CubeIDE generated .elf file

A Nucleo board also appears as "USB Stick" on you PC. You may drag STM32CubeIDE generated .bin file for programming (flashing), not debugging.

MQi.1
Senior II

When I clicked this button,

0690X00000DBsJpQAL.png

this error prompted.

0690X00000DBsJuQAL.png

How to fix it?

MQi.1
Senior II

What's the difference between cproject file and project file ?